Esempio n. 1
0
        public EditItem(String categoryName, String projectName, ContractItem item, SignSocketClient sc)
            : this()
        {
            this.m_categoryName = categoryName;
            this.m_projectName = projectName;

            this.m_item = item;

            _sc = sc;
        }
Esempio 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);
                    }
                }
            }
        }
Esempio n. 3
0
        private void AddItem_Click(object sender, EventArgs e)
        {
            if (this.SelectedProject.SelectedValue == null)
            {
                MessageBox.Show("请将信息填写完整!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string itemname = this.ItemName.Text;
            int projectid = Convert.ToInt32(this.SelectedProject.SelectedValue);

            if (this.ItemName.Text == "")
            {
                MessageBox.Show("请填写工作量名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            ContractItem item = new ContractItem
            {
                ProjectId = projectid,
                Item = itemname
            };

            string result = _sc.InsertItem(item);

            if (result == Response.INSERT_ITEM_SUCCESS.ToString())
            {
                MessageBox.Show("添加工作量" + itemname + "成功!");

                ///////
                BindItem(true);
                ///////
            }
            else
            {
                MessageBox.Show("添加工作量" + itemname + "失败!");
            }
        }
Esempio n. 4
0
        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);
            }
        }
        public string ModifyItem(ContractItem item)
        {
            try
            {
                SocketMessage sm = new SocketMessage(Request.MODIFY_ITEM_REQUEST, item);
                //scoket发送请求信息
                ClientSocket.Send(Encoding.UTF8.GetBytes(sm.Package));

                //scoket接收请求信息
                recLength = ClientSocket.Receive(recivebuffer);
                string recMsg = Encoding.UTF8.GetString(recivebuffer, 0, recLength);
                string[] Msg = recMsg.Split(SocketMessage.DEFAULT_SEPARATOR);

                if (Msg[0] == Response.MODIFY_ITEM_SUCCESS.ToString())
                {
                    Logging.AddLog("修改工作量" + item.Item + "成功!");
                }
                else
                {
                    Logging.AddLog("修改工作量" + item.Item + "失败!");
                }
                return Msg[0];
            }
            catch
            {
                Logging.AddLog("添加工作量失败(服务器连接中断)!");
                return "添加失败";
            }
        }