コード例 #1
0
ファイル: FrmTechnology.cs プロジェクト: seezeef/YS_ERP
 /// <summary>
 /// 删除
 /// </summary>
 private void MasterToolBar_DoDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定要删除吗?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.OK)
     {
         try
         {
             GetCurrentSelectedTable();
             if (_currentTechnologyTable != null)
             {
                 bTechnology.Delete(_currentTechnologyTable.CODE);
                 Search(this.pgControl.GetCurrentPage());
             }
             else
             {
                 MessageBox.Show("请选择正确的行!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("删除失败,请重试或与系统管理员联系。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             Logger.Error("订单类型删除失败", ex);
         }
         _currentTechnologyTable = null;
     }
 }
コード例 #2
0
ファイル: TechnologyManage.cs プロジェクト: seezeef/YS_ERP
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BaseTechnologyTable model)
        {
            StringBuilder strSql = new StringBuilder();

            #region 更新
            strSql = new StringBuilder();
            strSql.Append("update BASE_TECHNOLOGY set ");
            strSql.Append("NAME=@NAME,");
            strSql.Append("DEPARTMENT_CODE=@DEPARTMENT_CODE,");
            strSql.Append("TECHNOLOGY_DRAWING1=@TECHNOLOGY_DRAWING1,");
            strSql.Append("TECHNOLOGY_DRAWING2=@TECHNOLOGY_DRAWING2,");
            strSql.Append("TECHNOLOGY_DRAWING3=@TECHNOLOGY_DRAWING3,");
            strSql.Append("PERIOD=@PERIOD,");
            strSql.Append("STATUS_FLAG=@STATUS_FLAG,");
            strSql.Append("CREATE_USER=@CREATE_USER,");
            strSql.Append("CREATE_DATE_TIME=GETDATE(),");
            strSql.Append("LAST_UPDATE_USER=@LAST_UPDATE_USER,");
            strSql.Append("LAST_UPDATE_TIME=GETDATE()");
            strSql.Append(" where CODE=@CODE ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CODE",                SqlDbType.VarChar,  50),
                new SqlParameter("@NAME",                SqlDbType.VarChar,  50),
                new SqlParameter("@DEPARTMENT_CODE",     SqlDbType.VarChar, 100),
                new SqlParameter("@TECHNOLOGY_DRAWING1", SqlDbType.VarChar,  50),
                new SqlParameter("@TECHNOLOGY_DRAWING2", SqlDbType.VarChar,  50),
                new SqlParameter("@TECHNOLOGY_DRAWING3", SqlDbType.VarChar,   8),
                new SqlParameter("@PERIOD",              SqlDbType.Int,       9),
                new SqlParameter("@STATUS_FLAG",         SqlDbType.Int,       4),
                new SqlParameter("@CREATE_USER",         SqlDbType.VarChar,  20),
                new SqlParameter("@LAST_UPDATE_USER",    SqlDbType.VarChar, 20)
            };

            parameters[0].Value = model.CODE;
            parameters[1].Value = model.NAME;
            parameters[2].Value = model.DEPARTMENT_CODE;
            parameters[3].Value = model.TECHNOLOGY_DRAWING1;
            parameters[4].Value = model.TECHNOLOGY_DRAWING2;
            parameters[5].Value = model.TECHNOLOGY_DRAWING3;
            parameters[6].Value = model.PERIOD;
            parameters[7].Value = CConstant.NORMAL;
            parameters[8].Value = model.CREATE_USER;
            parameters[9].Value = model.LAST_UPDATE_USER;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
            #endregion
        }
