public HDJContract(HDJContract contract) { this.m_name = contract.m_name; this.m_submitDate = contract.m_submitDate; this.m_id = contract.m_id; this.m_columnDatas = contract.m_columnDatas; this.m_submitEmployee = contract.m_submitEmployee; this.m_conTemp = contract.m_conTemp; // this.m_currLevel = contract.m_currLevel; // this.m_maxLevel = contract.m_maxLevel; this.m_signResults = contract.m_signResults; this.m_signRemarks = contract.m_signRemarks; }
private void ViewConTemp_Load(object sender, EventArgs e) { try { Templete temp = new Templete(); temp = _sc.GetContractTemplate(Id); this.ConTempName.Text = temp.Name.ToString(); this.Column1.Text = temp.ColumnNames[0].ToString(); this.Column2.Text = temp.ColumnNames[1].ToString(); this.Column3.Text = temp.ColumnNames[2].ToString(); this.Column4.Text = temp.ColumnNames[3].ToString(); this.Column5.Text = temp.ColumnNames[4].ToString(); this.Sign1.Text = temp.SignDatas[0].SignInfo.ToString(); this.Sign2.Text = temp.SignDatas[1].SignInfo.ToString(); this.Sign3.Text = temp.SignDatas[2].SignInfo.ToString(); this.Sign4.Text = temp.SignDatas[3].SignInfo.ToString(); this.Sign5.Text = temp.SignDatas[4].SignInfo.ToString(); this.Sign6.Text = temp.SignDatas[5].SignInfo.ToString(); this.Sign7.Text = temp.SignDatas[6].SignInfo.ToString(); this.Sign8.Text = temp.SignDatas[7].SignInfo.ToString(); this.SignPer1.Text = temp.SignDatas[0].SignEmployee.Name.ToString(); this.SignPer2.Text = temp.SignDatas[1].SignEmployee.Name.ToString(); this.SignPer3.Text = temp.SignDatas[2].SignEmployee.Name.ToString(); this.SignPer4.Text = temp.SignDatas[3].SignEmployee.Name.ToString(); this.SignPer5.Text = temp.SignDatas[4].SignEmployee.Name.ToString(); this.SignPer6.Text = temp.SignDatas[5].SignEmployee.Name.ToString(); this.SignPer7.Text = temp.SignDatas[6].SignEmployee.Name.ToString(); this.SignPer8.Text = temp.SignDatas[7].SignEmployee.Name.ToString(); } catch { MessageBox.Show("加载数据失败!"); Logging.AddLog("查看模板详细信息失败!"); if (MessageBox.Show("好吧,我们的程序出现点问题需要重新启动\n点击\"确定\"重启\n点击\"取消\"退出程序?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { Application.Restart(); } else { Application.Exit(); } } }
private void button1_Click(object sender, EventArgs e) { if (this.CheckIntegrity() == false) { return; } Templete temp = new Templete(); SignatureTemplate signtemp1 = new SignatureTemplate(); SignatureTemplate signtemp2 = new SignatureTemplate(); SignatureTemplate signtemp3 = new SignatureTemplate(); SignatureTemplate signtemp4 = new SignatureTemplate(); SignatureTemplate signtemp5 = new SignatureTemplate(); SignatureTemplate signtemp6 = new SignatureTemplate(); SignatureTemplate signtemp7 = new SignatureTemplate(); SignatureTemplate signtemp8 = new SignatureTemplate(); List<string> list = new List<string>(); List<SignatureTemplate> tlist = new List<SignatureTemplate>(); // 会签单的名称 temp.Name = this.ConTempName.Text.ToString(); // 添加前5行的会签单基本信息 list.Add(this.Column1.Text.ToString()); list.Add(this.Column2.Text.ToString()); list.Add(this.Column3.Text.ToString()); list.Add(this.Column4.Text.ToString()); list.Add(this.Column5.Text.ToString()); temp.ColumnNames = list; /// 添加后8行的签字人的信息基本信息 signtemp1.SignInfo = this.Sign1.Text.ToString(); Employee emp1 = new Employee(); emp1.Name = this.SignPer1.SelectedText; emp1.Id = Convert.ToInt32(this.SignPer1.SelectedValue.ToString()); Department dep1 = new Department(); dep1.Id = Convert.ToInt32(this.SignDep1.SelectedValue.ToString()); dep1.Name = this.SignDep1.SelectedText; emp1.Department = dep1; signtemp1.SignEmployee = emp1; signtemp1.SignLevel = Convert.ToInt32(this.Sign1Level.SelectedItem.ToString()); signtemp1.CanView = this.View1.SelectedIndex; signtemp1.CanDownload = this.Download1.SelectedIndex; tlist.Add(signtemp1); signtemp2.SignInfo = this.Sign2.Text.ToString(); Employee emp2 = new Employee(); emp2.Name = this.SignPer2.SelectedText; emp2.Id = Convert.ToInt32(this.SignPer2.SelectedValue.ToString()); Department dep2 = new Department(); dep2.Id = Convert.ToInt32(this.SignDep2.SelectedValue.ToString()); dep2.Name = this.SignDep2.SelectedText; emp2.Department = dep2; signtemp2.SignEmployee = emp2; signtemp2.SignLevel = Convert.ToInt32(this.Sign2Level.SelectedItem.ToString()); signtemp2.CanView = this.View2.SelectedIndex; signtemp2.CanDownload = this.Download2.SelectedIndex; tlist.Add(signtemp2); signtemp3.SignInfo = this.Sign3.Text.ToString(); Employee emp3 = new Employee(); emp3.Name = this.SignPer3.SelectedText; emp3.Id = Convert.ToInt32(this.SignPer3.SelectedValue.ToString()); Department dep3 = new Department(); dep3.Id = Convert.ToInt32(this.SignDep3.SelectedValue.ToString()); dep3.Name = this.SignDep3.SelectedText; emp3.Department = dep3; signtemp3.SignEmployee = emp3; signtemp3.SignLevel = Convert.ToInt32(this.Sign3Level.SelectedItem.ToString()); signtemp3.CanView = this.View3.SelectedIndex; signtemp3.CanDownload = this.Download3.SelectedIndex; tlist.Add(signtemp3); signtemp4.SignInfo = this.Sign4.Text.ToString(); Employee emp4 = new Employee(); emp4.Name = this.SignPer4.SelectedText; emp4.Id = Convert.ToInt32(this.SignPer4.SelectedValue.ToString()); Department dep4 = new Department(); dep4.Id = Convert.ToInt32(this.SignDep4.SelectedValue.ToString()); dep4.Name = this.SignDep4.SelectedText; emp4.Department = dep4; signtemp4.SignEmployee = emp4; signtemp4.SignLevel = Convert.ToInt32(this.Sign4Level.SelectedItem.ToString()); signtemp4.CanView = this.View4.SelectedIndex; signtemp4.CanDownload = this.Download4.SelectedIndex; tlist.Add(signtemp4); signtemp5.SignInfo = this.Sign5.Text.ToString(); Employee emp5 = new Employee(); emp5.Name = this.SignPer5.SelectedText; emp5.Id = Convert.ToInt32(this.SignPer5.SelectedValue.ToString()); Department dep5 = new Department(); dep5.Id = Convert.ToInt32(this.SignDep5.SelectedValue.ToString()); dep5.Name = this.SignDep5.SelectedText; emp5.Department = dep5; signtemp5.SignEmployee = emp5; signtemp5.SignLevel = Convert.ToInt32(this.Sign5Level.SelectedItem.ToString()); signtemp5.CanView = this.View5.SelectedIndex; signtemp5.CanDownload = this.Download5.SelectedIndex; tlist.Add(signtemp5); signtemp6.SignInfo = this.Sign6.Text.ToString(); Employee emp6 = new Employee(); emp6.Name = this.SignPer6.SelectedText; emp6.Id = Convert.ToInt32(this.SignPer6.SelectedValue.ToString()); Department dep6 = new Department(); dep6.Id = Convert.ToInt32(this.SignDep6.SelectedValue.ToString()); dep6.Name = this.SignDep6.SelectedText; emp6.Department = dep6; signtemp6.SignEmployee = emp6; signtemp6.SignLevel = Convert.ToInt32(this.Sign6Level.SelectedItem.ToString()); signtemp6.CanView = this.View6.SelectedIndex; signtemp6.CanDownload = this.Download6.SelectedIndex; tlist.Add(signtemp6); signtemp7.SignInfo = this.Sign7.Text.ToString(); Employee emp7 = new Employee(); emp7.Name = this.SignPer7.SelectedText; emp7.Id = Convert.ToInt32(this.SignPer7.SelectedValue.ToString()); Department dep7 = new Department(); dep7.Id = Convert.ToInt32(this.SignDep7.SelectedValue.ToString()); dep7.Name = this.SignDep7.SelectedText; emp7.Department = dep7; signtemp7.SignEmployee = emp7; signtemp7.SignLevel = Convert.ToInt32(this.Sign7Level.SelectedItem.ToString()); signtemp7.CanView = this.View7.SelectedIndex; signtemp7.CanDownload = this.Download7.SelectedIndex; tlist.Add(signtemp7); signtemp8.SignInfo = this.Sign8.Text.ToString(); Employee emp8 = new Employee(); emp8.Name = this.SignPer8.SelectedText; emp8.Id = Convert.ToInt32(this.SignPer8.SelectedValue.ToString()); Department dep8 = new Department(); dep8.Id = Convert.ToInt32(this.SignDep8.SelectedValue.ToString()); dep8.Name = this.SignDep8.SelectedText; emp8.Department = dep8; signtemp8.SignEmployee = emp8; signtemp8.SignLevel = Convert.ToInt32(this.Sign8Level.SelectedItem.ToString()); signtemp8.CanView = this.View8.SelectedIndex; signtemp8.CanDownload = this.Download8.SelectedIndex; tlist.Add(signtemp8); temp.SignDatas = tlist; string result = _sc.AddConTemplete(temp); if (result == Response.INSERT_CONTRACT_TEMPLATE_SUCCESS.ToString()) { MessageBox.Show("添加模板" + this.ConTempName.Text + "成功!"); } else { MessageBox.Show("添加模板失败!"); } }
/// <summary> /// 修改模板信息 /// </summary> /// <param name="temp"></param> /// <returns></returns> public string ModifyContractTemplate(Templete temp) { //return Task.Factory.StartNew(() => { try { SocketMessage sm = new SocketMessage(Request.MODIFY_CONTRACT_TEMPLATE_REQUEST, temp); ClientSocket.Send(Encoding.UTF8.GetBytes(sm.Package)); recLength = ClientSocket.Receive(recivebuffer); string recMsg = Encoding.UTF8.GetString(recivebuffer, 0, recLength); string[] Msg = recMsg.Split(SocketMessage.DEFAULT_SEPARATOR); if (Msg[0] == Response.DELETE_CONTRACT_TEMPLATE_SUCCESS.ToString()) { Logging.AddLog("修改模板成功!"); } else { Logging.AddLog("修改模板失败!"); } return Msg[0]; } catch { Logging.AddLog("修改模板失败(服务器连接中断)!"); return "服务器连接中断"; } //}); } }
/// <summary> /// 查询特定模板信息 /// </summary> /// <param name="tempId"></param> /// <returns></returns> public Templete GetContractTemplate(int tempId) { //return Task.Factory.StartNew(() => { try { SocketMessage sm = new SocketMessage(Request.GET_CONTRACT_TEMPLATE_REQUEST, tempId); ClientSocket.Send(Encoding.UTF8.GetBytes(sm.Package)); recLength = ClientSocket.Receive(recivebuffer); string recMsg = Encoding.UTF8.GetString(recivebuffer, 0, recLength); string[] Msg = recMsg.Split(SocketMessage.DEFAULT_SEPARATOR); if (Msg[0] == Response.GET_CONTRACT_TEMPLATE_SUCCESS.ToString()) { Templete list = new Templete(); list = JsonConvert.DeserializeObject<Templete>(Msg[2]); return list; } else { Logging.AddLog("查询特定模板列表失败!"); return null; } } catch { Logging.AddLog("查询特定模板列表失败(服务器连接中断)!"); return null; } }//); }
private void button1_Click(object sender, EventArgs e) { if (this.CheckIntegrity() == false) { return; } Templete temp = new Templete(); SignatureTemplate signtemp1 = new SignatureTemplate(); SignatureTemplate signtemp2 = new SignatureTemplate(); SignatureTemplate signtemp3 = new SignatureTemplate(); SignatureTemplate signtemp4 = new SignatureTemplate(); SignatureTemplate signtemp5 = new SignatureTemplate(); SignatureTemplate signtemp6 = new SignatureTemplate(); SignatureTemplate signtemp7 = new SignatureTemplate(); SignatureTemplate signtemp8 = new SignatureTemplate(); List<string> list = new List<string>(); List<SignatureTemplate> tlist = new List<SignatureTemplate>(); temp.Name = this.ConTempName.Text.ToString(); list.Add(this.Column1.Text.ToString()); list.Add(this.Column2.Text.ToString()); list.Add(this.Column3.Text.ToString()); list.Add(this.Column4.Text.ToString()); list.Add(this.Column5.Text.ToString()); temp.ColumnNames = list; signtemp1.SignInfo = this.Sign1.Text.ToString(); Employee emp1 = new Employee(); emp1.Name = this.SignPer1.SelectedText; emp1.Id = Convert.ToInt32(this.SignPer1.SelectedValue.ToString()); Department dep1 = new Department(); dep1.Id = Convert.ToInt32(this.SignDep1.SelectedValue.ToString()); dep1.Name = this.SignDep1.SelectedText; emp1.Department = dep1; signtemp1.SignEmployee = emp1; signtemp1.SignLevel = Convert.ToInt32(this.Sign1Level.SelectedItem.ToString()); signtemp1.CanView = this.View1.SelectedIndex; signtemp1.CanDownload = this.Download1.SelectedIndex; tlist.Add(signtemp1); signtemp2.SignInfo = this.Sign2.Text.ToString(); Employee emp2 = new Employee(); emp2.Name = this.SignPer2.SelectedText; emp2.Id = Convert.ToInt32(this.SignPer2.SelectedValue.ToString()); Department dep2 = new Department(); dep2.Id = Convert.ToInt32(this.SignDep2.SelectedValue.ToString()); dep2.Name = this.SignDep2.SelectedText; emp2.Department = dep2; signtemp2.SignEmployee = emp2; signtemp2.SignLevel = Convert.ToInt32(this.Sign2Level.SelectedItem.ToString()); signtemp2.CanView = this.View2.SelectedIndex; signtemp2.CanDownload = this.Download2.SelectedIndex; tlist.Add(signtemp2); signtemp3.SignInfo = this.Sign3.Text.ToString(); Employee emp3 = new Employee(); emp3.Name = this.SignPer3.SelectedText; emp3.Id = Convert.ToInt32(this.SignPer3.SelectedValue.ToString()); Department dep3 = new Department(); dep3.Id = Convert.ToInt32(this.SignDep3.SelectedValue.ToString()); dep3.Name = this.SignDep3.SelectedText; emp3.Department = dep3; signtemp3.SignEmployee = emp3; signtemp3.SignLevel = Convert.ToInt32(this.Sign3Level.SelectedItem.ToString()); signtemp3.CanView = this.View3.SelectedIndex; signtemp3.CanDownload = this.Download3.SelectedIndex; tlist.Add(signtemp3); signtemp4.SignInfo = this.Sign4.Text.ToString(); Employee emp4 = new Employee(); emp4.Name = this.SignPer4.SelectedText; emp4.Id = Convert.ToInt32(this.SignPer4.SelectedValue.ToString()); Department dep4 = new Department(); dep4.Id = Convert.ToInt32(this.SignDep4.SelectedValue.ToString()); dep4.Name = this.SignDep4.SelectedText; emp4.Department = dep4; signtemp4.SignEmployee = emp4; signtemp4.SignLevel = Convert.ToInt32(this.Sign4Level.SelectedItem.ToString()); signtemp4.CanView = this.View4.SelectedIndex; signtemp4.CanDownload = this.Download4.SelectedIndex; tlist.Add(signtemp4); signtemp5.SignInfo = this.Sign5.Text.ToString(); Employee emp5 = new Employee(); emp5.Name = this.SignPer5.SelectedText; emp5.Id = Convert.ToInt32(this.SignPer5.SelectedValue.ToString()); Department dep5 = new Department(); dep5.Id = Convert.ToInt32(this.SignDep5.SelectedValue.ToString()); dep5.Name = this.SignDep5.SelectedText; emp5.Department = dep5; signtemp5.SignEmployee = emp5; signtemp5.SignLevel = Convert.ToInt32(this.Sign5Level.SelectedItem.ToString()); signtemp5.CanView = this.View5.SelectedIndex; signtemp5.CanDownload = this.Download5.SelectedIndex; tlist.Add(signtemp5); signtemp6.SignInfo = this.Sign6.Text.ToString(); Employee emp6 = new Employee(); emp6.Name = this.SignPer6.SelectedText; emp6.Id = Convert.ToInt32(this.SignPer6.SelectedValue.ToString()); Department dep6 = new Department(); dep6.Id = Convert.ToInt32(this.SignDep6.SelectedValue.ToString()); dep6.Name = this.SignDep6.SelectedText; emp6.Department = dep6; signtemp6.SignEmployee = emp6; signtemp6.SignLevel = Convert.ToInt32(this.Sign6Level.SelectedItem.ToString()); signtemp6.CanView = this.View6.SelectedIndex; signtemp6.CanDownload = this.Download6.SelectedIndex; tlist.Add(signtemp6); signtemp7.SignInfo = this.Sign7.Text.ToString(); Employee emp7 = new Employee(); emp7.Name = this.SignPer7.SelectedText; emp7.Id = Convert.ToInt32(this.SignPer7.SelectedValue.ToString()); Department dep7 = new Department(); dep7.Id = Convert.ToInt32(this.SignDep7.SelectedValue.ToString()); dep7.Name = this.SignDep7.SelectedText; emp7.Department = dep7; signtemp7.SignEmployee = emp7; signtemp7.SignLevel = Convert.ToInt32(this.Sign7Level.SelectedItem.ToString()); signtemp7.CanView = this.View7.SelectedIndex; signtemp7.CanDownload = this.Download7.SelectedIndex; tlist.Add(signtemp7); signtemp8.SignInfo = this.Sign8.Text.ToString(); Employee emp8 = new Employee(); emp8.Name = this.SignPer8.SelectedText; emp8.Id = Convert.ToInt32(this.SignPer8.SelectedValue.ToString()); Department dep8 = new Department(); dep8.Id = Convert.ToInt32(this.SignDep8.SelectedValue.ToString()); dep8.Name = this.SignDep8.SelectedText; emp8.Department = dep8; signtemp8.SignEmployee = emp8; signtemp8.SignLevel = Convert.ToInt32(this.Sign8Level.SelectedItem.ToString()); signtemp8.CanView = this.View8.SelectedIndex; signtemp8.CanDownload = this.Download8.SelectedIndex; tlist.Add(signtemp8); temp.SignDatas = tlist; temp.TempId = Id; string result = _sc.ModifyContractTemplate(temp); if (result == Response.MODIFY_CONTRACT_TEMPLATE_SUCCESS.ToString()) { MessageBox.Show("修改模板成功!", "提示", MessageBoxButtons.OK); this.DialogResult = DialogResult.OK; } else if (result == "服务器连接中断") { MessageBox.Show("服务器连接中断,修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void EditConTemp_Load(object sender, EventArgs e) { BindDepartment(UserHelper.DepList); //绑定部门信息 try { Templete temp = new Templete(); temp = _sc.GetContractTemplate(Id); this.ConTempName.Text = temp.Name.ToString(); this.Column1.Text = temp.ColumnNames[0].ToString(); this.Column2.Text = temp.ColumnNames[1].ToString(); this.Column3.Text = temp.ColumnNames[2].ToString(); this.Column4.Text = temp.ColumnNames[3].ToString(); this.Column5.Text = temp.ColumnNames[4].ToString(); this.Sign1.Text = temp.SignDatas[0].SignInfo.ToString(); this.Sign2.Text = temp.SignDatas[1].SignInfo.ToString(); this.Sign3.Text = temp.SignDatas[2].SignInfo.ToString(); this.Sign4.Text = temp.SignDatas[3].SignInfo.ToString(); this.Sign5.Text = temp.SignDatas[4].SignInfo.ToString(); this.Sign6.Text = temp.SignDatas[5].SignInfo.ToString(); this.Sign7.Text = temp.SignDatas[6].SignInfo.ToString(); this.Sign8.Text = temp.SignDatas[7].SignInfo.ToString(); this.SignDep1.SelectedValue = temp.SignDatas[0].SignEmployee.Department.Id; this.SignDep2.SelectedValue = temp.SignDatas[1].SignEmployee.Department.Id; this.SignDep3.SelectedValue = temp.SignDatas[2].SignEmployee.Department.Id; this.SignDep4.SelectedValue = temp.SignDatas[3].SignEmployee.Department.Id; this.SignDep5.SelectedValue = temp.SignDatas[4].SignEmployee.Department.Id; this.SignDep6.SelectedValue = temp.SignDatas[5].SignEmployee.Department.Id; this.SignDep7.SelectedValue = temp.SignDatas[6].SignEmployee.Department.Id; this.SignDep8.SelectedValue = temp.SignDatas[7].SignEmployee.Department.Id; this.SignPer1.SelectedValue = temp.SignDatas[0].SignEmployee.Id; this.SignPer2.SelectedValue = temp.SignDatas[1].SignEmployee.Id; this.SignPer3.SelectedValue = temp.SignDatas[2].SignEmployee.Id; this.SignPer4.SelectedValue = temp.SignDatas[3].SignEmployee.Id; this.SignPer5.SelectedValue = temp.SignDatas[4].SignEmployee.Id; this.SignPer6.SelectedValue = temp.SignDatas[5].SignEmployee.Id; this.SignPer7.SelectedValue = temp.SignDatas[6].SignEmployee.Id; this.SignPer8.SelectedValue = temp.SignDatas[7].SignEmployee.Id; this.Sign1Level.SelectedItem = temp.SignDatas[0].SignLevel.ToString(); this.Sign2Level.SelectedItem = temp.SignDatas[1].SignLevel.ToString(); this.Sign3Level.SelectedItem = temp.SignDatas[2].SignLevel.ToString(); this.Sign4Level.SelectedItem = temp.SignDatas[3].SignLevel.ToString(); this.Sign5Level.SelectedItem = temp.SignDatas[4].SignLevel.ToString(); this.Sign6Level.SelectedItem = temp.SignDatas[5].SignLevel.ToString(); this.Sign7Level.SelectedItem = temp.SignDatas[6].SignLevel.ToString(); this.Sign8Level.SelectedItem = temp.SignDatas[7].SignLevel.ToString(); this.View1.SelectedIndex = temp.SignDatas[0].CanView; this.View2.SelectedIndex = temp.SignDatas[1].CanView; this.View3.SelectedIndex = temp.SignDatas[2].CanView; this.View4.SelectedIndex = temp.SignDatas[3].CanView; this.View5.SelectedIndex = temp.SignDatas[4].CanView; this.View6.SelectedIndex = temp.SignDatas[5].CanView; this.View7.SelectedIndex = temp.SignDatas[6].CanView; this.View8.SelectedIndex = temp.SignDatas[7].CanView; this.Download1.SelectedIndex = temp.SignDatas[0].CanDownload; this.Download2.SelectedIndex = temp.SignDatas[1].CanDownload; this.Download3.SelectedIndex = temp.SignDatas[2].CanDownload; this.Download4.SelectedIndex = temp.SignDatas[3].CanDownload; this.Download5.SelectedIndex = temp.SignDatas[4].CanDownload; this.Download6.SelectedIndex = temp.SignDatas[5].CanDownload; this.Download7.SelectedIndex = temp.SignDatas[6].CanDownload; this.Download8.SelectedIndex = temp.SignDatas[7].CanDownload; } catch { MessageBox.Show("加载数据失败!"); Logging.AddLog("修改模板时加载模板信息失败!"); // 重启应用程序 if (MessageBox.Show("好吧,我们的程序出现点问题需要重新启动\n点击\"确定\"重启\n点击\"取消\"退出程序?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { Application.Restart(); } else { Application.Exit(); } } }
/// <summary> /// 保存为新模版 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonSaveNew_Click(object sender, EventArgs e) { if (this.CheckIntegrity() == false) { return; } Templete temp = new Templete(); SignatureTemplate signtemp1 = new SignatureTemplate(); SignatureTemplate signtemp2 = new SignatureTemplate(); SignatureTemplate signtemp3 = new SignatureTemplate(); SignatureTemplate signtemp4 = new SignatureTemplate(); SignatureTemplate signtemp5 = new SignatureTemplate(); SignatureTemplate signtemp6 = new SignatureTemplate(); SignatureTemplate signtemp7 = new SignatureTemplate(); SignatureTemplate signtemp8 = new SignatureTemplate(); List<string> list = new List<string>(); List<SignatureTemplate> tlist = new List<SignatureTemplate>(); temp.Name = this.ConTempName.Text.ToString(); list.Add(this.Column1.Text.ToString()); list.Add(this.Column2.Text.ToString()); list.Add(this.Column3.Text.ToString()); list.Add(this.Column4.Text.ToString()); list.Add(this.Column5.Text.ToString()); temp.ColumnNames = list; signtemp1.SignInfo = this.Sign1.Text.ToString(); Employee emp1 = new Employee(); emp1.Name = this.SignPer1.SelectedText; emp1.Id = Convert.ToInt32(this.SignPer1.SelectedValue.ToString()); Department dep1 = new Department(); dep1.Id = Convert.ToInt32(this.SignDep1.SelectedValue.ToString()); dep1.Name = this.SignDep1.SelectedText; emp1.Department = dep1; signtemp1.SignEmployee = emp1; signtemp1.SignLevel = Convert.ToInt32(this.Sign1Level.SelectedItem.ToString()); tlist.Add(signtemp1); signtemp2.SignInfo = this.Sign2.Text.ToString(); Employee emp2 = new Employee(); emp2.Name = this.SignPer2.SelectedText; emp2.Id = Convert.ToInt32(this.SignPer2.SelectedValue.ToString()); Department dep2 = new Department(); dep2.Id = Convert.ToInt32(this.SignDep2.SelectedValue.ToString()); dep2.Name = this.SignDep2.SelectedText; emp2.Department = dep2; signtemp2.SignEmployee = emp2; signtemp2.SignLevel = Convert.ToInt32(this.Sign2Level.SelectedItem.ToString()); tlist.Add(signtemp2); signtemp3.SignInfo = this.Sign3.Text.ToString(); Employee emp3 = new Employee(); emp3.Name = this.SignPer3.SelectedText; emp3.Id = Convert.ToInt32(this.SignPer3.SelectedValue.ToString()); Department dep3 = new Department(); dep3.Id = Convert.ToInt32(this.SignDep3.SelectedValue.ToString()); dep3.Name = this.SignDep3.SelectedText; emp3.Department = dep3; signtemp3.SignEmployee = emp3; signtemp3.SignLevel = Convert.ToInt32(this.Sign3Level.SelectedItem.ToString()); tlist.Add(signtemp3); signtemp4.SignInfo = this.Sign4.Text.ToString(); Employee emp4 = new Employee(); emp4.Name = this.SignPer4.SelectedText; emp4.Id = Convert.ToInt32(this.SignPer4.SelectedValue.ToString()); Department dep4 = new Department(); dep4.Id = Convert.ToInt32(this.SignDep4.SelectedValue.ToString()); dep4.Name = this.SignDep4.SelectedText; emp4.Department = dep4; signtemp4.SignEmployee = emp4; signtemp4.SignLevel = Convert.ToInt32(this.Sign4Level.SelectedItem.ToString()); tlist.Add(signtemp4); signtemp5.SignInfo = this.Sign5.Text.ToString(); Employee emp5 = new Employee(); emp5.Name = this.SignPer5.SelectedText; emp5.Id = Convert.ToInt32(this.SignPer5.SelectedValue.ToString()); Department dep5 = new Department(); dep5.Id = Convert.ToInt32(this.SignDep5.SelectedValue.ToString()); dep5.Name = this.SignDep5.SelectedText; emp5.Department = dep5; signtemp5.SignEmployee = emp5; signtemp5.SignLevel = Convert.ToInt32(this.Sign5Level.SelectedItem.ToString()); tlist.Add(signtemp5); signtemp6.SignInfo = this.Sign6.Text.ToString(); Employee emp6 = new Employee(); emp6.Name = this.SignPer6.SelectedText; emp6.Id = Convert.ToInt32(this.SignPer6.SelectedValue.ToString()); Department dep6 = new Department(); dep6.Id = Convert.ToInt32(this.SignDep6.SelectedValue.ToString()); dep6.Name = this.SignDep6.SelectedText; emp6.Department = dep6; signtemp6.SignEmployee = emp6; signtemp6.SignLevel = Convert.ToInt32(this.Sign6Level.SelectedItem.ToString()); tlist.Add(signtemp6); signtemp7.SignInfo = this.Sign7.Text.ToString(); Employee emp7 = new Employee(); emp7.Name = this.SignPer7.SelectedText; emp7.Id = Convert.ToInt32(this.SignPer7.SelectedValue.ToString()); Department dep7 = new Department(); dep7.Id = Convert.ToInt32(this.SignDep4.SelectedValue.ToString()); dep7.Name = this.SignDep7.SelectedText; emp7.Department = dep7; signtemp7.SignEmployee = emp7; signtemp7.SignLevel = Convert.ToInt32(this.Sign7Level.SelectedItem.ToString()); tlist.Add(signtemp7); signtemp8.SignInfo = this.Sign8.Text.ToString(); Employee emp8 = new Employee(); emp8.Name = this.SignPer8.SelectedText; emp8.Id = Convert.ToInt32(this.SignPer8.SelectedValue.ToString()); Department dep8 = new Department(); dep8.Id = Convert.ToInt32(this.SignDep8.SelectedValue.ToString()); dep8.Name = this.SignDep8.SelectedText; emp8.Department = dep8; signtemp8.SignEmployee = emp8; signtemp8.SignLevel = Convert.ToInt32(this.Sign8Level.SelectedItem.ToString()); tlist.Add(signtemp8); temp.SignDatas = tlist; string result = _sc.AddConTemplete(temp); if (result == Response.INSERT_CONTRACT_TEMPLATE_SUCCESS.ToString()) { MessageBox.Show("保存为新模板" + this.ConTempName.Text + "成功!"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("保存为新模板!"); } }
private void button1_Click(object sender, EventArgs e) //提交会签单信息 { if (this.pName.SelectedText.Trim() != "" && this.xmName.Text.Trim() != "" && this.ProjectPanel.Text.Trim() != "" && this.Column4Info.Text.Trim() != "" && this.Column5Info.Text.Trim() != "" && this.label3.Text.Trim() != "") { if (MessageBox.Show("您确定要提交所填方案吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { HDJContract hdj = new HDJContract(); hdj.Name = this.ConName.Text; hdj.SubmitEmployee = UserHelper.UserInfo; Templete temp = new Templete(); temp.TempId = UserHelper.SelectedTemp.TempId; hdj.ConTemp = temp; hdj.Id = this.IdNo.Text.Trim(); List<String> list = new List<string>(); list.Add(this.pName.SelectedValue.ToString()); list.Add(this.xmName.Text.ToString()); list.Add(this.ProjectPanel.Text.ToString()); list.Add(this.Column4Info.Text.ToString()); list.Add(this.Column5Info.Text.ToString()); hdj.ColumnDatas = list; string result = _sc.InsertHDJContract(hdj); if (result == Response.INSERT_HDJCONTRACT_SUCCESS.ToString()) { this.ConTempInfo.Visible = false; this.pName.Text = ""; this.xmName.Text = ""; this.ProjectPanel.Text = ""; this.Column4Info.Text = ""; this.Column5Info.Text = ""; this.IdNo.Text = ""; MessageBox.Show("提交成功!", "提示", MessageBoxButtons.OK); //if(hdj.ConTemp.SignDatas.Where()) // 2015-07-03 11:25 提交成功后应该刷新一下待签字结构体 this.BindPenddingList(true); // 强制刷新待审核的数据 ///////////////////////////////////////// /// 每次提交一个新的单子之后,待审核数目增加 1/// ///////////////////////////////////////// MainWindow mw = (MainWindow)this.MdiParent; foreach (TreeNode t in mw.treeView1.Nodes) { if (t.Text.Contains("提交管理(")) { int count = Convert.ToInt32(t.Text.Split('(')[1].Split(')')[0]); // 提交管理 t.Text = "提交管理(" + (count + 1) + ")"; //t.Nodes[0] -=> 提交方案 //t.Nodes[1] -=> 审核中 //t.Nodes[2] -=> 已拒绝 //t.Nodes[3] -=> 已通过 int childcount = Convert.ToInt32(t.Nodes[1].Text.Split('(')[1].Split(')')[0]); t.Nodes[1].Text = "审核中(" + (childcount + 1) + ")"; } } } else if (result == "服务器连接中断") { MessageBox.Show("服务器连接中断,提交失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (result == Response.INSERT_HDJCONTRACT_EXIST.ToString()) { MessageBox.Show("该会签单编号已经存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("提交失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { MessageBox.Show("请将所有空白处填完!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button1_Click(object sender, EventArgs e) //提交会签单信息 { if (this.pName.Text.Trim() != "" && this.xmName.Text.Trim() != "" && this.Column4Info.Text.Trim() != "" && this.Column5Info.Text.Trim() != "" && this.Column4InfoAmountInWords.Text.Trim() != "" && this.Column5InfoAmountInWords.Text.Trim() != "" && this.label3.Text.Trim() != "" && this.IdNo.Text.Trim() != "") { if (MessageBox.Show("您确定要提交所填方案吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { HDJContractWithWorkload hdj = new HDJContractWithWorkload(); hdj.Name = this.ConName.Text; hdj.SubmitEmployee = UserHelper.UserInfo; Templete temp = new Templete(); temp.TempId = UserHelper.SelectedTemp.TempId; hdj.ConTemp = temp; hdj.Id = this.IdDepartShortCall.Text.ToString() + this.IdCategory.Text.ToString() + this.IdYear.Text.ToString() + this.IdFlag.Text.ToString() + this.IdNo.Text.Trim(); string workloadStr = ""; List<ContractWorkload> worklist = new List<ContractWorkload>(); int num = (this.ProjectPanel.Controls.Count - 1) / 6; // modify by gatieme @ 2016-01-22 23:48 // 修复了无工作量集合也能提交会签单的BG... if (num <= 0) { MessageBox.Show("会签单的工作量集合为空, 无法提交!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } for (int i = 1; i <= num; i++) { ComboBox item = (ComboBox)this.ProjectPanel.Controls["Item_" + i.ToString()]; TextBox work = (TextBox)this.ProjectPanel.Controls["WorkNum_" + i.ToString()]; TextBox expense = (TextBox)this.ProjectPanel.Controls["Expense_" + i.ToString()]; ContractWorkload workload = new ContractWorkload(); workload.ContractId = hdj.Id; ContractItem it = new ContractItem(); it.ProjectId = Convert.ToInt32(this.xmName.SelectedValue); it.Id = Convert.ToInt32(item.SelectedValue); it.Item = item.Text.ToString(); workload.Item = it; if (work.Text.Trim() == "" || expense.Text.Trim() == "") { MessageBox.Show("请将工作量填写完整!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // 判断工作量中是否有重复的数据 workload.Work = Convert.ToDouble(work.Text.Trim()); workload.Expense = Convert.ToDouble(expense.Text.Trim()); workload.Id = hdj.Id + it.Id.ToString(); // modify by gatieme @ 2016-01-22 // 修复了工作量可以重复的BUG... if (worklist.Where(o => o.Item.Id == it.Id).ToList().Count > 0) { MessageBox.Show("工作量有重复的!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } worklist.Add(workload); workloadStr += workload.Item.Item + " 工作量 : " + workload.Work.ToString() + " 投资额 : " + workload.Expense.ToString() + "\r\n"; } hdj.WorkLoads = worklist; List<String> list = new List<string>(); list.Add(this.pName.Text.ToString()); // 工程名称 list.Add(this.xmName.Text.ToString()); // 项目名称 list.Add(workloadStr); string currMoney = this.Column4Info.Text.ToString() + " " + this.Column4InfoAmountInWords.Text.ToString(); string totalMoney = this.Column5Info.Text.ToString() + " " + this.Column5InfoAmountInWords.Text.ToString(); list.Add(currMoney); list.Add(totalMoney); hdj.ColumnDatas = list; string result = _sc.InsertHDJContract(hdj); if (result == Response.INSERT_HDJCONTRACT_SUCCESS.ToString()) { this.ConTempInfo.Visible = false; this.pName.Text = ""; this.xmName.Text = ""; this.Column4Info.Text = ""; this.Column5Info.Text = ""; this.IdNo.Text = ""; for (int i = 1; i <= num; i++) { ComboBox item = (ComboBox)this.ProjectPanel.Controls["Item_" + i.ToString()]; TextBox work = (TextBox)this.ProjectPanel.Controls["WorkNum_" + i.ToString()]; Label workdsc = (Label)this.ProjectPanel.Controls["WorkDsc_" + i.ToString()]; TextBox expense = (TextBox)this.ProjectPanel.Controls["Expense_" + i.ToString()]; Label expensedsc = (Label)this.ProjectPanel.Controls["ExpenseDsc_" + i.ToString()]; Button b = (Button)this.ProjectPanel.Controls["Delete_" + i.ToString()]; this.ProjectPanel.Controls.Remove(item); this.ProjectPanel.Controls.Remove(work); this.ProjectPanel.Controls.Remove(workdsc); this.ProjectPanel.Controls.Remove(expense); this.ProjectPanel.Controls.Remove(expensedsc); this.ProjectPanel.Controls.Remove(b); item.Dispose(); work.Dispose(); workdsc.Dispose(); expense.Dispose(); expensedsc.Dispose(); b.Dispose(); } this.ProjectPanel.Height = this.ProjectPanel.Height - 34 * num; MessageBox.Show("提交成功!", "提示", MessageBoxButtons.OK); //if(hdj.ConTemp.SignDatas.Where()) // 2015-07-03 11:25 提交成功后应该刷新一下待签字结构体 if (HDJContract.GetIsOnlineFromContractId(hdj.Id) == false) { MessageBox.Show("您提交了一份离线审批单子, 将直接完成签字,且无法修改!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.BindPenddingList(true); // 强制刷新待审核的数据 ///////////////////////////////////////// /// 每次提交一个新的单子之后,待审核数目增加 1/// ///////////////////////////////////////// MainWindow mw = (MainWindow)this.MdiParent; foreach (TreeNode t in mw.treeView1.Nodes) { if (t.Text.Contains("提交管理(")) { int count = Convert.ToInt32(t.Text.Split('(')[1].Split(')')[0]); // 提交管理 t.Text = "提交管理(" + (count + 1) + ")"; //t.Nodes[0] -=> 提交方案 //t.Nodes[1] -=> 审核中 //t.Nodes[2] -=> 已拒绝 //t.Nodes[3] -=> 已通过 if (t.Nodes[1].Text.Contains("审核中(")) { int childcount = Convert.ToInt32(t.Nodes[1].Text.Split('(')[1].Split(')')[0]); t.Nodes[1].Text = "审核中(" + (childcount + 1) + ")"; } } } } else if (result == "服务器连接中断") { MessageBox.Show("服务器连接中断,提交失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (result == Response.INSERT_HDJCONTRACT_EXIST.ToString()) { MessageBox.Show("该会签单编号已经存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("提交失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { MessageBox.Show("请将所有空白处填完!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }