Ejemplo n.º 1
0
        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();
            SignatureTemplate        signtemp9  = new SignatureTemplate();
            SignatureTemplate        signtemp10 = new SignatureTemplate();
            SignatureTemplate        signtemp11 = new SignatureTemplate();
            SignatureTemplate        signtemp12 = 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);

            signtemp9.SignInfo = this.Sign9.Text.ToString();
            Employee emp9 = new Employee();

            emp9.Name = this.SignPer9.SelectedText;
            emp9.Id   = Convert.ToInt32(this.SignPer9.SelectedValue.ToString());
            Department dep9 = new Department();

            dep9.Id                = Convert.ToInt32(this.SignDep9.SelectedValue.ToString());
            dep9.Name              = this.SignDep9.SelectedText;
            emp9.Department        = dep9;
            signtemp9.SignEmployee = emp9;
            signtemp9.SignLevel    = Convert.ToInt32(this.Sign9Level.SelectedItem.ToString());
            signtemp9.CanView      = this.View9.SelectedIndex;
            signtemp9.CanDownload  = this.Download9.SelectedIndex;
            tlist.Add(signtemp9);

            signtemp10.SignInfo = this.Sign10.Text.ToString();
            Employee emp10 = new Employee();

            emp10.Name = this.SignPer10.SelectedText;
            emp10.Id   = Convert.ToInt32(this.SignPer10.SelectedValue.ToString());
            Department dep10 = new Department();

            dep10.Id                = Convert.ToInt32(this.SignDep10.SelectedValue.ToString());
            dep10.Name              = this.SignDep10.SelectedText;
            emp10.Department        = dep10;
            signtemp10.SignEmployee = emp10;
            signtemp10.SignLevel    = Convert.ToInt32(this.Sign10Level.SelectedItem.ToString());
            signtemp10.CanView      = this.View10.SelectedIndex;
            signtemp10.CanDownload  = this.Download10.SelectedIndex;
            tlist.Add(signtemp10);

            signtemp11.SignInfo = this.Sign11.Text.ToString();
            Employee emp11 = new Employee();

            emp11.Name = this.SignPer11.SelectedText;
            emp11.Id   = Convert.ToInt32(this.SignPer11.SelectedValue.ToString());
            Department dep11 = new Department();

            dep11.Id                = Convert.ToInt32(this.SignDep11.SelectedValue.ToString());
            dep11.Name              = this.SignDep11.SelectedText;
            emp11.Department        = dep11;
            signtemp11.SignEmployee = emp11;
            signtemp11.SignLevel    = Convert.ToInt32(this.Sign11Level.SelectedItem.ToString());
            signtemp11.CanView      = this.View11.SelectedIndex;
            signtemp11.CanDownload  = this.Download11.SelectedIndex;
            tlist.Add(signtemp11);

            signtemp12.SignInfo = this.Sign12.Text.ToString();
            Employee emp12 = new Employee();

            emp12.Name = this.SignPer12.SelectedText;
            emp12.Id   = Convert.ToInt32(this.SignPer12.SelectedValue.ToString());
            Department dep12 = new Department();

            dep12.Id                = Convert.ToInt32(this.SignDep12.SelectedValue.ToString());
            dep12.Name              = this.SignDep12.SelectedText;
            emp12.Department        = dep12;
            signtemp12.SignEmployee = emp12;
            signtemp12.SignLevel    = Convert.ToInt32(this.Sign12Level.SelectedItem.ToString());
            signtemp12.CanView      = this.View12.SelectedIndex;
            signtemp12.CanDownload  = this.Download12.SelectedIndex;
            tlist.Add(signtemp12);

            temp.Type      = 21;
            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);
            }
            this.Close();
        }
Ejemplo n.º 2
0
        // 重新提交按钮单机以后,应该进行一次刷新
        // modify by gatieme 2015-07-02 9:47 修改提交方案wield异步
        private void button1_Click(object sender, EventArgs e)
        {
            //if (this.Column1Info.Text.Trim() != "" && this.Column2Info.Text.Trim() != "" &&
            //    this.ProjectPanel.Text.Trim() != "" && this.Column4Info.Text.Trim() != "" && this.Column5Info.Text.Trim() != "")
            if (this.Column1Info.Text.Trim() != "" && this.Column2Info.Text.Trim() != "" &&
                this.Column4Info.Text.Trim() != "" && this.Column5Info.Text.Trim() != "")
            {
                if (MessageBox.Show("您确定要提交所填方案吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    //HDJContractWithWorkload hdj = new HDJContractWithWorkload();
                    hdj.Id = this.ConTempId.Text;



                    string workloadStr = "";
                    //List<ContractWorkload> worklist = new List<ContractWorkload>();
                    int num = (this.ProjectPanel.Controls.Count - 1) / 6;
                    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()];

                        //  modify by gatieme for @ 2016-01-24 14:47
                        //  修改了重新提交时, 由于原来会签单中workload工作量的SelectedValue无法赋值,
                        //  导致重新提交会签单后, 工作量集合没有修改的BUG
                        /// BUG...
                        if (i <= hdj.WorkLoads.Count)           //  这些工作量是原来会签单中已经有的, 只需要修改其工作量的大小和金额即可
                        {
                            hdj.WorkLoads[i - 1].Work    = Convert.ToDouble(work.Text.Trim());
                            hdj.WorkLoads[i - 1].Expense = Convert.ToDouble(expense.Text.Trim());
                            workloadStr += hdj.WorkLoads[i - 1].Item.Item + "   工作量 : " + hdj.WorkLoads[i - 1].Work.ToString() + "   投资额 : " + hdj.WorkLoads[i - 1].Expense.ToString() + "\r\n";
                        }
                        else
                        {
                            ContractWorkload workload = new ContractWorkload();
                            workload.ContractId = hdj.Id;
                            ContractItem it = new ContractItem();
                            it.ProjectId  = projectid;
                            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();

                            workloadStr += workload.Item.Item + "   工作量 : " + workload.Work.ToString() + "   投资额 : " + workload.Expense.ToString() + "\r\n";
                            hdj.WorkLoads.Add(workload);
                        }


                        //worklist.Add(workload);
                    }
                    //hdj.WorkLoads = worklist;

                    List <String> list = new List <string>();
                    list.Add(this.Column1Info.Text.ToString());
                    list.Add(this.Column2Info.Text.ToString());
                    list.Add(workloadStr);
                    list.Add(this.Column4Info.Text.ToString());
                    list.Add(this.Column5Info.Text.ToString());
                    hdj.ColumnDatas = list;


                    string result = _sc.ModifyContractTemplate(hdj);
                    if (result == Response.MODIFY_HDJCONTRACT_SUCCESS.ToString())
                    {
                        MessageBox.Show("提交成功!", "提示", MessageBoxButtons.OK);

                        //  2015-07-01 14:58 modify by gatieme
                        //  重新提交后,应该设置OK
                        //this.DialogResult = DialogResult.OK;
                        //this.Close();         // 不能关闭,否则会异常
                    }
                    else if (result == "服务器连接中断")
                    {
                        MessageBox.Show("服务器连接中断,提交失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show("提交失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }