Esempio n. 1
0
 private void editNum()
 {
     try
     {
         int selectIndex = this.dgvNum.GetSelectedRows()[0];
         EditNumForm enf = new EditNumForm(this.country, this.dgvNum.GetRowCellValue(selectIndex, "ContractNum").ToString());
         enf.Text = "编辑寄出个数";
         if (enf.ShowDialog() == DialogResult.OK)
         {
             if (this.fileList.SelectedIndex == 0)
             {
                 Controller.MainWin.MotivationData.Instanse.HandleNum.UKDetails[this.dgvNum.GetRowCellValue(selectIndex, "ContractNum").ToString()] = enf.HandleNumDetail as Model.DTO.UKHandleNumDetail;
                 this.bindNum(Controller.MainWin.MotivationData.Instanse.HandleNum.UKDetails);
             }
             else
             {
                 Controller.MainWin.MotivationData.Instanse.HandleNum.HKDetails[this.dgvNum.GetRowCellValue(selectIndex, "ContractNum").ToString()] = enf.HandleNumDetail as Model.DTO.HKHandleNumDetail;
                 this.bindNum(Controller.MainWin.MotivationData.Instanse.HandleNum.HKDetails);
             }
             this.newVersion = Guid.NewGuid();
             this.dgvNum.FocusedRowHandle = selectIndex;
         }
         this.setAuth();
     }
     catch (Exception ex)
     {
         Controller.MainWin.MotivationData.Instanse.Save(Model.Path.AutoSaveFileName);
         MessageConsole.WriteConsole("编辑个数出现异常:" + ex.Message + "\r\n" + ex.StackTrace);
     }
 }
Esempio n. 2
0
        private void addNum()
        {
            try
            {
                EditNumForm ihnf = new EditNumForm(this.country);
                ihnf.HandleNumDetail = new Model.DTO.UKHandleNumDetail();
                DialogResult dr = ihnf.ShowDialog();
                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    if (ihnf.HandleNumDetail != null)
                    {
                        if (ihnf.HandleNumDetail is Model.DTO.UKHandleNumDetail)//英国
                        {
                            Model.DTO.UKHandleNumDetail ukHandleNumDetail = ihnf.HandleNumDetail as Model.DTO.UKHandleNumDetail;
                            //添加到数据字典中
                            Controller.MainWin.MotivationData.Instanse.HandleNum.UKDetails.Add(ukHandleNumDetail.ContractNum, ukHandleNumDetail);
                            //将数据库合同对应的个数修改为已报
                            Controller.SQLiteController.BizContract.UpdateSubmitNum(ukHandleNumDetail.ContractNum);
                            this.bindNum(Controller.MainWin.MotivationData.Instanse.HandleNum.UKDetails);
                        }
                        else if (ihnf.HandleNumDetail is Model.DTO.HKHandleNumDetail)//香港
                        {
                            Model.DTO.HKHandleNumDetail hkHandleNumDetail = ihnf.HandleNumDetail as Model.DTO.HKHandleNumDetail;
                            //添加到数据字典中
                            Controller.MainWin.MotivationData.Instanse.HandleNum.HKDetails.Add(hkHandleNumDetail.ContractNum, hkHandleNumDetail);
                            //将数据库合同对应的个数修改为已报
                            Controller.SQLiteController.BizContract.UpdateSubmitNum(hkHandleNumDetail.ContractNum);
                            this.bindNum(Controller.MainWin.MotivationData.Instanse.HandleNum.HKDetails);

                        }
                        //添加完成后默认选中该行
                        this.dgvNum.FocusedRowHandle = this.dgvNum.RowCount - 1;

                        this.newVersion = Guid.NewGuid();
                    }
                }
                this.setAuth();
            }
            catch (Exception ex)
            {
                Controller.MainWin.MotivationData.Instanse.Save(Model.Path.AutoSaveFileName);
                MessageConsole.WriteConsole("新增个数出现异常:" + ex.Message + "\r\n" + ex.StackTrace);
            }
        }