public ProductConsultQuery GetProductInfo(ProductConsultQuery query)
        {
            try
            {
                return _productConsultImplDao.GetProductInfo(query);
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultMgr-->UpdateActive-->" + ex.Message, ex);
            }
        }
        /// <summary>
        /// 更改回覆狀態
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdateAnswerStatus(ProductConsultQuery model)
        {
            try
            {
                return _productConsultImplDao.UpdateAnswerStatus(model);
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultMgr-->UpdateAnswerStatus-->" + ex.Message, ex);
            }
        }
        public List<ProductConsultQuery> Query(ProductConsultQuery store, out int totalCount)
        {
            try
            {
                return _productConsultImplDao.Query(store, out totalCount);
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultMgr-->Query-->" + ex.Message, ex);
            }
        }
        public int SaveProductConsultAnswer(ProductConsultQuery query)
        {
            try
            {
                return _productConsultImplDao.SaveProductConsultAnswer(query);
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultMgr-->SaveProductConsultAnswer-->" + ex.Message, ex);
            }
        }
        /// <summary>
        /// 商品咨詢列表查詢
        /// </summary>
        /// <param name="store"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public List<ProductConsultQuery> Query(ProductConsultQuery store, out int totalCount)
        {
            StringBuilder strSql = new StringBuilder();
            StringBuilder strCondition = new StringBuilder();
            StringBuilder strSelect = new StringBuilder();
            StringBuilder strTemp = new StringBuilder();
            try
            {
                store.Replace4MySQL();
                totalCount = 0;
                strSelect.AppendFormat("select pc.consult_id,pc.product_id,p.product_name,mu.user_username as manage_name,pc.user_id,uc.user_email,uc.user_name,pc.consult_info,tp.parameterName,pc.consult_type,pc.consult_answer,pc.is_sendEmail,pc.create_date,pc.answer_date,pc.answer_user,pc.status,pc.consult_url,pc.product_url,pc.item_id,pc.answer_status,pc.delay_reason,p.prod_classify  ");
                strCondition.AppendFormat(" from product_consult pc left join product p on p.product_id=pc.product_id left join users uc on uc.user_id=pc.user_id ");
                strCondition.AppendFormat(" left join  (SELECT parameterName,parameterCode,parameterType from t_parametersrc where parameterType='consultType' ) tp on pc.consult_type=tp.parameterCode ");
                strCondition.AppendFormat(" left join manage_user mu on mu.user_id=pc.answer_user  ");
                strCondition.AppendFormat(" where 1=1 ");
                if (store.answer_status != 0)
                {
                    strCondition.AppendFormat(" and answer_status={0}  ", store.answer_status);
                }
                if (store.consult_id != 0)
                {
                    strCondition.AppendFormat(" and pc.consult_id ={0} ", store.consult_id);
                }
                if (store.huifu ==1)
                {
                    strCondition.AppendFormat(" and status={0}  ", 1);
                }
                if (store.huifu == 2)
                {
                    strCondition.AppendFormat(" and status={0}  ", 0);
                }
                if (store.product_name != "")
                {
                    strCondition.AppendFormat(" and p.product_name like '%{0}%'", store.product_name);
                }
              
                if (store.product_id != 0)
                {
                    strCondition.AppendFormat(" and p.product_id ={0} ", store.product_id);
                }
                if (store.consultType != "")
                {
                    strCondition.AppendFormat(" and pc.consult_type in ({0}) ", store.consultType);
                }
                if (store.user_email != "")
                {
                    strCondition.AppendFormat(" and  uc.user_email like '%{0}%' ", store.user_email);
                }
                if (store.user_name != "")
                {
                    strCondition.AppendFormat(" and  uc.user_name like '%{0}%' ", store.user_name);
                }
                if (store.productIds != "")
                {
                    strCondition.AppendFormat(" and p.prod_classify ={0} ", store.productIds);
                }
                if (store.beginTime != DateTime.MinValue)
                {
                    strCondition.AppendFormat(" and pc.create_date>='{0}' ", store.beginTime.ToString("yyyy-MM-dd HH:mm:ss"));
                }
                if (store.endTime != DateTime.MinValue)
                {
                    strCondition.AppendFormat(" and pc.create_date<='{0}' ", store.endTime.ToString("yyyy-MM-dd HH:mm:ss"));
                }
                StringBuilder strTotalCount = new StringBuilder(" select count(pc.consult_id) as totalCount ");
                if (store.IsPage)
                {
                    strSql.AppendFormat(strTotalCount.ToString());
                    strSql.AppendFormat(strCondition.ToString());
                    System.Data.DataTable _dt = _access.getDataTable(strSql.ToString());
                    if (_dt != null && _dt.Rows.Count > 0)
                    {
                        totalCount = Convert.ToInt32(_dt.Rows[0]["totalCount"]);
                    }

                    strSql.AppendFormat(";");
                    strCondition.AppendFormat(" order by pc.consult_id desc ");
                }
                strTemp.AppendFormat(strSelect.ToString());
                strTemp.AppendFormat(strCondition.ToString());
                strTemp.AppendFormat(" limit {0},{1}", store.Start, store.Limit);
                strTemp.AppendFormat(";");
                strSql.AppendFormat(strTemp.ToString());
                return _access.getDataTableForObj<ProductConsultQuery>(strTemp.ToString());
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultDao-->Query-->" + ex.Message + strSql.ToString(), ex);
            }
        }
        /// <summary>
        /// 查詢郵件群組的編號
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public DataTable QueryMailGroup(ProductConsultQuery query)
        {
            try
            {
                return _productConsultImplDao.QueryMailGroup(query);
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultMgr-->QueryMailGroup-->" + ex.Message, ex);
            }
        }
        /// <summary>
        /// 更改諮詢類型
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdateConsultType(ProductConsultQuery model)
        {
            string strSql = string.Empty;
            try
            {
                strSql = string.Format("set sql_safe_updates = 0; update product_consult set consult_type='{0}' where consult_id='{1}'; set sql_safe_updates = 1;", model.consult_type, model.consult_id);
                return _access.execCommand(strSql);
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultDao-->UpdateConsultType-->" + ex.Message + strSql, ex);
            }
        }
        /// <summary>
        /// 查詢郵件群組的編號
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public DataTable QueryMailGroup(ProductConsultQuery query)
        {
            StringBuilder strSql = new StringBuilder();
            try
            {
                strSql.AppendFormat("select row_id from mail_group where group_code='{0}'", query.group_code);
                return _access.getDataTable(strSql.ToString());
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultDao-->QueryMailGroup-->" + ex.Message + strSql.ToString(), ex);
            }
        }
        /// <summary>
        /// 回覆咨詢
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public int SaveProductConsultAnswer(ProductConsultQuery query)
        {
            StringBuilder strSql = new StringBuilder();
            try
            {
                query.Replace4MySQL();
                strSql.AppendFormat("set sql_safe_updates = 0; update product_consult set answer_date='{0}',consult_answer='{1}',answer_user='******',answer_status='{3}',status='{4}',is_sendEmail='{5}' where consult_id='{6}'; set sql_safe_updates = 1;", query.answer_date.ToString("yyyy-MM-dd HH:mm:ss"), query.consult_answer, query.answer_user, query.answer_status, query.status,query.is_sendEmail, query.consult_id);
                return _access.execCommand(strSql.ToString());
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultDao-->SaveProductConsultAnswer-->" + ex.Message + strSql.ToString(), ex);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 更改回覆狀態
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdateAnswerStatus(ProductConsultQuery model)
        {
            string strSql = string.Empty;
            try
            {
                strSql = string.Format("set sql_safe_updates = 0; update product_consult set answer_status='{0}',answer_user='******',delay_reason='{2}' where consult_id='{3}'; set sql_safe_updates = 1;", model.answer_status, model.answer_user, model.delay_reason, model.consult_id);
                return _access.execCommand(strSql);
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultDao-->UpdateAnswerStatus-->" + ex.Message + strSql, ex);
            }
        }
Beispiel #11
0
        /// <summary>
        /// 查詢商品信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ProductConsultQuery GetProductInfo(ProductConsultQuery query)
        {
            StringBuilder strSql = new StringBuilder();
            try
            {
                if (query.item_id == 0)
                {
                    strSql.AppendFormat("SELECT vb.brand_name,p.product_name,p.product_image,pm.price ,pm.event_price ,pm.event_start,pm.event_end FROM price_master pm LEFT JOIN product p ON pm.product_id=p.product_id LEFT JOIN vendor_brand vb on vb.brand_id=p.brand_id  WHERE pm.product_id ='{0}' AND pm.site_id = 1 AND (pm.child_id = pm.product_id or pm.child_id = 0)AND pm.user_level = 1", query.product_id);
                }
                else
                {
                    strSql.AppendFormat("SELECT vb.brand_name,p.product_name,ps1.spec_name as spec_name1,ps2.spec_name as spec_name2,ps1.spec_image as product_image1,ps2.spec_image as product_image2,p.product_image,ip.item_money,ip.event_money,pm.event_start,pm.event_end  FROM product_item pit LEFT JOIN product p ON pit.product_id = p.product_id LEFT JOIN product_spec ps1 on ps1.spec_id=pit.spec_id_1 LEFT JOIN product_spec ps2 on ps2.spec_id=pit.spec_id_2 LEFT JOIN price_master pm ON p.product_id = pm.product_id LEFT JOIN item_price ip ON ip.price_master_id = pm.price_master_id LEFT JOIN vendor_brand vb on vb.brand_id=p.brand_id WHERE 1=1 AND pm.price_status = 1 AND pit.item_id = {0} AND pm.site_id = 1 AND pm.user_level = 1 AND ip.price_master_id = pm.price_master_id AND ip.item_id = {0} and p.product_id={1}", query.item_id, query.product_id);
                }
                return _access.getSinggleObj<ProductConsultQuery>(strSql.ToString());
            }
            catch (Exception ex)
            {

                throw new Exception("ProductConsultDao-->GetProductInfo-->" + ex.Message + strSql.ToString(), ex);
            }
        }
        public HttpResponseBase GetProductConsultList()
        {
            List<ProductConsultQuery> store = new List<ProductConsultQuery>();
            string json = string.Empty;
            string str = string.Empty;
            try
            {
                ProductConsultQuery query = new ProductConsultQuery();
                _productconsultMgr = new ProductConsultMgr(mySqlConnectionString);
                query.Start = Convert.ToInt32(Request["Start"] ?? "0");
                if (!string.IsNullOrEmpty(Request["Limit"]))
                {
                    query.Limit = Convert.ToInt32(Request["Limit"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["ddlSel"]))
                {
                    query.answer_status = Convert.ToInt32(Request.Params["ddlSel"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["huifu"]))
                {
                    query.huifu = Convert.ToInt32(Request.Params["huifu"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["productName"]))
                {
                    query.product_name = Request.Params["productName"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["productId"]))
                {
                    query.product_id = Convert.ToUInt32(Request.Params["productId"]);
                }
                if (Convert.ToBoolean(Request.Params["consultType1"]))
                {
                    query.consultType += "1,";
                }
                if (Convert.ToBoolean(Request.Params["consultType2"]))
                {
                    query.consultType += "2,";
                }
                if (Convert.ToBoolean(Request.Params["consultType3"]))
                {
                    query.consultType += "3,";
                }
                if (Convert.ToBoolean(Request.Params["consultType4"]))
                {
                    query.consultType += "4,";
                }
                if (Convert.ToBoolean(Request.Params["consultType5"]))
                {
                    query.consultType += "5,";
                }
                if (query.consultType != "")
                {
                    query.consultType = query.consultType.Remove(query.consultType.LastIndexOf(","));
                }
                if (!string.IsNullOrEmpty(Request.Params["userName"]))
                {
                    query.user_name = Request.Params["userName"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["userEmail"]))
                {
                    query.user_email = Request.Params["userEmail"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["timestart"]))
                {
                    query.beginTime = Convert.ToDateTime(Convert.ToDateTime(Request.Params["timestart"]).ToString("yyyy-MM-dd HH:mm:ss"));
                }
                if (!string.IsNullOrEmpty(Request.Params["timeend"]))
                {
                    query.endTime = Convert.ToDateTime(Convert.ToDateTime(Request.Params["timeend"]).ToString("yyyy-MM-dd HH:mm:ss"));
                }
                if (Convert.ToBoolean(Request.Params["shopClass1"]) && Convert.ToBoolean(Request.Params["shopClass2"]))
                {

                }
                else
                {
                    if (Convert.ToBoolean(Request.Params["shopClass1"]))
                    {

                        query.productIds = "10";//食品館
                    }
                    if (Convert.ToBoolean(Request.Params["shopClass2"]))
                    {

                        query.productIds = "20";//用品館
                    }
                }
                if (!string.IsNullOrEmpty(Request.Params["relation_id"]))//待回覆
                {
                    query.consult_id = Convert.ToInt32(Request.Params["relation_id"]);
                }
                int totalCount = 0;
                store = _productconsultMgr.Query(query, out totalCount);
                if (Convert.ToBoolean(Request.Params["isSecret"]))
                {
                    foreach (var item in store)
                    {
                        if (!string.IsNullOrEmpty(item.user_name))
                        {
                            item.user_name = item.user_name.Substring(0, 1) + "**";
                        }
                        item.user_email = item.user_email.Split('@')[0] + "@***";
                    }
                }
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回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:true,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase SaveProductConsultAnswer()
        {
            string path = Server.MapPath(xmlPath);
            SiteConfigMgr _siteConfigMgr = new SiteConfigMgr(path);
            SiteConfig Mail_From = _siteConfigMgr.GetConfigByName("Mail_From");
            SiteConfig Mail_Host = _siteConfigMgr.GetConfigByName("Mail_Host");
            SiteConfig Mail_Port = _siteConfigMgr.GetConfigByName("Mail_Port");
            SiteConfig Mail_UserName = _siteConfigMgr.GetConfigByName("Mail_UserName");
            SiteConfig Mail_UserPasswd = _siteConfigMgr.GetConfigByName("Mail_UserPasswd");
            string EmailFrom = Mail_From.Value;//發件人郵箱
            string SmtpHost = Mail_Host.Value;//smtp服务器
            string SmtpPort = Mail_Port.Value;//smtp服务器端口
            string EmailUserName = Mail_UserName.Value;//郵箱登陸名
            string EmailPassWord = Mail_UserPasswd.Value;//郵箱登陸密碼
            string json = string.Empty;
            string jsonStr = string.Empty;
            ProductConsultQuery query = new ProductConsultQuery();
            IAreaPactetImplMgr _iareaPacketMgr = new AreaPacketMgr(mySqlConnectionString);
            _productconsultMgr = new ProductConsultMgr(mySqlConnectionString);
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["consult_id"]))
                {
                    query.consult_id = Convert.ToInt32(Request.Params["consult_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["answer_status"]))
                {
                    if (Convert.ToInt32(Request.Params["answer_status"]) == 2)
                    {
                        query.answer_status = 2;
                        query.answer_user = ((Caller)Session["caller"]).user_id;
                        query.delay_reason = Request.Params["delay_reason"].ToString();
                        _productconsultMgr.UpdateAnswerStatus(query);

                        json = "{success:true}";
                    }
                    
                    else
                    {
                        query.answer_status = 3;
                        if (!string.IsNullOrEmpty(Request.Params["status"]))
                        {
                            query.status = Convert.ToInt32(Request.Params["status"]);
                        }
                        if (!string.IsNullOrEmpty(Request.Params["is_sendEmail"]))
                        {
                            query.is_sendEmail = Convert.ToInt32(Request.Params["is_sendEmail"]);
                        }
                        if (!string.IsNullOrEmpty(Request.Params["consult_answer"]))
                        {
                            query.consult_answer = Request.Params["consult_answer"].ToString();
                        }
                        query.answer_date = DateTime.Now;
                        query.answer_user = ((Caller)Session["caller"]).user_id;
                        int i = _productconsultMgr.SaveProductConsultAnswer(query);
                        if (!string.IsNullOrEmpty(Request.Params["is_sendEmail"]))
                        {
                            int j = Convert.ToInt32(Request.Params["is_sendEmail"]);
                            if (j == 1 && i > 0)
                            {
                                string userName = string.Empty;
                                string product_name = string.Empty;
                                string consultInfo = string.Empty;
                                string answerInfo = string.Empty;
                                string consultUrl = string.Empty;
                                string productUrl = string.Empty;
                                string userEmail = string.Empty;
                                if (!string.IsNullOrEmpty(Request.Params["user_name"]))
                                {
                                    userName = Request.Params["user_name"].ToString();
                                }
                                if (!string.IsNullOrEmpty(Request.Params["user_email"]))
                                {
                                    userEmail = Request.Params["user_email"].ToString();
                                }
                                if (!string.IsNullOrEmpty(Request.Params["consult_info"]))
                                {
                                    consultInfo = Request.Params["consult_info"].ToString();
                                }
                                if (!string.IsNullOrEmpty(Request.Params["consult_answer"]))
                                {
                                    answerInfo = Request.Params["consult_answer"].ToString();
                                }
                                if (!string.IsNullOrEmpty(Request.Params["product_url"]))
                                {
                                    productUrl = Request.Params["product_url"].ToString();
                                }
                                if (!string.IsNullOrEmpty(Request.Params["product_id"]))
                                {
                                    query.product_id = Convert.ToUInt32(Request.Params["product_id"]);
                                }
                                if (!string.IsNullOrEmpty(Request.Params["consult_url"]))
                                {
                                    consultUrl = Request.Params["consult_url"].ToString();
                                }
                                if (!string.IsNullOrEmpty(Request.Params["item_id"]))
                                {
                                    query.item_id = Convert.ToInt32(Request.Params["item_id"].ToString());
                                }

                                ProductConsultQuery queryTemp = _productconsultMgr.GetProductInfo(query);
                                FileStream fs = new FileStream(Server.MapPath("../ImportUserIOExcel/productConsultAnwser.html"), FileMode.OpenOrCreate, FileAccess.Read);
                                StreamReader sr = new StreamReader(fs, Encoding.UTF8);
                                string strTemp = sr.ReadToEnd();
                                sr.Close();
                                fs.Close();
                                //if (queryTemp.spec_name1 == "" && queryTemp.spec_name2 == "")
                                //{
                                //    product_name = queryTemp.brand_name + queryTemp.product_name;
                                //}
                                //else
                                //{
                                //    product_name = queryTemp.brand_name + queryTemp.product_name + "(" + queryTemp.spec_name1 + "  " + queryTemp.spec_name2 + ")";
                                //}
                                product_name = queryTemp.product_name;
                                strTemp = strTemp.Replace("{{$username$}}", userName);
                                strTemp = strTemp.Replace("{{$productName$}}", product_name);
                                strTemp = strTemp.Replace("{{$consultInfo$}}", consultInfo);
                                strTemp = strTemp.Replace("{{$consultAnwser$}}", answerInfo);
                                strTemp = strTemp.Replace("{{$productUrl$}}", productUrl);
                                sendmail(EmailFrom, FromName, userEmail, userName, EmailTile, strTemp, "", SmtpHost, Convert.ToInt32(SmtpPort), EmailUserName, EmailPassWord);
                            }
                        }

                        if (i > 0)
                        {
                            json = "{success:true}";
                        }
                    }
                }
            }
            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:true,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
        /// <summary>
        /// 更改活動使用狀態
        /// </summary>
        /// <returns>數據庫操作結果</returns>
        public JsonResult UpdateActive()
        {
            string jsonStr = string.Empty;
            try
            {
                ProductConsultQuery model = new ProductConsultQuery();
                if (!string.IsNullOrEmpty(Request.Params["active"]))
                {
                    model.status = Convert.ToInt32(Request.Params["active"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["id"]))
                {
                    model.consult_id = Convert.ToInt32(Request.Params["id"]);
                }
                _productconsultMgr = new ProductConsultMgr(mySqlConnectionString);
                if (_productconsultMgr.UpdateActive(model) > 0)
                {
                    return Json(new { success = "true" });
                }
                else
                {
                    return Json(new { success = "false" });
                }

            }
            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);
                return Json(new { success = "false" });
            }
        }
        public HttpResponseBase SendMailByGroup()
        {
            string path = Server.MapPath(xmlPath);
            SiteConfigMgr _siteConfigMgr = new SiteConfigMgr(path);
            SiteConfig Food_Product_Consult = _siteConfigMgr.GetConfigByName("Food_Product_Consult");
            SiteConfig Use_Product_Consult = _siteConfigMgr.GetConfigByName("Use_Product_Consult");
            SiteConfig Other_Product_Consult = _siteConfigMgr.GetConfigByName("Other_Product_Consult");
            string jsonStr = String.Empty;
            ProductConsultQuery query = new ProductConsultQuery();
            _productconsultMgr = new ProductConsultMgr(mySqlConnectionString);
            try
            {
                if (!string.IsNullOrEmpty(Request["zixunType"]))
                {
                    query.consult_type = Convert.ToInt32(Request["zixunType"]);
                }
                switch (query.consult_type)
                {
                    case 1:
                        query.consultType = "商品諮詢";
                        break;
                    case 2:
                        query.consultType = "庫存及配送";
                        break;
                    case 3:
                        query.consultType = "支付問題";
                        break;
                    case 4:
                        query.consultType = "發票及保修";
                        break;
                    case 5:
                        query.consultType = "促銷及贈品";
                        break;
                }
                if (!string.IsNullOrEmpty(Request.Params["ckShopClass"]))
                {
                    query.ckShopClass = Request.Params["ckShopClass"].ToString();
                }
                if (!string.IsNullOrEmpty(Request["consult_id"]))
                {
                    query.consult_id = Convert.ToInt32(Request["consult_id"]);
                }
                if (!string.IsNullOrEmpty(Request["consult_info"]))
                {
                    query.consult_info = Request["consult_info"].ToString();
                }
                if (!string.IsNullOrEmpty(Request["user_name"]))
                {
                    query.user_name = Request["user_name"].ToString();
                }
                if (!string.IsNullOrEmpty(Request["create_date"]))
                {
                    query.create_date = Convert.ToDateTime(Request["create_date"]);
                }
                FileStream fs = new FileStream(Server.MapPath("../ImportUserIOExcel/productConsultKeFu.html"), FileMode.OpenOrCreate, FileAccess.Read);
                StreamReader sr = new StreamReader(fs, Encoding.UTF8);
                string strTemp = sr.ReadToEnd();
                sr.Close();
                fs.Close();
                strTemp = strTemp.Replace("{{$s_username$}}", query.user_name);
                strTemp = strTemp.Replace("{{$s_datetime$}}", query.create_date.ToString());
                strTemp = strTemp.Replace("{{$consultInfo$}}", query.consult_info);
                strTemp = strTemp.Replace("{{$consultType$}}", query.consultType);
                if (query.ckShopClass == "ckShopClass1" && query.consult_type == 1)//食品館商品諮詢
                {
                    query.group_code = Food_Product_Consult.Value.ToString();
                }
                if (query.ckShopClass == "ckShopClass2" && query.consult_type == 1)//用品館商品諮詢
                {
                    query.group_code = Use_Product_Consult.Value.ToString();
                }
                if (query.consult_type != 1)//其他諮詢類型問題
                {
                    query.group_code = Other_Product_Consult.Value.ToString();
                }
                int i = _productconsultMgr.UpdateConsultType(query);
                if (i > 0)
                {
                    DataTable dt = _productconsultMgr.QueryMailGroup(query);
                    MailHelper mHelper = new MailHelper();
                    if (dt.Rows.Count > 0)
                    {
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            if (!string.IsNullOrEmpty(dt.Rows[j]["row_id"].ToString()))
                            {
                                mHelper.SendToGroup(Convert.ToInt32(dt.Rows[j]["row_id"]), "吉甲地市集【商品諮詢】通知信", strTemp.ToString(), true, true);
                            }
                        }
                    }
                }
                jsonStr = "{success:true }";
            }
            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);
                jsonStr = "{success:false}";
            }


            this.Response.Clear();
            this.Response.Write(jsonStr.ToString());
            this.Response.End();
            return this.Response;

        }