コード例 #1
0
        public override void Save()
        {
            decimal temp = 0;

            FishEntity.TheproblemsheetEntity _The = new FishEntity.TheproblemsheetEntity();
            _The.Code       = FishBll.Bll.SequenceUtil.GetTheproblemsheet();
            _The.ContractNo = txtContractNo.Text;
            decimal.TryParse(txtChargeback.Text, out temp);
            _The.Chargeback      = temp;
            _The.OccurDate       = dtpoccurDate.Value;
            _The.EventName       = txtEventName.Text;
            _The.SolvTtheProblem = txtSolvTtheProblem.Text;
            _The.Remarks         = txtRemarks.Text;
            _The.Createtime      = DateTime.Now;
            _The.Createman       = FishEntity.Variable.User.username;
            _The.Modifytime      = DateTime.Now;
            _The.Modifyman       = _The.Createman;
            _The.codeContract    = txtCodeOdd.Text;
            _The.Numbering       = txtNumbering.Text;
            FishBll.Bll.TheproblemsheetBll bll = new FishBll.Bll.TheproblemsheetBll();
            bool isok = bll.Exists(_The.Code);

            while (isok)
            {
                _The.Code = FishBll.Bll.SequenceUtil.GetTheproblemsheet();
                isok      = bll.Exists(_The.Code);
            }
            int id = bll.Add(_The);

            if (id > 0)
            {
                _The.Id = id;
                if (txtNumbering.Text != "")
                {
                    _Refreshbll = new FishBll.Bll.ProcessStateBll();
                    _Refreshbll.GetFormTheproblemsheet(txtNumbering.Text);
                }
                tmiQuery.Visible  = false;
                tmiDelete.Visible = false;
                tmiModify.Visible = false;
                tmiSave.Visible   = false;
                tmiAdd.Visible    = false;
                tmiCancel.Visible = true;
                MessageBox.Show("添加成功。");
                txtcode.Text = _The.Code;
            }
            else
            {
                txtcode.Text = _The.Code;
                MessageBox.Show("添加失败。");
            }
        }
コード例 #2
0
        public override int Modify()
        {
            FishBll.Bll.TheproblemsheetBll bll = new FishBll.Bll.TheproblemsheetBll();
            _fish.ContractNo = txtContractNo.Text;//新增后修改bug
            decimal temp = 0;

            decimal.TryParse(txtChargeback.Text, out temp);
            _fish.Chargeback      = temp;
            _fish.OccurDate       = dtpoccurDate.Value;
            _fish.EventName       = txtEventName.Text;
            _fish.SolvTtheProblem = txtSolvTtheProblem.Text;
            _fish.Remarks         = txtRemarks.Text;
            _fish.FishMealId      = txtFishMealId.Text;
            _fish.Modifytime      = DateTime.Now;
            _fish.Modifyman       = FishEntity.Variable.User.username;
            _fish.codeContract    = txtCodeOdd.Text;
            if (bll.ExistsUpdate(_fish.Code, FishEntity.Variable.User.username) == false)
            {
                MessageBox.Show("不是所属人无法操作!");
                return(0);
            }
            _Refreshbll = new FishBll.Bll.ProcessStateBll();
            if (_Refreshbll.ExistsNumbering(txtNumbering.Text, "wtfkExBool") == true)
            {
                MessageBox.Show("已审核无法操作!");
                return(0);
            }
            bool isok = bll.Update(_fish, this.Name);

            if (isok)
            {
                //if (txtNumbering.Text != "")
                //{
                //    _Refreshbll = new FishBll.Bll.ProcessStateBll();
                //    _Refreshbll.GetFormTheproblemsheet(txtNumbering.Text);
                //}
                MessageBox.Show("修改成功。");
            }
            else
            {
                MessageBox.Show("修改失败。");
            }
            return(1);
        }