Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(UserFB.Model.Feedback model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Feedback set ");
            strSql.Append("UserID=@UserID,");
            strSql.Append("feedbackTime=@feedbackTime,");
            strSql.Append("categoryID=@categoryID,");
            strSql.Append("Info=@Info,");
            strSql.Append("contact=@contact,");
            strSql.Append("isInvalid=@isInvalid,");
            strSql.Append("solutionState=@solutionState,");
            strSql.Append("handler=@handler,");
            strSql.Append("remark=@remark");
            strSql.Append(" where feedbackID=@feedbackID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",        SqlDbType.Int,              4),
                new SqlParameter("@feedbackTime",  SqlDbType.SmallDateTime),
                new SqlParameter("@categoryID",    SqlDbType.Int,              4),
                new SqlParameter("@Info",          SqlDbType.VarChar,        128),
                new SqlParameter("@contact",       SqlDbType.VarChar,         64),
                new SqlParameter("@isInvalid",     SqlDbType.VarChar,         16),
                new SqlParameter("@solutionState", SqlDbType.VarChar,         16),
                new SqlParameter("@handler",       SqlDbType.VarChar,         64),
                new SqlParameter("@remark",        SqlDbType.VarChar,         64),
                new SqlParameter("@feedbackID",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.feedbackTime;
            parameters[2].Value = model.categoryID;
            parameters[3].Value = model.Info;
            parameters[4].Value = model.contact;
            parameters[5].Value = model.isInvalid;
            parameters[6].Value = model.solutionState;
            parameters[7].Value = model.handler;
            parameters[8].Value = model.remark;
            parameters[9].Value = model.feedbackID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public UserFB.Model.Feedback DataRowToModel(DataRow row)
 {
     UserFB.Model.Feedback model = new UserFB.Model.Feedback();
     if (row != null)
     {
         if (row["feedbackID"] != null && row["feedbackID"].ToString() != "")
         {
             model.feedbackID = int.Parse(row["feedbackID"].ToString());
         }
         if (row["UserID"] != null && row["UserID"].ToString() != "")
         {
             model.UserID = int.Parse(row["UserID"].ToString());
         }
         if (row["feedbackTime"] != null && row["feedbackTime"].ToString() != "")
         {
             model.feedbackTime = DateTime.Parse(row["feedbackTime"].ToString());
         }
         if (row["categoryID"] != null && row["categoryID"].ToString() != "")
         {
             model.categoryID = int.Parse(row["categoryID"].ToString());
         }
         if (row["Info"] != null)
         {
             model.Info = row["Info"].ToString();
         }
         if (row["contact"] != null)
         {
             model.contact = row["contact"].ToString();
         }
         if (row["isInvalid"] != null)
         {
             model.isInvalid = row["isInvalid"].ToString();
         }
         if (row["solutionState"] != null)
         {
             model.solutionState = row["solutionState"].ToString();
         }
         if (row["handler"] != null)
         {
             model.handler = row["handler"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
     }
     return(model);
 }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(UserFB.Model.Feedback model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Feedback(");
            strSql.Append("UserID,feedbackTime,categoryID,Info,contact,isInvalid,solutionState,handler,remark)");
            strSql.Append(" values (");
            strSql.Append("@UserID,@feedbackTime,@categoryID,@Info,@contact,@isInvalid,@solutionState,@handler,@remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",        SqlDbType.Int,              4),
                new SqlParameter("@feedbackTime",  SqlDbType.SmallDateTime),
                new SqlParameter("@categoryID",    SqlDbType.Int,              4),
                new SqlParameter("@Info",          SqlDbType.VarChar,        128),
                new SqlParameter("@contact",       SqlDbType.VarChar,         64),
                new SqlParameter("@isInvalid",     SqlDbType.VarChar,         16),
                new SqlParameter("@solutionState", SqlDbType.VarChar,         16),
                new SqlParameter("@handler",       SqlDbType.VarChar,         64),
                new SqlParameter("@remark",        SqlDbType.VarChar, 64)
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.feedbackTime;
            parameters[2].Value = model.categoryID;
            parameters[3].Value = model.Info;
            parameters[4].Value = model.contact;
            parameters[5].Value = model.isInvalid;
            parameters[6].Value = model.solutionState;
            parameters[7].Value = model.handler;
            parameters[8].Value = model.remark;

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

            if (obj == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public UserFB.Model.Feedback GetModel(int feedbackID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 feedbackID,UserID,feedbackTime,categoryID,Info,contact,isInvalid,solutionState,handler,remark from Feedback ");
            strSql.Append(" where feedbackID=@feedbackID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@feedbackID", SqlDbType.Int, 4)
            };
            parameters[0].Value = feedbackID;

            UserFB.Model.Feedback model = new UserFB.Model.Feedback();
            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 #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(UserFB.Model.Feedback model)
 {
     return(dal.Update(model));
 }
Exemple #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool   Add(UserFB.Model.Feedback model)
 {
     return(dal.Add(model));
 }