コード例 #3
0
ファイル: FrmTechnologyDialog.cs プロジェクト: seezeef/YS_ERP
 private void txtTechnologyCode_Leave(object sender, EventArgs e)
 {
     //判断编号是否已存在
     if (!(txtTechnologyCode.Focused))
     {
         BaseTechnologyTable TechnologyTable = new BaseTechnologyTable();
         TechnologyTable = bTechnology.GetModel(txtTechnologyCode.Text);
         if (TechnologyTable != null)
         {
             txtTechnologyCode.Text = "";
             MessageBox.Show("技术编号已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
コード例 #4
0
ファイル: FrmTechnology.cs プロジェクト: seezeef/YS_ERP
        /// <summary>
        /// 获得当前选中的数据
        /// </summary>
        private void GetCurrentSelectedTable()
        {
            try
            {
                string code = dgvData.SelectedRows[0].Cells["CODE"].Value.ToString();
                if (code != "")
                {
                    _currentTechnologyTable = bTechnology.GetModel(code);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("订单类型中获取当前数据失败!", ex);
            }

            if (_currentTechnologyTable == null || _currentTechnologyTable.CODE == null || "".Equals(_currentTechnologyTable.CODE))
            {
                _currentTechnologyTable = null;
            }
        }
コード例 #5
0
ファイル: TechnologyManage.cs プロジェクト: seezeef/YS_ERP
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BaseTechnologyTable GetModel(string CODE)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from base_technology_view ");
            strSql.Append(" where CODE=@CODE ");
            strSql.AppendFormat(" and STATUS_FLAG <> {0}", CConstant.DELETE);
            SqlParameter[] parameters =
            {
                new SqlParameter("@CODE", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = CODE;

            BaseTechnologyTable model = new BaseTechnologyTable();
            DataSet             ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.CODE = ds.Tables[0].Rows[0]["CODE"].ToString();
                model.NAME = ds.Tables[0].Rows[0]["NAME"].ToString();
                model.TECHNOLOGY_DRAWING1 = ds.Tables[0].Rows[0]["TECHNOLOGY_DRAWING1"].ToString();
                model.TECHNOLOGY_DRAWING2 = ds.Tables[0].Rows[0]["TECHNOLOGY_DRAWING2"].ToString();
                model.TECHNOLOGY_DRAWING3 = ds.Tables[0].Rows[0]["TECHNOLOGY_DRAWING3"].ToString();
                model.PERIOD                  = CConvert.ToInt32(ds.Tables[0].Rows[0]["PERIOD"].ToString());
                model.STATUS_FLAG             = CConvert.ToInt32(ds.Tables[0].Rows[0]["STATUS_FLAG"].ToString());
                model.LAST_UPDATE_USER        = ds.Tables[0].Rows[0]["LAST_UPDATE_USER"].ToString();
                model.LAST_UPDATE_TIME        = CConvert.ToDateTime(ds.Tables[0].Rows[0]["LAST_UPDATE_TIME"].ToString());
                model.DEPARTMENT_CODE         = ds.Tables[0].Rows[0]["DEPARTMENT_CODE"].ToString();
                model.CREATE_USER             = ds.Tables[0].Rows[0]["CREATE_USER"].ToString();
                model.CREATE_DATE_TIME        = CConvert.ToDateTime(ds.Tables[0].Rows[0]["CREATE_DATE_TIME"].ToString());
                model.DEPARTMENT_NAME         = ds.Tables[0].Rows[0]["DEPARTMENT_NAME"].ToString();
                model.TECHNOLOGY_DRAWINGNAME1 = ds.Tables[0].Rows[0]["DRAWING_NAME1"].ToString();
                model.TECHNOLOGY_DRAWINGNAME2 = ds.Tables[0].Rows[0]["DRAWING_NAME2"].ToString();
                model.TECHNOLOGY_DRAWINGNAME3 = ds.Tables[0].Rows[0]["DRAWING_NAME3"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #6
0
ファイル: FrmTechnology.cs プロジェクト: seezeef/YS_ERP
 /// <summary>
 /// 打开新窗口
 /// </summary>
 private void OpenDialogFrm(int mode)
 {
     if (mode == CConstant.MODE_NEW || _currentTechnologyTable != null)
     {
         FrmTechnologyDialog frm = new FrmTechnologyDialog();
         frm.UserInfo = _userInfo;
         frm.CurrentTechnologyTable = _currentTechnologyTable;
         frm.Mode = mode;
         DialogResult resule = frm.ShowDialog(this);
         if (resule == DialogResult.OK && isSearch)
         {
             Search(this.pgControl.GetCurrentPage());
         }
         frm.Dispose();
     }
     else
     {
         //MessageBox.Show("请选择正确的行!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     _currentTechnologyTable = null;
 }
コード例 #7
0
ファイル: FrmTechnologyDialog.cs プロジェクト: seezeef/YS_ERP
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                if (_currentTechnologyTable == null)
                {
                    _currentTechnologyTable = new BaseTechnologyTable();
                }
                _currentTechnologyTable.CODE = this.txtTechnologyCode.Text.Trim();
                _currentTechnologyTable.NAME = txtTechnologyName.Text.Trim();
                _currentTechnologyTable.TECHNOLOGY_DRAWING1 = txtTechnologyDrawingCode1.Text.Trim();
                _currentTechnologyTable.TECHNOLOGY_DRAWING2 = txtTechnologyDrawingCode2.Text.Trim();
                _currentTechnologyTable.TECHNOLOGY_DRAWING3 = txtTechnologyDrawingCode3.Text.Trim();
                _currentTechnologyTable.DEPARTMENT_CODE     = txtDepartmentCode.Text.Trim();
                _currentTechnologyTable.PERIOD           = CConvert.ToInt32(txtPeriod.Text.Trim());
                _currentTechnologyTable.LAST_UPDATE_USER = _userInfo.CODE;

                try
                {
                    if (bTechnology.Exists(txtTechnologyCode.Text.Trim()))
                    {
                        bTechnology.Update(_currentTechnologyTable);
                    }
                    else
                    {
                        _currentTechnologyTable.CREATE_USER = _userInfo.CODE;
                        bTechnology.Add(_currentTechnologyTable);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("保存失败,请重新输入!");
                    Logger.Error("订单类型保存失败!", ex);
                    return;
                }
                result = DialogResult.OK;
                this.Close();
            }
        }
コード例 #8
0
ファイル: BTechnology.cs プロジェクト: seezeef/YS_ERP
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BaseTechnologyTable model)
 {
     return(dal.Update(model));
 }
コード例 #9
0
ファイル: BTechnology.cs プロジェクト: seezeef/YS_ERP
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(BaseTechnologyTable model)
 {
     return(dal.Add(model));
 }