示例#1
0
        //保存
        public override void Save( )
        {
            _model    = new FishEntity.PresaleRequisitionHeadEntity( );
            _modelOne = new FishEntity.PresaleRequisitionBodyEntity( );

            if (GetPresaleRequisition( ) == false)
            {
                return;
            }
            _model.createman  = FishEntity.Variable.User.username;
            _model.createtime = _bll.getDate( );
            _model.modifyman  = _model.createman;
            _model.modifytime = _model.createtime;

            List <FishEntity.PresaleRequisitionBodyEntity> modelList = new List <FishEntity.PresaleRequisitionBodyEntity> ( );

            DataViewOne(modelList);

            _bll = new FishBll.Bll.PresaleRequisitionBll( );

            if (state == "add")
            {
                result = _bll.Add(_model, modelList);
            }
            else if (state == "edit")
            {
                result = _bll.Edit(_model, modelList);
            }

            if (result == true)
            {
                MessageBox.Show("保存成功");

                tmiSave.Visible   = false;
                tmiCancel.Visible = false;
                tmiAdd.Visible    = true;
                tmiModify.Visible = true;
                tmiQuery.Visible  = true;
                tmiDelete.Visible = true;
                tmiClose.Visible  = true;
                tmiReview.Visible = true;

                //panel2 . Enabled = false;
            }
            else
            {
                MessageBox.Show("保存失败,请重试");
            }

            base.Save( );
        }
示例#2
0
        //生成合同号
        protected void codeNum( )
        {
            _model = new FishEntity.PresaleRequisitionHeadEntity( );
            _bll   = new FishBll.Bll.PresaleRequisitionBll( );
            DateTime dt = _bll.getDate( );

            _model.code = _bll.codeNum( );
            if (_model.code == string.Empty)
            {
                _model.code = "ZD" + dt.ToString("MMdd") + "0001";
            }
            else
            {
                if (_model.code.Substring(2, 4) == dt.ToString("MMdd"))
                {
                    _model.code = "ZD" + (Convert.ToInt64(_model.code.Substring(2, 8)) + 1).ToString( ).PadLeft(8, '0');
                }
                else
                {
                    _model.code = "ZD" + dt.ToString("MMdd") + "0001";
                }
            }
            txtcode.Text = _model.code;
        }