| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Pur.configure;
- using Pur.Entity;
- using Core.Mes.Client.Comm.Server;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Control;
- using Pur.Entity.configureEntity;
- using System.Collections;
- using com.hnshituo.pur.vo;
- using Core.Mes.Client.Comm.Tool;
- using Pur.require_plan;
- using Infragistics.Win.UltraWinTree;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- namespace Pur.pur_plan
- {
- public partial class frmPopConfEvaUser : FrmPmsBase
- {
- public frmPopConfEvaUser()
- {
- InitializeComponent();
- }
- //菜单按钮事件
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- Query();
- break;
- case "Add":
- confirm();
- break;
- case "Update":
- Update();
- break;
- case "Delete":
- Delete();
- break;
- }
- }
- /// <summary>
- /// 选择评标人员
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_EVA_USERNAME_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- if (ultraTree1.ActiveNode != null)
- {
- SetectManByDept frm = new SetectManByDept(this.ob, this.UserInfo.GetDeptid());
- frm.ShowDialog();
- txt_EVA_ORG_ID.Text = frm.StrDeptId;
- txt_EVA_ORG_NAME.Text = frm.StrDeptName;
- txt_EVA_USERID.Text = frm.StrUserID;
- txt_EVA_USERNAME.Text = frm.StrUserName;
- }
- }
- //刷新角色信息
- private void Query()
- {
- getSelEvaRole();
- }
- /// <summary>
- /// 添加
- /// </summary>
- private void confirm()
- {
- if (ultraTree1.ActiveNode != null)
- {
- //if (txt_EVA_ORG_ID.Text != ultraTree1.ActiveNode.Key)
- //{
- // if (MessageUtil.ShowYesNoAndTips("当前所选评标人员所在科室【" + txt_EVA_ORG_NAME.Text + "】不为左侧树形结构所选科室,是否确定添加?").Equals(DialogResult.No))
- // {
- // return;
- // }
- //}
- if (string.IsNullOrEmpty(txt_EVA_ORG_ID.Text))
- {
- MessageUtil.ShowTips("请选择人员");
- return;
- }
- if (string.IsNullOrEmpty(cmb_EVA_ROLE_NAME.Text))
- {
- MessageUtil.ShowTips("请选择角色");
- return;
- }
- PurConfEvaUserEntity ConfEvaUserEntity = new PurConfEvaUserEntity();
- ConfEvaUserEntity.EvaGroupId = ultraTree1.ActiveNode.Key;
- ConfEvaUserEntity.EvaUserid = txt_EVA_USERID.Text;//用户Id
- ConfEvaUserEntity.Validflag = "1";
- if (isExsitRow("com.hnshituo.pur.purplan.service.ConfEvaUserService", ConfEvaUserEntity)>0)
- {
- MessageUtil.ShowTips("所选评标人员分组存在相同用户,不能重复添加");
- return;
- }
- string strId = this.execute<string>("com.hnshituo.pur.utils.service.UtilsService", "getOddNumber", new object[] { "PUR_CONF_EVA_USER", "ID", ultraTree1.ActiveNode.Key, "3" });
- ConfEvaUserEntity.Id = strId;
- ConfEvaUserEntity.CreateName = UserInfo.GetUserName();
- ConfEvaUserEntity.CreateUserId = UserInfo.GetUserID();
- ConfEvaUserEntity.CreateTime = System.DateTime.Now;
- ConfEvaUserEntity.EvaRoleId = cmb_EVA_ROLE_NAME.Value.ToString();//角色Id
- ConfEvaUserEntity.EvaRoleName = cmb_EVA_ROLE_NAME.Text;//角色名称
- ConfEvaUserEntity.EvaUserid = txt_EVA_USERID.Text;//用户Id
- ConfEvaUserEntity.EvaUsername = txt_EVA_USERNAME.Text;//用户名称
- ConfEvaUserEntity.EvaOrgId = txt_EVA_ORG_ID.Text;//科室Id
- ConfEvaUserEntity.EvaOrgName = txt_EVA_ORG_NAME.Text;//科室名称
- ConfEvaUserEntity.Validflag = "1";
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.ConfEvaUserService", "doInsert", new object[] { ConfEvaUserEntity });
- if (crt.Resultcode != 0)
- {
- MessageUtil.ShowTips("添加失败 " + crt.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("添加成功");
- //if (txt_EVA_ORG_ID.Text != ultraTree1.ActiveNode.Key)
- //{
- // getSelEvaRole();//查询评标人员科室
- // UltraTreeNode utnd = ultraTree1.GetNodeByKey(txt_EVA_ORG_ID.Text);
- // ultraTree1.ActiveNode = utnd;
- // getSelEvaUsers(ultraTree1.ActiveNode.Key);
- // comm.doActiveSelRow(ultraGrid2, "ID", strId);
- //}
- //else
- //{
- getSelEvaUsers(ultraTree1.ActiveNode.Key);
- comm.doActiveSelRow(ultraGrid2, "ID", strId);
- //}
- }
- }
- /// <summary>
- /// 修改
- /// </summary>
- private void Update()
- {
- if (ultraGrid2.ActiveRow == null)
- { return; }
- if (string.IsNullOrEmpty(txt_EVA_ORG_ID.Text))
- {
- MessageUtil.ShowTips("请选择人员");
- return;
- }
- if (string.IsNullOrEmpty(cmb_EVA_ROLE_NAME.Text))
- {
- MessageUtil.ShowTips("请选择角色");
- return;
- }
- PurConfEvaUserEntity ConfEvaUserEntity = new PurConfEvaUserEntity();
- ConfEvaUserEntity.EvaGroupId = ultraTree1.ActiveNode.Key;
- //ConfEvaUserEntity.EvaOrgId = txt_EVA_ORG_ID.Text;//科室Id
- //ConfEvaUserEntity.EvaRoleId = cmb_EVA_ROLE_NAME.Value.ToString();//角色Id
- ConfEvaUserEntity.EvaUserid = txt_EVA_USERID.Text;//用户Id
- ConfEvaUserEntity.Validflag = "1";
- if (txt_EVA_USERID.Text != ultraGrid2.ActiveRow.Cells["EVAUSERID"].Value.ToString())
- {
- if (isExsitRow("com.hnshituo.pur.purplan.service.ConfEvaUserService", ConfEvaUserEntity) > 0)
- {
- MessageUtil.ShowTips("所选评标人员分组存在相同用户,不能修改");
- return;
- }
- }
- //if (txt_EVA_ORG_ID.Text != ultraTree1.ActiveNode.Key)
- //{
- // if (MessageUtil.ShowYesNoAndTips("当前所选评标人员所在科室【" + txt_EVA_ORG_NAME.Text + "】不为左侧树形结构所选科室,是否确定添加?").Equals(DialogResult.No))
- // {
- // return;
- // }
- //}
- ConfEvaUserEntity.Id = ultraGrid2.ActiveRow.Cells["ID"].Value.ToString();
- ConfEvaUserEntity.UpdateName = UserInfo.GetUserName();
- ConfEvaUserEntity.UpdateUserId = UserInfo.GetUserID();
- ConfEvaUserEntity.UpdateTime = System.DateTime.Now;
- ConfEvaUserEntity.EvaRoleName = cmb_EVA_ROLE_NAME.Text;//角色名称
- ConfEvaUserEntity.EvaUserid = txt_EVA_USERID.Text;//用户Id
- ConfEvaUserEntity.EvaUsername = txt_EVA_USERNAME.Text;//用户名称
- ConfEvaUserEntity.EvaOrgId = txt_EVA_ORG_ID.Text;//科室Id
- ConfEvaUserEntity.EvaOrgName = txt_EVA_ORG_NAME.Text;//科室名称
- ConfEvaUserEntity.Validflag = "1";
- if (MessageUtil.ShowYesNoAndQuestion("确定修改?") != DialogResult.Yes)
- {
- return;
- }
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.ConfEvaUserService", "doUpdate", new object[] { ConfEvaUserEntity });
- if (crt.Resultcode != 0)
- {
- MessageUtil.ShowTips("修改失败 " + crt.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("修改成功");
- //if (txt_EVA_ORG_ID.Text != ultraTree1.ActiveNode.Key)
- //{
- // getSelEvaRole();//查询评标人员科室
- // UltraTreeNode utnd = ultraTree1.GetNodeByKey(txt_EVA_ORG_ID.Text);
- // ultraTree1.ActiveNode = utnd;
- // getSelEvaUsers(ultraTree1.ActiveNode.Key);
- // comm.doActiveSelRow(ultraGrid2, "ID", ConfEvaUserEntity.Id);
- //}
- //else
- //{
- getSelEvaUsers(ultraTree1.ActiveNode.Key);
- comm.doActiveSelRow(ultraGrid2, "ID", ConfEvaUserEntity.Id);
- //}
-
- }
- /// <summary>
- /// 删除
- /// </summary>
- private void Delete()
- {
- if (ultraGrid2.ActiveRow == null)
- { return; }
- PurConfEvaUserEntity ConfEvaUserEntity = new PurConfEvaUserEntity();
- ConfEvaUserEntity.Id = ultraGrid2.ActiveRow.Cells["Id"].Value.ToString();
- ConfEvaUserEntity.Validflag = "0";
- ConfEvaUserEntity.DeleteName = UserInfo.GetUserName();
- ConfEvaUserEntity.DeleteUserId = UserInfo.GetUserID();
- ConfEvaUserEntity.DeleteTime = System.DateTime.Now;
- if (MessageUtil.ShowYesNoAndQuestion("确定删除?") != DialogResult.Yes)
- {
- return;
- }
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.ConfEvaUserService", "doUpdate", new object[] { ConfEvaUserEntity });
- if (crt.Resultcode != 0)
- {
- MessageUtil.ShowTips("删除失败 " + crt.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("删除成功");
- getSelEvaUsers(ultraTree1.ActiveNode.Key);
- comm.doActiveSelRow(ultraGrid2, "ID", ConfEvaUserEntity.Id);
- }
- /// <summary>
- /// 选择节点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraTree1_AfterSelect(object sender, Infragistics.Win.UltraWinTree.SelectEventArgs e)
- {
- if (ultraTree1.ActiveNode != null)
- {
- getSelEvaUsers(ultraTree1.ActiveNode.Key);
- }
- }
- /// <summary>
- /// 查询选择评标人员角色信息
- /// </summary>
- private void getSelEvaUsers(string strEvaGroupId)
- {
- //PurTaskEvaUsersEntity TaskEvaUsersEntity = new PurTaskEvaUsersEntity();
- PurConfEvaUserEntity ConfEvaUserEntity = new PurConfEvaUserEntity();
- ConfEvaUserEntity.EvaGroupId = strEvaGroupId;
- ConfEvaUserEntity.Validflag = "1";
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.purplan.service.ConfEvaUserService", "find", new object[] { ConfEvaUserEntity, 0, 0 });
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
- GridHelper.RefreshAndAutoSize(ultraGrid2);
- ConfigureClassCommon.clearOldData(txt_EVA_ORG_ID.Parent);
- }
- /// <summary>
- /// 查询评标人员分组
- /// </summary>
- private void getSelEvaRole()
- {
- ultraTree1.Nodes.Clear();
- //评标人员科室
- //DataTable dt = this.execute<DataTable>("com.hnshituo.pur.purplan.service.ConfEvaUserService", "getConfEvaUser", new object[] { });
- //for (int i = 0; i < dt.Rows.Count; i++)
- //{
- // ultraTree1.Nodes.Add(dt.Rows[i]["evaorgid"].ToString(), dt.Rows[i]["evaorgname"].ToString());
- //}
- //评标人员分组
- DataTable dt = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1227" }, this.ob);
- for (int j = 0; j < dt.Rows.Count; j++)
- {
- if (dt.Rows[j]["Validflag"].ToString() == "1")
- {
- ultraTree1.Nodes.Add(dt.Rows[j]["BASECODE"].ToString(), dt.Rows[j]["BASENAME"].ToString());
- }
- }
- }
- private void frmPopConfEvaUser_Load(object sender, EventArgs e)
- {
- //评标人员角色
- DataTable dt = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1224" }, this.ob);
- dt.DefaultView.RowFilter = "Validflag='1'";
- dt = dt.DefaultView.ToTable();
- cmb_EVA_ROLE_NAME.DataSource = dt;
- cmb_EVA_ROLE_NAME.DisplayMember = "BASENAME";
- cmb_EVA_ROLE_NAME.ValueMember = "BASECODE";
- getSelEvaRole();
- }
- /// <summary>
- /// 绑定所有的下拉列表的数据
- /// </summary>
- private void getUltcmbBindValueList(DataTable dt, UltraComboEditor ultcmb)
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- ValueListItem vlItem = new ValueListItem(dt.Rows[i]["BASECODE"].ToString().Trim(), dt.Rows[i]["BASENAME"].ToString().Trim());
- ultcmb.Items.Add(vlItem);
- }
- }
- /// <summary>
- /// 移除无效数据
- /// </summary>
- /// <param name="dt"></param>
- private void removeNotValiflagData(DataTable dt)
- {
- for (int i = 0; i < dt.Rows.Count; )
- {
- if (dt.Rows[i]["VALIDFLAG"].ToString() == "0")
- {
- dt.Rows.RemoveAt(i);
- }
- else
- {
- i++;
- }
- }
- }
- /// <summary>
- /// 绑定下拉列表的数据
- /// </summary>
- /// <param name="dt"></param>
- /// <summary>
- private void getUltcmbBindData()
- {
- DataTable dt = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1101" }, this.ob);
- removeNotValiflagData(dt);
- getUltcmbBindValueList(dt, cmb_EVA_ROLE_NAME);
- }
- /// <summary>
- /// 判断数据库中是否存在相同的列
- /// </summary>
- /// <param name="strJavaPackName"></param>
- /// <param name="o"></param>
- /// <returns>true存在</returns>
- public int isExsitRow(string strJavaPackName, object o)
- {
- DataTable dt = this.execute<DataTable>(strJavaPackName, "find", new object[] { o, 0, 0 });
- if (dt != null && dt.Rows.Count > 0)//存在相同的行
- {
- return dt.Rows.Count;
- }
- return 0;
- }
- /// <summary>
- /// 激活grid传值给控件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- cmb_EVA_ROLE_NAME.Text = ultraGrid2.ActiveRow.Cells["EVAROLENAME"].Value.ToString();//角色名称
- txt_EVA_ORG_ID.Text = ultraGrid2.ActiveRow.Cells["EVAORGID"].Value.ToString();//科室Id
- txt_EVA_USERID.Text = ultraGrid2.ActiveRow.Cells["EVAUSERID"].Value.ToString();//用户Id
- txt_EVA_USERNAME.Text = ultraGrid2.ActiveRow.Cells["EVAUSERNAME"].Value.ToString();//用户名称
- txt_EVA_ORG_NAME.Text = ultraGrid2.ActiveRow.Cells["EVAORGNAME"].Value.ToString();//科室名称
- }
- }
- }
|