Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MES.Server.Model.BPM_Process model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BPM_Process set ");
            strSql.Append("Name=@Name,");
            strSql.Append("StandardHours=@StandardHours,");
            strSql.Append("Relax=@Relax,");
            strSql.Append("PCSH=@PCSH,");
            strSql.Append("Workstation=@Workstation,");
            strSql.Append("WorkShop=@WorkShop,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where ProcessID=@ProcessID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name",          SqlDbType.VarChar,  50),
                new SqlParameter("@StandardHours", SqlDbType.Float,     8),
                new SqlParameter("@Relax",         SqlDbType.Float,     8),
                new SqlParameter("@PCSH",          SqlDbType.Int,       4),
                new SqlParameter("@Workstation",   SqlDbType.VarChar,  50),
                new SqlParameter("@WorkShop",      SqlDbType.VarChar,  50),
                new SqlParameter("@Remark",        SqlDbType.VarChar, 500),
                new SqlParameter("@ProcessID",     SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.Name;
            parameters[1].Value = model.StandardHours;
            parameters[2].Value = model.Relax;
            parameters[3].Value = model.PCSH;
            parameters[4].Value = model.Workstation;
            parameters[5].Value = model.WorkShop;
            parameters[6].Value = model.Remark;
            parameters[7].Value = model.ProcessID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MES.Server.Model.BPM_Process DataRowToModel(DataRow row)
 {
     MES.Server.Model.BPM_Process model = new MES.Server.Model.BPM_Process();
     if (row != null)
     {
         if (row["ProcessID"] != null)
         {
             model.ProcessID = row["ProcessID"].ToString();
         }
         if (row["Name"] != null)
         {
             model.Name = row["Name"].ToString();
         }
         if (row["StandardHours"] != null && row["StandardHours"].ToString() != "")
         {
             model.StandardHours = decimal.Parse(row["StandardHours"].ToString());
         }
         if (row["Relax"] != null && row["Relax"].ToString() != "")
         {
             model.Relax = decimal.Parse(row["Relax"].ToString());
         }
         if (row["PCSH"] != null && row["PCSH"].ToString() != "")
         {
             model.PCSH = int.Parse(row["PCSH"].ToString());
         }
         if (row["Workstation"] != null)
         {
             model.Workstation = row["Workstation"].ToString();
         }
         if (row["WorkShop"] != null)
         {
             model.WorkShop = row["WorkShop"].ToString();
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
     }
     return(model);
 }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MES.Server.Model.BPM_Process model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BPM_Process(");
            strSql.Append("ProcessID,Name,StandardHours,Relax,PCSH,Workstation,WorkShop,Remark)");
            strSql.Append(" values (");
            strSql.Append("@ProcessID,@Name,@StandardHours,@Relax,@PCSH,@Workstation,@WorkShop,@Remark)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProcessID",     SqlDbType.VarChar, 50),
                new SqlParameter("@Name",          SqlDbType.VarChar, 50),
                new SqlParameter("@StandardHours", SqlDbType.Float,    8),
                new SqlParameter("@Relax",         SqlDbType.Float,    8),
                new SqlParameter("@PCSH",          SqlDbType.Int,      4),
                new SqlParameter("@Workstation",   SqlDbType.VarChar, 50),
                new SqlParameter("@WorkShop",      SqlDbType.VarChar, 50),
                new SqlParameter("@Remark",        SqlDbType.VarChar, 500)
            };
            parameters[0].Value = model.ProcessID;
            parameters[1].Value = model.Name;
            parameters[2].Value = model.StandardHours;
            parameters[3].Value = model.Relax;
            parameters[4].Value = model.PCSH;
            parameters[5].Value = model.Workstation;
            parameters[6].Value = model.WorkShop;
            parameters[7].Value = model.Remark;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MES.Server.Model.BPM_Process GetModel(string ProcessID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ProcessID,Name,StandardHours,Relax,PCSH,Workstation,WorkShop,Remark from BPM_Process ");
            strSql.Append(" where ProcessID=@ProcessID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProcessID", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = ProcessID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }