Ejemplo n.º 1
0
        //保存按钮
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtGYSMC.Text.strReplace().IsNullOrEmpty())
            {
                ComForm.DspMsg("W002", "供应商名称");
                txtGYSMC.Focus();
                return;
            }

            if (DBHelper.Exists(TableName, "and GYSMC='" + txtGYSMC.Text.strReplace() + "'"))
            {
                ComForm.DspMsg("W068", "供应商名称");
                txtGYSMC.Focus();
                return;
            }
            if (ComConst.LING == ComForm.DspMsg("Q004", ""))
            {
                try
                {
                    Model.fmd030 _modelFMD030 = new Model.fmd030();
                    _modelFMD030.ID      = iID;
                    _modelFMD030.GYSMC   = txtGYSMC.Text.strReplace();
                    _modelFMD030.GYSSLMC = txtGYSSLMC.Text.strReplace();
                    _modelFMD030.DZ      = txtDZ.Text.strReplace();
                    _modelFMD030.DH      = txtDH.Text.strReplace();
                    _modelFMD030.LXR     = txtLXR.Text.strReplace();
                    if (_modelFMD030.ID != -1)
                    {
                        //更新数据
                        _modelFMD030.GXZBH = ComForm.strUserName;
                        _modelFMD030.GXR   = PublicFun.GetSystemDateTime(Const.Date, Const.dateStyle_YMD);
                        _modelFMD030.GXSJ  = PublicFun.GetSystemDateTime(Const.Time, string.Empty);
                        _modelFMD030.GXDMM = systemdate.Get_SysDNBH();
                        DbHelperMySql.ExecuteSql(DBHelper.Update(TableName, _modelFMD030, " and ID=" + _modelFMD030.ID + ""));

                        //_bllFMD030.Update(_modelFMD030);
                        ComForm.DspMsg("M002", "");
                        txtGYSMC.Focus();
                    }
                    else
                    {
                        //插入数据
                        _modelFMD030.ID    = null;
                        _modelFMD030.RLZBH = ComForm.strUserName;
                        _modelFMD030.RLR   = PublicFun.GetSystemDateTime(Const.Date, Const.dateStyle_YMD);
                        _modelFMD030.RLSJ  = PublicFun.GetSystemDateTime(Const.Time, string.Empty);
                        _modelFMD030.RLDMM = systemdate.Get_SysDNBH();
                        DbHelperMySql.ExecuteSql(DBHelper.Add(TableName, _modelFMD030));
                        ComForm.DspMsg("M002", "");
                        txtGYSMC.Focus();
                    }
                }
                catch (Exception ew)
                {
                    ComForm.DspMsg("E001", "");
                    ComForm.InsertErrLog(ew.ToString(), this.Name);
                    return;
                }
                Init();
            }
        }
Ejemplo n.º 2
0
        //保存按钮
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtGYSMC.Text.strReplace().IsNullOrEmpty())
            {
                ComForm.DspMsg("W002", "供应商名称");
                txtGYSMC.Focus();
                return;

            }

            if (DBHelper.Exists(TableName, "and GYSMC='"+txtGYSMC.Text.strReplace()+"'"))
            {
                ComForm.DspMsg("W068", "供应商名称");
                txtGYSMC.Focus();
                return;
            }
            if (ComConst.LING == ComForm.DspMsg("Q004", ""))
            {
                try
                {
                    Model.fmd030 _modelFMD030 = new Model.fmd030();
                    _modelFMD030.ID = iID;
                    _modelFMD030.GYSMC = txtGYSMC.Text.strReplace();
                    _modelFMD030.GYSSLMC = txtGYSSLMC.Text.strReplace();
                    _modelFMD030.DZ = txtDZ.Text.strReplace();
                    _modelFMD030.DH = txtDH.Text.strReplace();
                    _modelFMD030.LXR = txtLXR.Text.strReplace();
                    if (_modelFMD030.ID!=-1)
                    {
                        //更新数据
                        _modelFMD030.GXZBH = ComForm.strUserName;
                        _modelFMD030.GXR = PublicFun.GetSystemDateTime(Const.Date, Const.dateStyle_YMD);
                        _modelFMD030.GXSJ = PublicFun.GetSystemDateTime(Const.Time, string.Empty);
                        _modelFMD030.GXDMM = systemdate.Get_SysDNBH();
                        DbHelperMySql.ExecuteSql(DBHelper.Update(TableName,_modelFMD030," and ID="+_modelFMD030.ID+""));

                        //_bllFMD030.Update(_modelFMD030);
                        ComForm.DspMsg("M002", "");
                        txtGYSMC.Focus();
                    }
                    else
                    {
                        //插入数据
                        _modelFMD030.ID = null;
                        _modelFMD030.RLZBH = ComForm.strUserName;
                        _modelFMD030.RLR = PublicFun.GetSystemDateTime(Const.Date, Const.dateStyle_YMD);
                        _modelFMD030.RLSJ = PublicFun.GetSystemDateTime(Const.Time, string.Empty);
                        _modelFMD030.RLDMM = systemdate.Get_SysDNBH();
                       DbHelperMySql.ExecuteSql(DBHelper.Add(TableName,_modelFMD030));
                        ComForm.DspMsg("M002", "");
                        txtGYSMC.Focus();
                    }

                }
                catch (Exception ew)
                {
                    ComForm.DspMsg("E001", "");
                    ComForm.InsertErrLog(ew.ToString(), this.Name);
                    return;
                }
                Init();
            }
        }