Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.e_Flow model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_e_Flow set ");
            strSql.Append("DrawNum=@DrawNum,");
            strSql.Append("ProcessOrder=@ProcessOrder,");
            strSql.Append("ProcessNum=@ProcessNum,");
            strSql.Append("ProcessName=@ProcessName,");
            strSql.Append("IsImportant=@IsImportant,");
            strSql.Append("IsAffirm=@IsAffirm,");
            strSql.Append("Content=@Content,");
            strSql.Append("Remaks=@Remaks,");
            strSql.Append("R1=@R1,");
            strSql.Append("R2=@R2,");
            strSql.Append("R3=@R3");
            strSql.Append(" where ID_Key=@ID_Key");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DrawNum",      SqlDbType.VarChar, 50),
                new SqlParameter("@ProcessOrder", SqlDbType.VarChar, 50),
                new SqlParameter("@ProcessNum",   SqlDbType.VarChar, 50),
                new SqlParameter("@ProcessName",  SqlDbType.VarChar, 50),
                new SqlParameter("@IsImportant",  SqlDbType.VarChar, 50),
                new SqlParameter("@IsAffirm",     SqlDbType.VarChar, 50),
                new SqlParameter("@Content",      SqlDbType.VarChar, 50),
                new SqlParameter("@Remaks",       SqlDbType.VarChar, 50),
                new SqlParameter("@R1",           SqlDbType.VarChar, 50),
                new SqlParameter("@R2",           SqlDbType.VarChar, 50),
                new SqlParameter("@R3",           SqlDbType.VarChar, 50),
                new SqlParameter("@ID_Key",       SqlDbType.Decimal, 9)
            };
            parameters[0].Value  = model.DrawNum;
            parameters[1].Value  = model.ProcessOrder;
            parameters[2].Value  = model.ProcessNum;
            parameters[3].Value  = model.ProcessName;
            parameters[4].Value  = model.IsImportant;
            parameters[5].Value  = model.IsAffirm;
            parameters[6].Value  = model.Content;
            parameters[7].Value  = model.Remaks;
            parameters[8].Value  = model.R1;
            parameters[9].Value  = model.R2;
            parameters[10].Value = model.R3;
            parameters[11].Value = model.ID_Key;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.e_Flow DataRowToModel(DataRow row)
 {
     Maticsoft.Model.e_Flow model = new Maticsoft.Model.e_Flow();
     if (row != null)
     {
         if (row["DrawNum"] != null)
         {
             model.DrawNum = row["DrawNum"].ToString();
         }
         if (row["ProcessOrder"] != null)
         {
             model.ProcessOrder = row["ProcessOrder"].ToString();
         }
         if (row["ProcessNum"] != null)
         {
             model.ProcessNum = row["ProcessNum"].ToString();
         }
         if (row["ProcessName"] != null)
         {
             model.ProcessName = row["ProcessName"].ToString();
         }
         if (row["IsImportant"] != null)
         {
             model.IsImportant = row["IsImportant"].ToString();
         }
         if (row["IsAffirm"] != null)
         {
             model.IsAffirm = row["IsAffirm"].ToString();
         }
         if (row["Content"] != null)
         {
             model.Content = row["Content"].ToString();
         }
         if (row["Remaks"] != null)
         {
             model.Remaks = row["Remaks"].ToString();
         }
         if (row["R1"] != null)
         {
             model.R1 = row["R1"].ToString();
         }
         if (row["R2"] != null)
         {
             model.R2 = row["R2"].ToString();
         }
         if (row["R3"] != null)
         {
             model.R3 = row["R3"].ToString();
         }
         if (row["ID_Key"] != null && row["ID_Key"].ToString() != "")
         {
             model.ID_Key = decimal.Parse(row["ID_Key"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public decimal Add(Maticsoft.Model.e_Flow model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_e_Flow(");
            strSql.Append("DrawNum,ProcessOrder,ProcessNum,ProcessName,IsImportant,IsAffirm,Content,Remaks,R1,R2,R3)");
            strSql.Append(" values (");
            strSql.Append("@DrawNum,@ProcessOrder,@ProcessNum,@ProcessName,@IsImportant,@IsAffirm,@Content,@Remaks,@R1,@R2,@R3)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DrawNum",      SqlDbType.VarChar, 50),
                new SqlParameter("@ProcessOrder", SqlDbType.VarChar, 50),
                new SqlParameter("@ProcessNum",   SqlDbType.VarChar, 50),
                new SqlParameter("@ProcessName",  SqlDbType.VarChar, 50),
                new SqlParameter("@IsImportant",  SqlDbType.VarChar, 50),
                new SqlParameter("@IsAffirm",     SqlDbType.VarChar, 50),
                new SqlParameter("@Content",      SqlDbType.VarChar, 50),
                new SqlParameter("@Remaks",       SqlDbType.VarChar, 50),
                new SqlParameter("@R1",           SqlDbType.VarChar, 50),
                new SqlParameter("@R2",           SqlDbType.VarChar, 50),
                new SqlParameter("@R3",           SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.DrawNum;
            parameters[1].Value  = model.ProcessOrder;
            parameters[2].Value  = model.ProcessNum;
            parameters[3].Value  = model.ProcessName;
            parameters[4].Value  = model.IsImportant;
            parameters[5].Value  = model.IsAffirm;
            parameters[6].Value  = model.Content;
            parameters[7].Value  = model.Remaks;
            parameters[8].Value  = model.R1;
            parameters[9].Value  = model.R2;
            parameters[10].Value = model.R3;

            object obj = dbs.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToDecimal(obj));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.e_Flow GetModel(decimal ID_Key)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 DrawNum,ProcessOrder,ProcessNum,ProcessName,IsImportant,IsAffirm,Content,Remaks,R1,R2,R3,ID_Key from tb_e_Flow ");
            strSql.Append(" where ID_Key=@ID_Key");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID_Key", SqlDbType.Decimal)
            };
            parameters[0].Value = ID_Key;

            Maticsoft.Model.e_Flow model = new Maticsoft.Model.e_Flow();
            DataSet ds = dbs.Query(strSql.ToString(), parameters);

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