Exemple #1
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Add_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_User.Text.Trim()))
            {
                MessageBox.Show("审核人不能为空!");
                return;
            }

            if (string.IsNullOrEmpty(icbo_Dept.Text.Trim()))
            {
                MessageBox.Show("部门不能为空!");
                return;
            }

            Mod_TQB_XN_CHECK_USER modUser = new Mod_TQB_XN_CHECK_USER();

            modUser.C_USER_NAME = txt_User.Text.Trim();
            modUser.C_DEPT      = icbo_Dept.Text.Trim();

            if (bllCheckUser.Add(modUser))
            {
                MessageBox.Show("删除成功!");

                BindInfo();
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TQB_XN_CHECK_USER model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TQB_XN_CHECK_USER(");
            strSql.Append("C_USER_NAME,C_DEPT,N_STATUS,C_EMP_ID,D_MOD_DT,C_REMARK)");
            strSql.Append(" values (");
            strSql.Append(":C_USER_NAME,:C_DEPT,:N_STATUS,:C_EMP_ID,:D_MOD_DT,:C_REMARK)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_USER_NAME", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_DEPT",      OracleDbType.Varchar2, 100),
                new OracleParameter(":N_STATUS",    OracleDbType.Decimal,    1),
                new OracleParameter(":C_EMP_ID",    OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",    OracleDbType.Date),
                new OracleParameter(":C_REMARK",    OracleDbType.Varchar2, 500)
            };
            parameters[0].Value = model.C_USER_NAME;
            parameters[1].Value = model.C_DEPT;
            parameters[2].Value = model.N_STATUS;
            parameters[3].Value = model.C_EMP_ID;
            parameters[4].Value = model.D_MOD_DT;
            parameters[5].Value = model.C_REMARK;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Cancle_Click(object sender, EventArgs e)
        {
            DataRow dr = gv_User.GetDataRow(gv_User.FocusedRowHandle);

            if (dr != null)
            {
                Mod_TQB_XN_CHECK_USER modUser = bllCheckUser.GetModel(dr["C_ID"].ToString());

                modUser.N_STATUS = 0;

                if (bllCheckUser.Update(modUser))
                {
                    MessageBox.Show("删除成功!");

                    BindInfo();
                }
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mod_TQB_XN_CHECK_USER model)
        {
            StringBuilder strSql = new StringBuilder();

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

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

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

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].ToString();
                }
                if (row["C_USER_NAME"] != null)
                {
                    model.C_USER_NAME = row["C_USER_NAME"].ToString();
                }
                if (row["C_DEPT"] != null)
                {
                    model.C_DEPT = row["C_DEPT"].ToString();
                }
                if (row["N_STATUS"] != null && row["N_STATUS"].ToString() != "")
                {
                    model.N_STATUS = decimal.Parse(row["N_STATUS"].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["C_REMARK"] != null)
                {
                    model.C_REMARK = row["C_REMARK"].ToString();
                }
            }
            return(model);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TQB_XN_CHECK_USER GetModel(string C_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select C_ID,C_USER_NAME,C_DEPT,N_STATUS,C_EMP_ID,D_MOD_DT,C_REMARK from TQB_XN_CHECK_USER ");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_ID", OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = C_ID;

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

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