Beispiel #1
0
        /// <summary>
        /// 停用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Stop_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dialogResult = MessageBox.Show("是否停用?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (dialogResult == DialogResult.OK)//如果点击“确定”按钮
                {
                    DataRow dr = this.gv_QYMC.GetDataRow(this.gv_QYMC.FocusedRowHandle);
                    if (dr == null)
                    {
                        return;
                    }
                    Mod_TQB_SAMPLING mod = bll.GetModel(dr["C_ID"].ToString());
                    mod.N_STATUS = 0;
                    bll.Update(mod);
                    MessageBox.Show("已停用!");
                    FrmQB_QYMC_Load(null, null);

                    Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "停用取样名称信息");//添加操作日志
                }
                else//如果点击“取消”按钮
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Add_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txt_Name.Text.Trim()))
                {
                    MessageBox.Show("项目名称不能为空!");
                    return;
                }
                if (cbo_jcbm.SelectedIndex == -1)
                {
                    MessageBox.Show("检测部门不能为空!");
                    return;
                }
                if (string.IsNullOrEmpty(max))
                {
                    max = "1001";
                }
                else
                {
                    max = (Convert.ToInt32(max) + 1).ToString();
                }
                if (string.IsNullOrEmpty(order))
                {
                    order = "1";
                }
                else
                {
                    order = (Convert.ToInt32(order) + 1).ToString();
                }
                #region 检测是否重复添加
                System.Collections.Hashtable ht = new System.Collections.Hashtable();
                ht.Add("C_SAMPLING_NAME", txt_Name.Text);
                ht.Add("N_STATUS", "1");
                if (Common.CheckRepeat.CheckTable("TQB_SAMPLING", ht) > 0)
                {
                    MessageBox.Show("已存在,不能重复添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                #endregion
                Mod_TQB_SAMPLING mod = new Mod_TQB_SAMPLING();
                mod.C_SAMPLING_CODE = "S" + max;
                mod.C_SAMPLING_NAME = txt_Name.Text.Trim();
                mod.N_SAMPLING_SN   = Convert.ToDecimal(order);
                mod.C_CHECK_DEPMT   = cbo_jcbm.Text.Trim();
                mod.C_REMARK        = txt_Remark.Text.Trim();
                mod.C_EMP_ID        = RV.UI.UserInfo.UserID;
                bll.Add(mod);
                MessageBox.Show("添加成功!");
                FrmQB_QYMC_Load(null, null);
                ClearContent.ClearFlowLayoutPanel(panelControl1.Controls);

                Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加取样名称");//添加操作日志
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #3
0
        private void FrmQB_QYMC_EDIT_Load(object sender, EventArgs e)
        {
            strMenuName = RV.UI.UserInfo.menuName;
            Mod_TQB_SAMPLING mod = bll.GetModel(c_id);

            txt_Name.Text   = mod.C_SAMPLING_NAME;
            txt_Remark.Text = mod.C_REMARK;
            cbo_jcbm.Text   = mod.C_CHECK_DEPMT;
            txt_SXH.Text    = mod.N_SAMPLING_SN.ToString();
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mod_TQB_SAMPLING model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TQB_SAMPLING set ");
            strSql.Append("C_SAMPLING_CODE=:C_SAMPLING_CODE,");
            strSql.Append("C_SAMPLING_NAME=:C_SAMPLING_NAME,");
            strSql.Append("N_STATUS=:N_STATUS,");
            strSql.Append("C_REMARK=:C_REMARK,");
            strSql.Append("C_EMP_ID=:C_EMP_ID,");
            strSql.Append("D_MOD_DT=:D_MOD_DT,");
            strSql.Append("N_SAMPLING_SN=:N_SAMPLING_SN,");
            strSql.Append("C_CHECK_DEPMT=:C_CHECK_DEPMT");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_SAMPLING_CODE", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SAMPLING_NAME", OracleDbType.Varchar2, 100),
                new OracleParameter(":N_STATUS",        OracleDbType.Decimal,    1),
                new OracleParameter(":C_REMARK",        OracleDbType.Varchar2, 500),
                new OracleParameter(":C_EMP_ID",        OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",        OracleDbType.Date),
                new OracleParameter(":N_SAMPLING_SN",   OracleDbType.Decimal,    1),
                new OracleParameter(":C_CHECK_DEPMT",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_ID",            OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = model.C_SAMPLING_CODE;
            parameters[1].Value = model.C_SAMPLING_NAME;
            parameters[2].Value = model.N_STATUS;
            parameters[3].Value = model.C_REMARK;
            parameters[4].Value = model.C_EMP_ID;
            parameters[5].Value = model.D_MOD_DT;
            parameters[6].Value = model.N_SAMPLING_SN;
            parameters[7].Value = model.C_CHECK_DEPMT;
            parameters[8].Value = model.C_ID;

            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TQB_SAMPLING DataRowToModel(DataRow row)
        {
            Mod_TQB_SAMPLING model = new Mod_TQB_SAMPLING();

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].ToString();
                }
                if (row["C_SAMPLING_CODE"] != null)
                {
                    model.C_SAMPLING_CODE = row["C_SAMPLING_CODE"].ToString();
                }
                if (row["C_SAMPLING_NAME"] != null)
                {
                    model.C_SAMPLING_NAME = row["C_SAMPLING_NAME"].ToString();
                }
                if (row["N_STATUS"] != null && row["N_STATUS"].ToString() != "")
                {
                    model.N_STATUS = decimal.Parse(row["N_STATUS"].ToString());
                }

                if (row["C_REMARK"] != null)
                {
                    model.C_REMARK = row["C_REMARK"].ToString();
                }
                if (row["C_EMP_ID"] != null)
                {
                    model.C_EMP_ID = row["C_EMP_ID"].ToString();
                }
                if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "")
                {
                    model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString());
                }
                if (row["N_SAMPLING_SN"] != null && row["N_SAMPLING_SN"].ToString() != "")
                {
                    model.N_SAMPLING_SN = decimal.Parse(row["N_SAMPLING_SN"].ToString());
                }
                if (row["C_CHECK_DEPMT"] != null)
                {
                    model.C_CHECK_DEPMT = row["C_CHECK_DEPMT"].ToString();
                }
            }
            return(model);
        }
Beispiel #6
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Seave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_Name.Text.Trim()))
            {
                MessageBox.Show("项目名称不能为空!");
                return;
            }
            //if (cbo_jcbm.SelectedIndex == -1)
            //{
            //    MessageBox.Show("检测部门不能为空!");
            //    return;
            //}

            try
            {
                Mod_TQB_SAMPLING mod = bll.GetModel(c_id);


                #region 检测是否重复添加
                System.Collections.Hashtable ht = new System.Collections.Hashtable();
                ht.Add("C_ID", c_id);
                ht.Add("C_SAMPLING_NAME", txt_Name.Text);
                ht.Add("N_STATUS", "1");
                if (Common.CheckRepeat.CheckTable("TQB_SAMPLING", ht) > 0)
                {
                    MessageBox.Show("已存在,不能重复添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                #endregion

                mod.C_SAMPLING_NAME = txt_Name.Text.Trim();
                mod.C_REMARK        = txt_Remark.Text.Trim();
                mod.N_SAMPLING_SN   = Convert.ToDecimal(txt_SXH.Text.Trim());
                mod.C_CHECK_DEPMT   = cbo_jcbm.Text;
                mod.C_EMP_ID        = RV.UI.UserInfo.UserID;
                mod.D_MOD_DT        = RV.UI.ServerTime.timeNow();
                bll.Update(mod);
                MessageBox.Show("修改成功!");
                this.DialogResult = DialogResult.Cancel;
                Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "修改取样名称信息");//添加操作日志
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TQB_SAMPLING model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TQB_SAMPLING(");
            strSql.Append("C_SAMPLING_CODE,C_SAMPLING_NAME,N_STATUS,C_REMARK,C_EMP_ID,N_SAMPLING_SN,C_CHECK_DEPMT)");
            strSql.Append(" values (");
            strSql.Append(":C_SAMPLING_CODE,:C_SAMPLING_NAME,:N_STATUS,:C_REMARK,:C_EMP_ID,:N_SAMPLING_SN,:C_CHECK_DEPMT)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_SAMPLING_CODE", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SAMPLING_NAME", OracleDbType.Varchar2, 100),
                new OracleParameter(":N_STATUS",        OracleDbType.Decimal,    1),
                new OracleParameter(":C_REMARK",        OracleDbType.Varchar2, 500),
                new OracleParameter(":C_EMP_ID",        OracleDbType.Varchar2, 100),
                new OracleParameter(":N_SAMPLING_SN",   OracleDbType.Decimal,    1),
                new OracleParameter(":C_CHECK_DEPMT",   OracleDbType.Varchar2, 100)
            };

            parameters[0].Value = model.C_SAMPLING_CODE;
            parameters[1].Value = model.C_SAMPLING_NAME;
            parameters[2].Value = model.N_STATUS;
            parameters[3].Value = model.C_REMARK;
            parameters[4].Value = model.C_EMP_ID;
            parameters[5].Value = model.N_SAMPLING_SN;
            parameters[6].Value = model.C_CHECK_DEPMT;
            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TQB_SAMPLING GetModel(string C_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select C_ID,C_SAMPLING_CODE,C_SAMPLING_NAME,N_STATUS,C_REMARK,C_EMP_ID,D_MOD_DT,N_SAMPLING_SN,C_CHECK_DEPMT from TQB_SAMPLING ");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_ID", OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = C_ID;

            Mod_TQB_SAMPLING model = new Mod_TQB_SAMPLING();
            DataSet          ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TQB_SAMPLING model)
 {
     return(dal.Update(model));
 }
Beispiel #10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TQB_SAMPLING model)
 {
     return(dal.Add(model));
 }