Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.e_Solution model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_e_Solution set ");
            strSql.Append("RejectsNum=@RejectsNum,");
            strSql.Append("Describe=@Describe,");
            strSql.Append("Remarks=@Remarks");
            strSql.Append(" where ID_Key=@ID_Key");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RejectsNum", SqlDbType.VarChar, 50),
                new SqlParameter("@Describe",   SqlDbType.Text),
                new SqlParameter("@Remarks",    SqlDbType.Text),
                new SqlParameter("@ID_Key",     SqlDbType.Decimal, 9)
            };
            parameters[0].Value = model.RejectsNum;
            parameters[1].Value = model.Describe;
            parameters[2].Value = model.Remarks;
            parameters[3].Value = model.ID_Key;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public decimal Add(Maticsoft.Model.e_Solution model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_e_Solution(");
            strSql.Append("RejectsNum,Describe,Remarks)");
            strSql.Append(" values (");
            strSql.Append("@RejectsNum,@Describe,@Remarks)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RejectsNum", SqlDbType.VarChar, 50),
                new SqlParameter("@Describe",   SqlDbType.Text),
                new SqlParameter("@Remarks",    SqlDbType.Text)
            };
            parameters[0].Value = model.RejectsNum;
            parameters[1].Value = model.Describe;
            parameters[2].Value = model.Remarks;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToDecimal(obj));
            }
        }
Пример #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.e_Solution DataRowToModel(DataRow row)
 {
     Maticsoft.Model.e_Solution model = new Maticsoft.Model.e_Solution();
     if (row != null)
     {
         if (row["ID_Key"] != null && row["ID_Key"].ToString() != "")
         {
             model.ID_Key = decimal.Parse(row["ID_Key"].ToString());
         }
         if (row["RejectsNum"] != null)
         {
             model.RejectsNum = row["RejectsNum"].ToString();
         }
         if (row["Describe"] != null)
         {
             model.Describe = row["Describe"].ToString();
         }
         if (row["Remarks"] != null)
         {
             model.Remarks = row["Remarks"].ToString();
         }
     }
     return(model);
 }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.e_Solution GetModel(decimal ID_Key)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID_Key,RejectsNum,Describe,Remarks from tb_e_Solution ");
            strSql.Append(" where ID_Key=@ID_Key");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID_Key", SqlDbType.Decimal)
            };
            parameters[0].Value = ID_Key;

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

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