Exemple #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(MES.Model.Q_Review_Solution model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Q_Review_Solution(");
            strSql.Append("RequestId,ActionPlan,PlanDate,ActionEmp,ActionFile,SlnDate,SlnEmp,DisagreeState,DisagreeDesc,ResultDate,ResultEmp,ConfirmStatus,ConfirmDate,ConfirmEmpId,ConfirmEmpName,SlnState,DutyId,Cause)");
            strSql.Append(" values (");
            strSql.Append("@RequestId,@ActionPlan,@PlanDate,@ActionEmp,@ActionFile,@SlnDate,@SlnEmp,@DisagreeState,@DisagreeDesc,@ResultDate,@ResultEmp,@ConfirmStatus,@ConfirmDate,@ConfirmEmpId,@ConfirmEmpName,@SlnState,@DutyId,@Cause)");
            strSql.Append(";update Q_Review_ProbDuty set ReqFinishDate=isnull(ReqFinishDate,@PlanDate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RequestId",      SqlDbType.Int,         4),
                new SqlParameter("@ActionPlan",     SqlDbType.VarChar,   500),
                new SqlParameter("@PlanDate",       SqlDbType.DateTime),
                new SqlParameter("@ActionEmp",      SqlDbType.VarChar,    20),
                new SqlParameter("@ActionFile",     SqlDbType.VarChar,   100),
                new SqlParameter("@SlnDate",        SqlDbType.DateTime),
                new SqlParameter("@SlnEmp",         SqlDbType.VarChar,    20),
                new SqlParameter("@DisagreeState",  SqlDbType.VarChar,    10),
                new SqlParameter("@DisagreeDesc",   SqlDbType.VarChar,   100),
                new SqlParameter("@ResultDate",     SqlDbType.DateTime),
                new SqlParameter("@ResultEmp",      SqlDbType.VarChar,    20),
                new SqlParameter("@ConfirmStatus",  SqlDbType.VarChar,   100),
                new SqlParameter("@ConfirmDate",    SqlDbType.DateTime),
                new SqlParameter("@ConfirmEmpId",   SqlDbType.VarChar,    10),
                new SqlParameter("@ConfirmEmpName", SqlDbType.VarChar,    20),
                new SqlParameter("@SlnState",       SqlDbType.VarChar,    20),
                new SqlParameter("@DutyId",         SqlDbType.Int),
                new SqlParameter("@Cause",          SqlDbType.VarChar,   500),
            };
            parameters[0].Value  = model.RequestId;
            parameters[1].Value  = model.ActionPlan;
            parameters[2].Value  = model.PlanDate;
            parameters[3].Value  = model.ActionEmp;
            parameters[4].Value  = model.ActionFile;
            parameters[5].Value  = model.SlnDate;
            parameters[6].Value  = model.SlnEmp;
            parameters[7].Value  = model.DisagreeState;
            parameters[8].Value  = model.DisagreeDesc;
            parameters[9].Value  = model.ResultDate;
            parameters[10].Value = model.ResultEmp;
            parameters[11].Value = model.ConfirmStatus;
            parameters[12].Value = model.ConfirmDate;
            parameters[13].Value = model.ConfirmEmpId;
            parameters[14].Value = model.ConfirmEmpName;
            parameters[15].Value = model.SlnState;
            parameters[16].Value = model.DutyId;
            parameters[17].Value = model.Cause;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #2
0
        /// <summary>
        /// 更新确认状态
        /// </summary>
        public bool UpdateConfirm(MES.Model.Q_Review_Solution model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Q_Review_Solution set ");
            strSql.Append("ConfirmStatus=@ConfirmStatus,");
            strSql.Append("ConfirmDate=@ConfirmDate,");
            strSql.Append("ConfirmEmpId=@ConfirmEmpId,");
            strSql.Append("ConfirmEmpName=@ConfirmEmpName,");

            strSql.Append("SlnState=@SlnState,");
            strSql.Append("ConfirmDesc=@ConfirmDesc");
            strSql.Append(" where SlnId=@SlnId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ConfirmStatus",  SqlDbType.VarChar,   100),
                new SqlParameter("@ConfirmDate",    SqlDbType.DateTime),
                new SqlParameter("@ConfirmEmpId",   SqlDbType.VarChar,    10),
                new SqlParameter("@ConfirmEmpName", SqlDbType.VarChar,    20),
                new SqlParameter("@SlnState",       SqlDbType.VarChar,    20),
                new SqlParameter("@ConfirmDesc",    SqlDbType.VarChar,   100),
                new SqlParameter("@SlnId",          SqlDbType.Int)
            };
            parameters[0].Value = model.ConfirmStatus;
            parameters[1].Value = model.ConfirmDate;
            parameters[2].Value = model.ConfirmEmpId;
            parameters[3].Value = model.ConfirmEmpName;
            parameters[4].Value = model.SlnState;
            parameters[5].Value = model.ConfirmDesc;
            parameters[6].Value = model.SlnId;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MES.Model.Q_Review_Solution GetModel(int SlnId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 RequestId,SlnId,DutyId,ActionPlan,PlanDate,ActionEmp,ActionFile,SlnDate,SlnEmp,DisagreeState,DisagreeDesc,ResultDate,ResultEmp,ConfirmStatus,ConfirmDate,ConfirmEmpId,ConfirmEmpName,ConfirmDesc,SlnState,Cause from Q_Review_Solution ");
            strSql.Append(" where SlnId=@SlnId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SlnId", SqlDbType.Int, 4)
            };
            parameters[0].Value = SlnId;

            MES.Model.Q_Review_Solution model = new MES.Model.Q_Review_Solution();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #4
0
        /// <summary>
        /// 更新否决状态
        /// </summary>
        public bool UpdateReject(MES.Model.Q_Review_Solution model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Q_Review_Solution set ");
            strSql.Append("DisagreeState=@DisagreeState,");
            strSql.Append("DisagreeDesc=@DisagreeDesc");
            strSql.Append("DisagreeEmp=@DisagreeEmp,");
            strSql.Append("DisagreeDate=@DisagreeDate");
            strSql.Append(" where SlnId=@SlnId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DisagreeState", SqlDbType.VarChar,   20),
                new SqlParameter("@DisagreeDesc",  SqlDbType.VarChar),
                new SqlParameter("@DisagreeEmp",   SqlDbType.VarChar,   20),
                new SqlParameter("@DisagreeDate",  SqlDbType.DateTime),
                new SqlParameter("@SlnId",         SqlDbType.Int)
            };
            parameters[0].Value = model.DisagreeState;
            parameters[1].Value = model.DisagreeDesc;
            parameters[2].Value = model.DisagreeEmp;
            parameters[3].Value = model.DisagreeDate;

            parameters[4].Value = model.SlnId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MES.Model.Q_Review_Solution DataRowToModel(DataRow row)
 {
     MES.Model.Q_Review_Solution model = new MES.Model.Q_Review_Solution();
     if (row != null)
     {
         if (row["RequestId"] != null && row["RequestId"].ToString() != "")
         {
             model.RequestId = int.Parse(row["RequestId"].ToString());
         }
         if (row["SlnId"] != null && row["SlnId"].ToString() != "")
         {
             model.SlnId = int.Parse(row["SlnId"].ToString());
         }
         if (row["DutyId"] != null && row["DutyId"].ToString() != "")
         {
             model.DutyId = int.Parse(row["DutyId"].ToString());
         }
         if (row["ActionPlan"] != null)
         {
             model.ActionPlan = row["ActionPlan"].ToString();
         }
         if (row["PlanDate"] != null && row["PlanDate"].ToString() != "")
         {
             model.PlanDate = DateTime.Parse(row["PlanDate"].ToString());
         }
         if (row["ActionEmp"] != null)
         {
             model.ActionEmp = row["ActionEmp"].ToString();
         }
         if (row["ActionFile"] != null)
         {
             model.ActionFile = row["ActionFile"].ToString();
         }
         if (row["SlnDate"] != null && row["SlnDate"].ToString() != "")
         {
             model.SlnDate = DateTime.Parse(row["SlnDate"].ToString());
         }
         if (row["SlnEmp"] != null)
         {
             model.SlnEmp = row["SlnEmp"].ToString();
         }
         if (row["DisagreeState"] != null)
         {
             model.DisagreeState = row["DisagreeState"].ToString();
         }
         if (row["DisagreeDesc"] != null)
         {
             model.DisagreeDesc = row["DisagreeDesc"].ToString();
         }
         if (row["ResultDate"] != null && row["ResultDate"].ToString() != "")
         {
             model.ResultDate = DateTime.Parse(row["ResultDate"].ToString());
         }
         if (row["ResultEmp"] != null)
         {
             model.ResultEmp = row["ResultEmp"].ToString();
         }
         if (row["ConfirmStatus"] != null)
         {
             model.ConfirmStatus = row["ConfirmStatus"].ToString();
         }
         if (row["ConfirmDesc"] != null)
         {
             model.ConfirmDesc = row["ConfirmDesc"].ToString();
         }
         if (row["ConfirmDate"] != null && row["ConfirmDate"].ToString() != "")
         {
             model.ConfirmDate = DateTime.Parse(row["ConfirmDate"].ToString());
         }
         if (row["ConfirmEmpId"] != null)
         {
             model.ConfirmEmpId = row["ConfirmEmpId"].ToString();
         }
         if (row["ConfirmEmpName"] != null)
         {
             model.ConfirmEmpName = row["ConfirmEmpName"].ToString();
         }
         model.SlnState = row["SlnState"].ToString();
         model.Cause    = row["Cause"].ToString();
     }
     return(model);
 }
Exemple #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MES.Model.Q_Review_Solution model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Q_Review_Solution set ");
            strSql.Append("ActionPlan=@ActionPlan,");
            strSql.Append("PlanDate=@PlanDate,");
            strSql.Append("ActionEmp=@ActionEmp,");
            strSql.Append("ActionFile=@ActionFile,");
            strSql.Append("SlnDate=@SlnDate,");
            strSql.Append("SlnEmp=@SlnEmp,");
            strSql.Append("DisagreeState=@DisagreeState,");
            strSql.Append("DisagreeDesc=@DisagreeDesc,");
            strSql.Append("ResultDate=@ResultDate,");
            strSql.Append("ResultEmp=@ResultEmp,");
            strSql.Append("ConfirmStatus=@ConfirmStatus,");
            strSql.Append("ConfirmDate=@ConfirmDate,");
            strSql.Append("ConfirmEmpId=@ConfirmEmpId,");
            strSql.Append("ConfirmEmpName=@ConfirmEmpName,");
            strSql.Append("SlnState=@SlnState,");
            strSql.Append("Cause=@Cause,");
            strSql.Append("ConfirmDesc=@ConfirmDesc, ");
            strSql.Append("DisagreeEmp=@DisagreeEmp, ");
            strSql.Append("DisagreeDate=@DisagreeDate ");
            strSql.Append(" where SlnId=@SlnId");
            strSql.Append(" ; ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@ActionPlan",     SqlDbType.VarChar,   300),
                new SqlParameter("@PlanDate",       SqlDbType.DateTime),
                new SqlParameter("@ActionEmp",      SqlDbType.VarChar,    20),
                new SqlParameter("@ActionFile",     SqlDbType.VarChar,   100),
                new SqlParameter("@SlnDate",        SqlDbType.DateTime),
                new SqlParameter("@SlnEmp",         SqlDbType.VarChar,    20),
                new SqlParameter("@DisagreeState",  SqlDbType.VarChar,    10),
                new SqlParameter("@DisagreeDesc",   SqlDbType.VarChar,   100),
                new SqlParameter("@ResultDate",     SqlDbType.DateTime),
                new SqlParameter("@ResultEmp",      SqlDbType.VarChar,    20),
                new SqlParameter("@ConfirmStatus",  SqlDbType.VarChar,   100),
                new SqlParameter("@ConfirmDate",    SqlDbType.DateTime),
                new SqlParameter("@ConfirmEmpId",   SqlDbType.VarChar,    10),
                new SqlParameter("@ConfirmEmpName", SqlDbType.VarChar,    20),
                new SqlParameter("@SlnState",       SqlDbType.VarChar,    20),
                new SqlParameter("@Cause",          SqlDbType.VarChar,   300),
                new SqlParameter("@ConfirmDesc",    SqlDbType.VarChar,   300),
                new SqlParameter("@DisagreeEmp",    SqlDbType.VarChar,    20),
                new SqlParameter("@DisagreeDate",   SqlDbType.DateTime),
                new SqlParameter("@RequestId",      SqlDbType.Int,         4),
                new SqlParameter("@SlnId",          SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.ActionPlan;
            parameters[1].Value  = model.PlanDate;
            parameters[2].Value  = model.ActionEmp;
            parameters[3].Value  = model.ActionFile;
            parameters[4].Value  = model.SlnDate;
            parameters[5].Value  = model.SlnEmp;
            parameters[6].Value  = model.DisagreeState;
            parameters[7].Value  = model.DisagreeDesc;
            parameters[8].Value  = model.ResultDate;
            parameters[9].Value  = model.ResultEmp;
            parameters[10].Value = model.ConfirmStatus;
            parameters[11].Value = model.ConfirmDate;
            parameters[12].Value = model.ConfirmEmpId;
            parameters[13].Value = model.ConfirmEmpName;
            parameters[14].Value = model.SlnState;
            parameters[15].Value = model.Cause;
            parameters[16].Value = model.ConfirmDesc;
            parameters[17].Value = model.DisagreeEmp;
            parameters[18].Value = model.DisagreeDate;
            parameters[19].Value = model.RequestId;
            parameters[20].Value = model.SlnId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }