コード例 #1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtfeedbackID.Text))
            {
                strErr += "feedbackID格式错误!\\n";
            }
            if (this.txtreplier.Text.Trim().Length == 0)
            {
                strErr += "replier不能为空!\\n";
            }
            if (this.txtreplyText.Text.Trim().Length == 0)
            {
                strErr += "replyText不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtreplyTime.Text))
            {
                strErr += "replyTime格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtnumber.Text))
            {
                strErr += "number格式错误!\\n";
            }
            if (this.txtisRead.Text.Trim().Length == 0)
            {
                strErr += "isRead不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      replyID    = int.Parse(this.lblreplyID.Text);
            int      feedbackID = int.Parse(this.txtfeedbackID.Text);
            string   replier    = this.txtreplier.Text;
            string   replyText  = this.txtreplyText.Text;
            DateTime replyTime  = DateTime.Parse(this.txtreplyTime.Text);
            int      number     = int.Parse(this.txtnumber.Text);
            string   isRead     = this.txtisRead.Text;


            UFB.Model.Reply model = new UFB.Model.Reply();
            model.replyID    = replyID;
            model.feedbackID = feedbackID;
            model.replier    = replier;
            model.replyText  = replyText;
            model.replyTime  = replyTime;
            model.number     = number;
            model.isRead     = isRead;

            UFB.BLL.ReplyManager bll = new UFB.BLL.ReplyManager();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
コード例 #2
0
 private void ShowInfo(int replyID)
 {
     UFB.BLL.ReplyManager bll   = new UFB.BLL.ReplyManager();
     UFB.Model.Reply      model = bll.GetModel(replyID);
     this.lblreplyID.Text    = model.replyID.ToString();
     this.lblfeedbackID.Text = model.feedbackID.ToString();
     this.lblreplier.Text    = model.replier;
     this.lblreplyText.Text  = model.replyText;
     this.lblreplyTime.Text  = model.replyTime.ToString();
     this.lblnumber.Text     = model.number.ToString();
     this.lblisRead.Text     = model.isRead;
 }
コード例 #3
0
ファイル: ReplyService.cs プロジェクト: 303699796/UFB
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(UFB.Model.Reply model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Reply set ");
            strSql.Append("feedbackID=@feedbackID,");
            strSql.Append("replier=@replier,");
            strSql.Append("replyText=@replyText,");
            strSql.Append("replyTime=@replyTime,");
            strSql.Append("number=@number,");
            strSql.Append("isRead=@isRead");
            strSql.Append(" where replyID=@replyID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@feedbackID", SqlDbType.Int,              4),
                new SqlParameter("@replier",    SqlDbType.VarChar,         64),
                new SqlParameter("@replyText",  SqlDbType.VarChar,        128),
                new SqlParameter("@replyTime",  SqlDbType.SmallDateTime),
                new SqlParameter("@number",     SqlDbType.Int,              4),
                new SqlParameter("@isRead",     SqlDbType.VarChar,         16),
                new SqlParameter("@replyID",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.feedbackID;
            parameters[1].Value = model.replier;
            parameters[2].Value = model.replyText;
            parameters[3].Value = model.replyTime;
            parameters[4].Value = model.number;
            parameters[5].Value = model.isRead;
            parameters[6].Value = model.replyID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
ファイル: ReplyService.cs プロジェクト: 303699796/UFB
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(UFB.Model.Reply model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Reply(");
            strSql.Append("feedbackID,replier,replyText,replyTime,number,isRead)");
            strSql.Append(" values (");
            strSql.Append("@feedbackID,@replier,@replyText,@replyTime,@number,@isRead)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@feedbackID", SqlDbType.Int,              4),
                new SqlParameter("@replier",    SqlDbType.VarChar,         64),
                new SqlParameter("@replyText",  SqlDbType.VarChar,        128),
                new SqlParameter("@replyTime",  SqlDbType.SmallDateTime),
                new SqlParameter("@number",     SqlDbType.Int,              4),
                new SqlParameter("@isRead",     SqlDbType.VarChar, 16)
            };
            parameters[0].Value = model.feedbackID;
            parameters[1].Value = model.replier;
            parameters[2].Value = model.replyText;
            parameters[3].Value = model.replyTime;
            parameters[4].Value = model.number;
            parameters[5].Value = model.isRead;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #5
0
ファイル: ReplyService.cs プロジェクト: 303699796/UFB
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public UFB.Model.Reply DataRowToModel(DataRow row)
 {
     UFB.Model.Reply model = new UFB.Model.Reply();
     if (row != null)
     {
         if (row["replyID"] != null && row["replyID"].ToString() != "")
         {
             model.replyID = int.Parse(row["replyID"].ToString());
         }
         if (row["feedbackID"] != null && row["feedbackID"].ToString() != "")
         {
             model.feedbackID = int.Parse(row["feedbackID"].ToString());
         }
         if (row["replier"] != null)
         {
             model.replier = row["replier"].ToString();
         }
         if (row["replyText"] != null)
         {
             model.replyText = row["replyText"].ToString();
         }
         if (row["replyTime"] != null && row["replyTime"].ToString() != "")
         {
             model.replyTime = DateTime.Parse(row["replyTime"].ToString());
         }
         if (row["number"] != null && row["number"].ToString() != "")
         {
             model.number = int.Parse(row["number"].ToString());
         }
         if (row["isRead"] != null)
         {
             model.isRead = row["isRead"].ToString();
         }
     }
     return(model);
 }
コード例 #6
0
ファイル: ReplyService.cs プロジェクト: 303699796/UFB
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public UFB.Model.Reply GetModel(int replyID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 replyID,feedbackID,replier,replyText,replyTime,number,isRead from Reply ");
            strSql.Append(" where replyID=@replyID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@replyID", SqlDbType.Int, 4)
            };
            parameters[0].Value = replyID;

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

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