Exemplo n.º 1
0
        // 已办列表的单击事件
        private async void DoneListView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (e.ColumnIndex == 1)
            {
                string id = this.DoneListView.Rows[e.RowIndex].Cells[0].Value.ToString();
                //这里也要区分模版类型
                string type = id[1].ToString() + id[2].ToString();
                if (type == "内例" || type == "内专")
                {
                    //显示内河的模版
                    SignConTempInside sct = new SignConTempInside(_sc, id, 5);
                    sct.ShowDialog();
                }

                if (type == "界例")
                {
                    //显示界河例行的模版
                    SignConTempJHLX sct = new SignConTempJHLX(_sc, id, 5);
                    sct.ShowDialog();
                }

                if (type == "界专")
                {
                    SignConTemp sct = new SignConTemp(_sc, id, 5);
                    sct.ShowDialog();
                }
            }

            //下载
            if (e.ColumnIndex == 8)
            {
                //获取会签单编号
                string Id = this.DoneListView.Rows[e.RowIndex].Cells[0].Value.ToString();
                if (HDJContract.GetIsOnlineFromContractId(Id) == false)
                {
                    MessageBox.Show(@"该会签单是离线审批的会签单, 无法通过本系统进行下载", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                MessageBox.Show(@"温馨提示
如果您是首次下载附件,系统将为您生成会签单文件,这个过程比较费时间,希望您能耐心等待!
生成过程中我们会在磁盘上为您生成缓存文件,打开缓存可能会导致文件损毁!
为防止用户误操作造成的损毁,我们已经为您做了备份。
如果下载完成后提示您文件损坏无法打开,您只需要点击重新下载即可,系统会立即调用缓存为您重新生成(这个速度是很快的)
由此给您带来的不便,我们表示真诚的歉意", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                SaveFileDialog sfd = new SaveFileDialog();
                sfd.FileName = this.DoneListView.Rows[e.RowIndex].Cells[0].Value.ToString();
                sfd.Filter   = "*.pdf | *.*";
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    MainWindow mw = (MainWindow)this.MdiParent;
                    cmd.ShowOpaqueLayer(this.groupBox2, 125, true, true, "正在下载中,请稍候");
                    mw.treeView1.Enabled = false;

                    string filepath = sfd.FileName.ToString() + ".pdf";
                    //下载会签单
                    await _sc.DownloadHDJContract(Id, filepath);

                    //if(cmd.)
                    //{
                    cmd.HideOpaqueLayer();
                    //}
                    MessageBox.Show("下载完成!");

                    mw.treeView1.Enabled = true;
                }
            }
        }
Exemplo n.º 2
0
        //提交按钮
        private void btn_Submit_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.ConTempName.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());

                        //一个会签单多个item的话就通过最后以为判别   如:省界专2016001(1、2、3)  就是这单有3项item
                        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;

                    //将编号 和 栏目1-5的数据 存入数据库hdjcontract表中
                    string result = _sc.InsertHDJContract(hdj);
                    //成功就清空
                    if (result == Response.INSERT_HDJCONTRACT_SUCCESS.ToString())
                    {
                        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);


                        // 2015-07-03 11:25  提交成功后应该刷新一下待签字结构体
                        if (HDJContract.GetIsOnlineFromContractId(hdj.Id) == false)
                        {
                            MessageBox.Show("您提交了一份离线审批单子, 将直接完成签字,且无法修改!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                        //返回ok进行刷新
                        this.DialogResult = DialogResult.OK;
                    }
                    //提交失败
                    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);
            }
        }