Exemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TQB_GRADE_RULE model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TQB_GRADE_RULE(");
            strSql.Append("C_RULE_STD_ID,C_SPEC_MIN,C_SPEC_INTERVAL,C_SPEC_MAX,C_CHARACTER_ID,C_LEV,C_TARGET_MIN,C_TARGET_INTERVAL,C_TARGET_MAX,N_STATUS,C_REMARK,C_EMP_ID)");
            strSql.Append(" values (");
            strSql.Append(":C_RULE_STD_ID,:C_SPEC_MIN,:C_SPEC_INTERVAL,:C_SPEC_MAX,:C_CHARACTER_ID,:C_LEV,:C_TARGET_MIN,:C_TARGET_INTERVAL,:C_TARGET_MAX,:N_STATUS,:C_REMARK,:C_EMP_ID)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_RULE_STD_ID",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SPEC_MIN",        OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SPEC_INTERVAL",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SPEC_MAX",        OracleDbType.Varchar2, 100),
                new OracleParameter(":C_CHARACTER_ID",    OracleDbType.Varchar2, 100),
                new OracleParameter(":C_LEV",             OracleDbType.Varchar2, 100),
                new OracleParameter(":C_TARGET_MIN",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_TARGET_INTERVAL", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_TARGET_MAX",      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)
            };
            parameters[0].Value  = model.C_RULE_STD_ID;
            parameters[1].Value  = model.C_SPEC_MIN;
            parameters[2].Value  = model.C_SPEC_INTERVAL;
            parameters[3].Value  = model.C_SPEC_MAX;
            parameters[4].Value  = model.C_CHARACTER_ID;
            parameters[5].Value  = model.C_LEV;
            parameters[6].Value  = model.C_TARGET_MIN;
            parameters[7].Value  = model.C_TARGET_INTERVAL;
            parameters[8].Value  = model.C_TARGET_MAX;
            parameters[9].Value  = model.N_STATUS;
            parameters[10].Value = model.C_REMARK;
            parameters[11].Value = model.C_EMP_ID;

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

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

            strSql.Append("select C_ID,C_RULE_STD_ID,C_SPEC_MIN,C_SPEC_INTERVAL,C_SPEC_MAX,C_CHARACTER_ID,C_LEV,C_TARGET_MIN,C_TARGET_INTERVAL,C_TARGET_MAX,N_STATUS,C_REMARK,C_EMP_ID,D_MOD_DT from TQB_GRADE_RULE ");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_ID", OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = C_ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TQB_GRADE_RULE model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TQB_GRADE_RULE model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 5
0
        /// <summary>
        /// 保存评级明细
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_SaveDetails_Click(object sender, EventArgs e)
        {
            try
            {
                DataRow dr = gv_RuleStd.GetDataRow(gv_RuleStd.FocusedRowHandle);

                if (str_TQB_GRADE_RULE_ID == "")//新增
                {
                    if (string.IsNullOrEmpty(cbo_CharcterName.Text.Trim()))
                    {
                        MessageBox.Show("项目名称不能为空!");
                        return;
                    }

                    if (string.IsNullOrEmpty(txt_TargetMin.Text.Trim()) && string.IsNullOrEmpty(txt_TargetMax.Text.Trim()))
                    {
                        MessageBox.Show("目标值不能全为空!");
                        return;
                    }



                    Mod_TQB_GRADE_RULE model = new Mod_TQB_GRADE_RULE();
                    model.C_RULE_STD_ID     = dr["C_ID"].ToString();
                    model.C_SPEC_MIN        = txt_SpecMin.Text.Trim();
                    model.C_SPEC_INTERVAL   = cbo_SpecInterval.Text.Trim();
                    model.C_SPEC_MAX        = txt_SpecMax.Text.Trim();
                    model.C_CHARACTER_ID    = bllTqbCharacter.GetItemID(cbo_CharcterName.Text.Trim());
                    model.C_LEV             = imgcbo_Lev.Text.Trim();
                    model.C_TARGET_MIN      = txt_TargetMin.Text.Trim();
                    model.C_TARGET_INTERVAL = cbo_TargetInterval.Text.Trim();
                    model.C_TARGET_MAX      = txt_TargetMax.Text.Trim();
                    model.C_EMP_ID          = RV.UI.UserInfo.userID;

                    if (bllTqbGradeRule.Add(model))
                    {
                        Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加评级准则明细信息");//添加操作日志

                        MessageBox.Show("添加成功!");
                        BindGradeDetails(dr["C_ID"].ToString());
                    }
                }
                else//修改
                {
                    if (string.IsNullOrEmpty(cbo_CharcterName.Text.Trim()))
                    {
                        MessageBox.Show("项目名称不能为空!");
                        return;
                    }

                    if (string.IsNullOrEmpty(txt_TargetMin.Text.Trim()) && string.IsNullOrEmpty(txt_TargetMax.Text.Trim()))
                    {
                        MessageBox.Show("目标值不能全为空!");
                        return;
                    }


                    Mod_TQB_GRADE_RULE model = bllTqbGradeRule.GetModel(str_TQB_GRADE_RULE_ID);
                    model.C_SPEC_MIN        = txt_SpecMin.Text.Trim();
                    model.C_SPEC_INTERVAL   = cbo_SpecInterval.Text.Trim();
                    model.C_SPEC_MAX        = txt_SpecMax.Text.Trim();
                    model.C_CHARACTER_ID    = bllTqbCharacter.GetItemID(cbo_CharcterName.Text.Trim());
                    model.C_LEV             = imgcbo_Lev.Text.Trim();
                    model.C_TARGET_MIN      = txt_TargetMin.Text.Trim();
                    model.C_TARGET_INTERVAL = cbo_TargetInterval.Text.Trim();
                    model.C_TARGET_MAX      = txt_TargetMax.Text.Trim();
                    model.C_EMP_ID          = RV.UI.UserInfo.userID;
                    model.D_MOD_DT          = RV.UI.ServerTime.timeNow();

                    if (bllTqbGradeRule.Update(model))
                    {
                        MessageBox.Show("修改成功!");
                        BindGradeDetails(dr["C_ID"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mod_TQB_GRADE_RULE model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TQB_GRADE_RULE set ");
            strSql.Append("C_RULE_STD_ID=:C_RULE_STD_ID,");
            strSql.Append("C_SPEC_MIN=:C_SPEC_MIN,");
            strSql.Append("C_SPEC_INTERVAL=:C_SPEC_INTERVAL,");
            strSql.Append("C_SPEC_MAX=:C_SPEC_MAX,");
            strSql.Append("C_CHARACTER_ID=:C_CHARACTER_ID,");
            strSql.Append("C_LEV=:C_LEV,");
            strSql.Append("C_TARGET_MIN=:C_TARGET_MIN,");
            strSql.Append("C_TARGET_INTERVAL=:C_TARGET_INTERVAL,");
            strSql.Append("C_TARGET_MAX=:C_TARGET_MAX,");
            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(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_RULE_STD_ID",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SPEC_MIN",        OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SPEC_INTERVAL",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SPEC_MAX",        OracleDbType.Varchar2, 100),
                new OracleParameter(":C_CHARACTER_ID",    OracleDbType.Varchar2, 100),
                new OracleParameter(":C_LEV",             OracleDbType.Varchar2, 100),
                new OracleParameter(":C_TARGET_MIN",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_TARGET_INTERVAL", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_TARGET_MAX",      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(":C_ID",              OracleDbType.Varchar2, 100)
            };
            parameters[0].Value  = model.C_RULE_STD_ID;
            parameters[1].Value  = model.C_SPEC_MIN;
            parameters[2].Value  = model.C_SPEC_INTERVAL;
            parameters[3].Value  = model.C_SPEC_MAX;
            parameters[4].Value  = model.C_CHARACTER_ID;
            parameters[5].Value  = model.C_LEV;
            parameters[6].Value  = model.C_TARGET_MIN;
            parameters[7].Value  = model.C_TARGET_INTERVAL;
            parameters[8].Value  = model.C_TARGET_MAX;
            parameters[9].Value  = model.N_STATUS;
            parameters[10].Value = model.C_REMARK;
            parameters[11].Value = model.C_EMP_ID;
            parameters[12].Value = model.D_MOD_DT;
            parameters[13].Value = model.C_ID;

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

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

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].ToString();
                }
                if (row["C_RULE_STD_ID"] != null)
                {
                    model.C_RULE_STD_ID = row["C_RULE_STD_ID"].ToString();
                }
                if (row["C_SPEC_MIN"] != null)
                {
                    model.C_SPEC_MIN = row["C_SPEC_MIN"].ToString();
                }
                if (row["C_SPEC_INTERVAL"] != null)
                {
                    model.C_SPEC_INTERVAL = row["C_SPEC_INTERVAL"].ToString();
                }
                if (row["C_SPEC_MAX"] != null)
                {
                    model.C_SPEC_MAX = row["C_SPEC_MAX"].ToString();
                }
                if (row["C_CHARACTER_ID"] != null)
                {
                    model.C_CHARACTER_ID = row["C_CHARACTER_ID"].ToString();
                }
                if (row["C_LEV"] != null)
                {
                    model.C_LEV = row["C_LEV"].ToString();
                }
                if (row["C_TARGET_MIN"] != null)
                {
                    model.C_TARGET_MIN = row["C_TARGET_MIN"].ToString();
                }
                if (row["C_TARGET_INTERVAL"] != null)
                {
                    model.C_TARGET_INTERVAL = row["C_TARGET_INTERVAL"].ToString();
                }
                if (row["C_TARGET_MAX"] != null)
                {
                    model.C_TARGET_MAX = row["C_TARGET_MAX"].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());
                }
            }
            return(model);
        }