public ReSubmitConTemp(SignSocketClient sc, HDJContractWithWorkload contract) : this() { this._sc = sc; this.Id = contract.Id; this.hdj = contract; }
private async void ReSubmitConTemp_Load(object sender, EventArgs e) { try { //HDJContractWithWorkload hdj = new HDJContractWithWorkload(); this.hdj = await _sc.GetHDJContractWithWorkload(Id); this.ConTempName.Text = hdj.Name; this.ConTempId.Text = hdj.Id; // 显示5个栏目的信息 List<string> columnlist = new List<string>(); columnlist = hdj.ConTemp.ColumnNames; this.Column1.Text = columnlist[0].ToString(); this.Column2.Text = columnlist[1].ToString(); this.Column3.Text = columnlist[2].ToString(); this.Column4.Text = columnlist[3].ToString(); this.Column5.Text = columnlist[4].ToString(); // 2015-07-01 Modify by gatieme // 显示项目的信息 List<String> columnInfo = hdj.ColumnDatas; this.Column1Info.Text = columnInfo[0].ToString(); this.Column2Info.Text = columnInfo[1].ToString(); //this.Column3Info.Text = columnInfo[2].ToString(); this.Column4Info.Text = columnInfo[3].ToString(); this.Column5Info.Text = columnInfo[4].ToString(); // 显示8个签字人的信息 this.Sign1.Text = hdj.ConTemp.SignDatas[0].SignInfo.ToString(); this.Sign2.Text = hdj.ConTemp.SignDatas[1].SignInfo.ToString(); this.Sign3.Text = hdj.ConTemp.SignDatas[2].SignInfo.ToString(); this.Sign4.Text = hdj.ConTemp.SignDatas[3].SignInfo.ToString(); this.Sign5.Text = hdj.ConTemp.SignDatas[4].SignInfo.ToString(); this.Sign6.Text = hdj.ConTemp.SignDatas[5].SignInfo.ToString(); this.Sign7.Text = hdj.ConTemp.SignDatas[6].SignInfo.ToString(); this.Sign8.Text = hdj.ConTemp.SignDatas[7].SignInfo.ToString(); this.SignPer1.Text = hdj.ConTemp.SignDatas[0].SignEmployee.Name.ToString(); this.SignPer2.Text = hdj.ConTemp.SignDatas[1].SignEmployee.Name.ToString(); this.SignPer3.Text = hdj.ConTemp.SignDatas[2].SignEmployee.Name.ToString(); this.SignPer4.Text = hdj.ConTemp.SignDatas[3].SignEmployee.Name.ToString(); this.SignPer5.Text = hdj.ConTemp.SignDatas[4].SignEmployee.Name.ToString(); this.SignPer6.Text = hdj.ConTemp.SignDatas[5].SignEmployee.Name.ToString(); this.SignPer7.Text = hdj.ConTemp.SignDatas[6].SignEmployee.Name.ToString(); this.SignPer8.Text = hdj.ConTemp.SignDatas[7].SignEmployee.Name.ToString(); // ==Happy!!!== // 根据工程名称和项目名称获取子类集合 // modify by gatieme @ 2016-01-23 // 修复了修重新提交会签单时, 工作量集合显示不出来的问题 // 修复BUG历程说明, 老八你这代码写的没谁了, 你这神奇的命名方式我就不说拉 // 但是我QueryContractItemByName根据项目和工程名称来获取会签单工作量集合的皆苦 // 愣是让你写成了获取projectId的接口 // 我和我的小伙伴都惊呆了 //this.BindContractItem(true); //修改代码如下 //string categoryName = columnInfo[0].ToString(); //string projectname = columnInfo[1].ToString(); //Search search = new Search //{ // CategoryName = categoryName, // ProjectName = projectname, //}; //List<ContractItem> list = _sc.QueryContractItemByName(search); // BUG代码如下 //int projectid = _sc.QueryContractItemByName(search); //List<ContractItem> list = new List<ContractItem>(); //list = _sc.QueryContractItem(projectid); //UserHelper.ContractItemList = list; // 显示工作量和投资额 int n = hdj.WorkLoads.Count; for (int pos = 0; pos < n; pos++) { int num = pos;//(this.ProjectPanel.Controls.Count - 1) / 6; this.BindContractItem(true); ComboBox cmb = new ComboBox(); cmb.Size = new Size(120, 29); cmb.Location = new Point(3, 10 + 34 * pos); cmb.Name = "Item_" + (pos + 1).ToString(); cmb.ValueMember = "Id"; cmb.DisplayMember = "Item"; //cmb.DropDownStyle = ComboBoxStyle.DropDownList; // 设置combobox只能通过下拉选取,不能输入 cmb.Enabled = false; // 设置combobox为只读 // BUG,添加数据源之后SelectedText--SelectedValue等无法初始化 // 感觉是控件自己的问题 //cmb.DataSource = UserHelper.ContractItemList; // 添加了上一行代码后绑定了数据源, 使得后面的代码完全不起作用 // Text--SelectedText--SelectedValue等无法通过正常方式赋值 //cmb.Text = hdj.WorkLoads[pos].Item.Item.ToString(); cmb.SelectedText = hdj.WorkLoads[pos].Item.Item.ToString(); //cmb.SelectedIndexChanged += new System.EventHandler(this.cmb_SelectedIndexChanged); //用于绑定工作量和投资额 //cmb.SelectedValue = hdj.WorkLoads[pos].Item.Id; //cmb.SelectedIndex = 1; this.ProjectPanel.Controls.Add(cmb); // 调试用弹窗 //MessageBox.Show(cmb.Name + cmb.SelectedValue + hdj.WorkLoads[pos].Item.Id.ToString() + cmb.Text + hdj.WorkLoads[pos].Item.Item.ToString()); //MessageBox.Show(cmb.Name + ", " + cmb.SelectedValue + hdj.WorkLoads[pos].Item.Id.ToString()); Label l = new Label(); l.Size = new Size(70, 29); l.Location = new Point(130, 10 + 34 * pos); l.Text = "工作量:"; l.Name = "WorkDsc_" + (pos + 1).ToString(); this.ProjectPanel.Controls.Add(l); TextBox t = new TextBox(); t.Size = new Size(60, 29); t.Location = new Point(202, 10 + 34 * pos); t.Name = "WorkNum_" + (pos + 1).ToString(); t.Text = hdj.WorkLoads[pos].Work.ToString(); this.ProjectPanel.Controls.Add(t); Label l1 = new Label(); l1.Size = new Size(70, 29); l1.Location = new Point(269, 10 + 34 * pos); l1.Text = "投资额:"; l1.Name = "ExpenseDsc_" + (pos + 1).ToString(); this.ProjectPanel.Controls.Add(l1); TextBox t1 = new TextBox(); t1.Size = new Size(60, 29); t1.Location = new Point(341, 10 + 34 * pos); t1.Name = "Expense_" + (pos + 1).ToString(); t1.Text = hdj.WorkLoads[pos].Expense.ToString(); this.ProjectPanel.Controls.Add(t1); Button b = new Button(); b.Size = new Size(60, 29); b.Location = new Point(411, 10 + 34 * pos); b.Name = "Delete_" + (pos + 1).ToString(); b.Text = "删除"; b.Click += new EventHandler(b_Click); this.ProjectPanel.Controls.Add(b); this.ProjectPanel.Height = this.ProjectPanel.Height + 34; } } catch { MessageBox.Show("加载数据失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); 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.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); } }
private async void SignConTemp_Load(object sender, EventArgs e) { //cmd.ShowOpaqueLayer(this, 125, true); bool canview = false; try { //this.MinimizeBox = false; //this.MaximizeBox = false; if (_type == 1) { this.RemarkList.Visible = true; this.RemarkList.Height = 140; canview = true; } if (_type == 2) { this.RemarkList.Visible = true; this.RemarkList.Height = 140; canview = true; } if (_type == 3) { this.RemarkList.Visible = true; this.RemarkList.Height = 140; canview = true; } if (_type == 4) { this.Reason.Visible = true; this.AgreeConTemp.Visible = true; this.RefuseConTemp.Visible = true; } if (_type == 5) { } HDJContractWithWorkload hdj = new HDJContractWithWorkload(); hdj = await _sc.GetHDJContractWithWorkload(Id); this.ConTempName.Text = hdj.Name; this.ConTempId.Text = hdj.Id; List<string> columnlist = new List<string>(); columnlist = hdj.ConTemp.ColumnNames; this.Column1.Text = columnlist[0].ToString(); this.Column2.Text = columnlist[1].ToString(); this.Column3.Text = columnlist[2].ToString(); this.Column4.Text = columnlist[3].ToString(); this.Column5.Text = columnlist[4].ToString(); this.Sign1.Text = hdj.ConTemp.SignDatas[0].SignInfo.ToString(); this.Sign2.Text = hdj.ConTemp.SignDatas[1].SignInfo.ToString(); this.Sign3.Text = hdj.ConTemp.SignDatas[2].SignInfo.ToString(); this.Sign4.Text = hdj.ConTemp.SignDatas[3].SignInfo.ToString(); this.Sign5.Text = hdj.ConTemp.SignDatas[4].SignInfo.ToString(); this.Sign6.Text = hdj.ConTemp.SignDatas[5].SignInfo.ToString(); this.Sign7.Text = hdj.ConTemp.SignDatas[6].SignInfo.ToString(); this.Sign8.Text = hdj.ConTemp.SignDatas[7].SignInfo.ToString(); this.Column1Info.Text = hdj.ColumnDatas[0].ToString(); this.Column2Info.Text = hdj.ColumnDatas[1].ToString(); //this.panel4.Height = 100; //this.Column3Info.Text = "1 13\r\n2\r\n3\r\n4"; this.Column4Info.Text = hdj.ColumnDatas[3].ToString(); this.Column5Info.Text = hdj.ColumnDatas[4].ToString(); int num = hdj.WorkLoads.Count; string str = ""; for (int i = 0; i < num; i++) { str = str + hdj.WorkLoads[i].Item.Item.ToString() + " 工作量:" + hdj.WorkLoads[i].Work.ToString() + " 投资额:" + hdj.WorkLoads[i].Expense.ToString() + "\r\n"; } this.panel4.Height = 40 * num; this.Column3Info.Text = str; for (int s = 0; s < hdj.ConTemp.SignDatas.Count; s++) { if (hdj.ConTemp.SignDatas[s].SignEmployee.Name == UserHelper.UserInfo.Name) { if (hdj.ConTemp.SignDatas[s].CanView == 1) { canview = true; } } } if (canview) { string result1 = hdj.SignResults[0] == 1 ? "(同意)" : (hdj.SignResults[0] == 0 ? "(未处理)" : "(拒绝)"); string result2 = hdj.SignResults[1] == 1 ? "(同意)" : (hdj.SignResults[1] == 0 ? "(未处理)" : "(拒绝)"); string result3 = hdj.SignResults[2] == 1 ? "(同意)" : (hdj.SignResults[2] == 0 ? "(未处理)" : "(拒绝)"); string result4 = hdj.SignResults[3] == 1 ? "(同意)" : (hdj.SignResults[3] == 0 ? "(未处理)" : "(拒绝)"); string result5 = hdj.SignResults[4] == 1 ? "(同意)" : (hdj.SignResults[4] == 0 ? "(未处理)" : "(拒绝)"); string result6 = hdj.SignResults[5] == 1 ? "(同意)" : (hdj.SignResults[5] == 0 ? "(未处理)" : "(拒绝)"); string result7 = hdj.SignResults[6] == 1 ? "(同意)" : (hdj.SignResults[6] == 0 ? "(未处理)" : "(拒绝)"); string result8 = hdj.SignResults[7] == 1 ? "(同意)" : (hdj.SignResults[7] == 0 ? "(未处理)" : "(拒绝)"); this.SignPer1.Text = hdj.ConTemp.SignDatas[0].SignEmployee.Name.ToString() + result1; this.SignPer2.Text = hdj.ConTemp.SignDatas[1].SignEmployee.Name.ToString() + result2; this.SignPer3.Text = hdj.ConTemp.SignDatas[2].SignEmployee.Name.ToString() + result3; this.SignPer4.Text = hdj.ConTemp.SignDatas[3].SignEmployee.Name.ToString() + result4; this.SignPer5.Text = hdj.ConTemp.SignDatas[4].SignEmployee.Name.ToString() + result5; this.SignPer6.Text = hdj.ConTemp.SignDatas[5].SignEmployee.Name.ToString() + result6; this.SignPer7.Text = hdj.ConTemp.SignDatas[6].SignEmployee.Name.ToString() + result7; this.SignPer8.Text = hdj.ConTemp.SignDatas[7].SignEmployee.Name.ToString() + result8; this.RemarkList.Visible = true; } else { this.SignPer1.Text = hdj.ConTemp.SignDatas[0].SignEmployee.Name.ToString(); this.SignPer2.Text = hdj.ConTemp.SignDatas[1].SignEmployee.Name.ToString(); this.SignPer3.Text = hdj.ConTemp.SignDatas[2].SignEmployee.Name.ToString(); this.SignPer4.Text = hdj.ConTemp.SignDatas[3].SignEmployee.Name.ToString(); this.SignPer5.Text = hdj.ConTemp.SignDatas[4].SignEmployee.Name.ToString(); this.SignPer6.Text = hdj.ConTemp.SignDatas[5].SignEmployee.Name.ToString(); this.SignPer7.Text = hdj.ConTemp.SignDatas[6].SignEmployee.Name.ToString(); this.SignPer8.Text = hdj.ConTemp.SignDatas[7].SignEmployee.Name.ToString(); this.RemarkList.Visible = false; this.Reason.Location = new Point(35, 524); this.AgreeConTemp.Location = new Point(314, 604); this.RefuseConTemp.Location = new Point(567, 604); this.Height = 710; } this.RemarkList.Items.Add("备注信息:"); if (hdj.SignRemarks != null) { for (int i = 0; i < hdj.SignRemarks.Count; i++) { if ((hdj.SignRemarks[i]) != "") { this.RemarkList.Items.Add(" " + hdj.ConTemp.SignDatas[i].SignEmployee.Name.ToString() + ":" + hdj.SignRemarks[i].ToString()); } } } if (this.RemarkList.Items.Count == 1) { this.RemarkList.Visible = false; this.Reason.Location = new Point(35,524); this.AgreeConTemp.Location = new Point(314, 604); this.RefuseConTemp.Location = new Point(567, 604); this.Height = 710; } //cmd.HideOpaqueLayer(); } catch { MessageBox.Show("加载数据失败!"); Logging.AddLog("查看签单详细信息失败!"); if (MessageBox.Show("好吧,我们的程序出现点问题需要重新启动\n点击\"确定\"重启\n点击\"取消\"退出程序?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { Application.Restart(); } else { Application.Exit(); } } }
public Task<HDJContractWithWorkload> GetHDJContractWithWorkload(string Id) { return Task.Factory.StartNew(() => { try { SocketMessage sm = new SocketMessage(Request.GET_HDJCONTRACT_WITH_WORKLOAD_REQUEST, Id); ClientSocket.Send(Encoding.UTF8.GetBytes(sm.Package)); string recMsg = null; lock (recivebuffer) { recLength = ClientSocket.Receive(recivebuffer); recMsg = Encoding.UTF8.GetString(recivebuffer, 0, recLength); } string[] Msg = recMsg.Split(SocketMessage.DEFAULT_SEPARATOR); if (Msg[0] == Response.GET_HDJCONTRACT_WITH_WORKLOAD_SUCCESS.ToString()) { HDJContractWithWorkload list = new HDJContractWithWorkload(); list = JsonConvert.DeserializeObject<HDJContractWithWorkload>(Msg[2]); return list; } else { Logging.AddLog("查询会签单信息失败!"); return null; } } catch { Logging.AddLog("查询会签单信息失败(服务器连接中断)!"); return null; } }); }