Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request["line_id"] != null)
     {
         TravelAgent.Model.LineConsult consult = new TravelAgent.Model.LineConsult();
         consult.LineId         = Convert.ToInt32(Request["line_id"]);
         consult.LinkEmail      = Request["email"] == null ? "" : Request["email"];
         consult.LinkTel        = Request["phone"];
         consult.ConsultContent = Request["content"];
         consult.ConsultDate    = DateTime.Now;
         try
         {
             if (ConsultBll.Add(consult) > 0)
             {
                 Response.Write("true");
             }
             else
             {
                 Response.Write("false");
             }
         }
         catch
         {
             Response.Write("false");
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TravelAgent.Model.LineConsult GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from LineConsult ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                model.LineId         = int.Parse(ds.Tables[0].Rows[0]["LineId"].ToString());
                model.LinkTel        = ds.Tables[0].Rows[0]["LinkTel"].ToString();
                model.LinkEmail      = ds.Tables[0].Rows[0]["LinkEmail"].ToString();
                model.ConsultContent = ds.Tables[0].Rows[0]["ConsultContent"].ToString();
                model.ConsultDate    = Convert.ToDateTime(ds.Tables[0].Rows[0]["ConsultDate"].ToString());
                model.ReplyContent   = ds.Tables[0].Rows[0]["ReplyContent"].ToString();
                if (!ds.Tables[0].Rows[0]["ReplyUserId"].ToString().Equals(""))
                {
                    model.ReplyUserId = int.Parse(ds.Tables[0].Rows[0]["ReplyUserId"].ToString());
                }
                if (!ds.Tables[0].Rows[0]["ReplyDate"].ToString().Equals(""))
                {
                    model.ReplyDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["ReplyDate"].ToString());
                }

                model.IsReply = int.Parse(ds.Tables[0].Rows[0]["IsReply"].ToString());
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (Request.QueryString["id"] != null)
         {
             id = Convert.ToInt32(Request.QueryString["id"]);
             TravelAgent.Model.LineConsult model = Bll.GetModel(id);
             if (model != null)
             {
                 this.lbldate.Text       = model.ConsultDate.ToString();
                 this.lblZixun.Text      = model.ConsultContent;
                 this.txtContent.Value   = model.ReplyContent;
                 this.chkIsEmail.Enabled = !model.LinkEmail.Equals("");
                 this.chkIsEmail.Checked = !model.LinkEmail.Equals("");
                 this.hfemail.Value      = model.LinkEmail;
                 this.hfquestion.Value   = model.ConsultContent;
             }
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(TravelAgent.Model.LineConsult model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into LineConsult(");
            strSql.Append("LineId,LinkTel,LinkEmail,ConsultContent,ConsultDate)");
            strSql.Append(" values (");
            strSql.Append("@LineId,@LinkTel,@LinkEmail,@ConsultContent,@ConsultDate)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LineId",         SqlDbType.Int),
                new SqlParameter("@LinkTel",        SqlDbType.VarChar),
                new SqlParameter("@LinkEmail",      SqlDbType.VarChar),
                new SqlParameter("@ConsultContent", SqlDbType.VarChar),
                new SqlParameter("@ConsultDate",    SqlDbType.DateTime)
            };
            parameters[0].Value = model.LineId;
            parameters[1].Value = model.LinkTel;
            parameters[2].Value = model.LinkEmail;
            parameters[3].Value = model.ConsultContent;
            parameters[4].Value = model.ConsultDate;
            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TravelAgent.Model.LineConsult model)
 {
     DAL.Add(model);
     return(DAL.GetMaxID("Id"));
 }