Exemplo n.º 1
0
 public HttpResponseBase OrderQuestionSave()
 {
     OrderQuestion query = new OrderQuestion();
     _IOrderQuesMgr = new OrderQuestionMgr(mySqlConnectionString);
     string json = string.Empty;
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["orderid"]))
         {
             query.order_id = uint.Parse(Request.Params["orderid"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["questiontype"]))
         {
             query.question_type = uint.Parse(Request.Params["questiontype"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["name"]))
         {
             query.question_username = Request.Params["name"].ToString();
         }
         if (!string.IsNullOrEmpty(Request.Params["email_id"]))
         {
             query.question_email = Request.Params["email_id"].ToString();
         }
         if (!string.IsNullOrEmpty(Request.Params["linkphone"]))
         {
             query.question_phone = Request.Params["linkphone"].ToString();
         }
         if (!string.IsNullOrEmpty(Request.Params["content"]))
         {
             query.question_content = Request.Params["content"].ToString();
         }
         //回復方式
         bool reply1 = false;
         bool reply2 = false;
         bool reply3 = false;
         if (!string.IsNullOrEmpty(Request.Params["reply1"]))
         {
             reply1 = Convert.ToBoolean(Request.Params["reply1"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["reply2"]))
         {
             reply2 = Convert.ToBoolean(Request.Params["reply2"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["reply3"]))
         {
             reply3 = Convert.ToBoolean(Request.Params["reply3"]);
         }
         if (reply3)
         {
             if (!string.IsNullOrEmpty(Request.Params["ddlstatus"]))
             {
                 query.question_reply_time = int.Parse(Request.Params["ddlstatus"]);
             }
             else
             {
                 query.question_reply_time = 4;
             }
         }
         else
         {
             query.question_reply_time = 0;
         }
         if (reply1)
         {
             query.question_reply = query.question_reply + "1|";
             if (reply2)
             {
                 query.question_reply = query.question_reply + "1|";
                 if (reply3)
                 {
                     query.question_reply = query.question_reply + "1";
                 }
                 else
                 {
                     query.question_reply = query.question_reply + "0";
                 }
             }
             else
             {
                 query.question_reply = query.question_reply + "0|";
                 if (reply3)
                 {
                     query.question_reply = query.question_reply + "1";
                 }
                 else
                 {
                     query.question_reply = query.question_reply + "0";
                 }
             }
         }
         else
         {
             query.question_reply = query.question_reply + "0|";
             if (reply2)
             {
                 query.question_reply = query.question_reply + "1|";
                 if (reply3)
                 {
                     query.question_reply = query.question_reply + "1";
                 }
                 else
                 {
                     query.question_reply = query.question_reply + "0";
                 }
             }
             else
             {
                 query.question_reply = query.question_reply + "0|";
                 if (reply3)
                 {//當電話被選擇時在判斷在什麼時間段
                     query.question_reply = query.question_reply + "1";
                 }
                 else
                 {
                     query.question_reply = query.question_reply + "0";
                 }
             }
         }
         //System.Net.IPAddress[] addlist = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList;
         //query.question_ipfrom = addlist[0].ToString();
         query.question_ipfrom = CommonFunction.GetIP4Address(Request.UserHostAddress.ToString());
         query.question_status = 0;
         DateTime createdate = DateTime.Now;
         query.question_createdate = uint.Parse(CommonFunction.GetPHPTime(createdate.ToString()).ToString());
         _IOrderQuesMgr.InsertOrderQuestion(query);
         json = "{success:true}";//返回json數據
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         json = "{success:false}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Exemplo n.º 2
0
 /// <summary>
 /// 新增訂單問題
 /// </summary>
 /// <param name="query">新增的數據</param>
 /// <returns></returns>
 public int InsertOrderQuestion(OrderQuestion query)
 {
     try
     {
         return _oqdao.InsertOrderQuestion(query);
     }
     catch (Exception ex)
     {
         throw new Exception("OrderQuestionMgr-->InsertOrderQuestion-->" + ex.Message, ex);
     }
 }