Esempio n. 1
0
 public JsonResult QueryConfig()
 {
     List<SiteConfig> configs = new List<SiteConfig>();
     try
     {
         string path = Server.MapPath(xmlPath);
         if (System.IO.File.Exists(path))
         {
             siteConfigMgr = new SiteConfigMgr(path);
             configs = siteConfigMgr.Query();
         }
     }
     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(configs);
 }
        /// <summary>
        /// 暫時不能確定
        /// </summary>
        /// <returns>返回一個xml的字符串</returns>
        public HttpResponseBase ProductItemUpdateNotice()
        {
            string msg = string.Empty;
            try
            {
                _paraMgr = new ParameterMgr(connectionString);
                _siteConfigMgr = new SiteConfigMgr(Server.MapPath(xmlPath));

                string from = string.Empty, to = string.Empty, sendtime = string.Empty, status = string.Empty, host = string.Empty, username = string.Empty, userpasswd = string.Empty, mailport = string.Empty;

                List<SiteConfig> configList = _siteConfigMgr.Query();
                if (configList.Count() > 0)
                {
                    from = configList.Where(m => m.Name.Equals("Mail_From")).FirstOrDefault().Value;
                    host = configList.Where(m => m.Name.Equals("Mail_Host")).FirstOrDefault().Value;
                    username = configList.Where(m => m.Name.Equals("Mail_UserName")).FirstOrDefault().Value;
                    userpasswd = configList.Where(m => m.Name.Equals("Mail_UserPasswd")).FirstOrDefault().Value;
                    mailport = configList.Where(m => m.Name.Equals("Mail_Port")).FirstOrDefault().Value;
                }

                string subject = Resources.VendorProduct.PRODUCT_UPDATE_MAIL_SUBJECT_CHANAL;//外站商品對照異動通知 add by hufeng0813w 2014/07/07
                string body = QueryHistory(1);//為商品對照異動.根據商品對照表中存在的就發送沒有的就不發送
                if (body == "") status = "2";
                StringBuilder strXml = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?><mail>");
                strXml.AppendFormat("<status>{0}</status>", status);//0 關閉 ,1 正常, 2 無資料,3 服務器異常
                strXml.AppendFormat("<mailfrom>{0}</mailfrom>", from);
                strXml.AppendFormat("<mailsubject>{0}</mailsubject>", subject);
                strXml.AppendFormat("<mailhost>{0}</mailhost>", host);
                strXml.AppendFormat("<mailusername>{0}</mailusername>", username);
                strXml.AppendFormat("<mailuserpasswd>{0}</mailuserpasswd>", userpasswd);
                strXml.AppendFormat("<mailport>{0}</mailport>", mailport);
                strXml.AppendFormat("<mailbody>{0}</mailbody>", HttpUtility.HtmlEncode(body));
                strXml.Append("</mail>");
                msg = strXml.ToString();
            }
            catch (Exception)
            {
                msg = "<mail><status>3</status></mail>";
            }
            this.Response.Clear();
            this.Response.Write(msg);
            this.Response.End();
            return this.Response;
        }
        public HttpResponseBase CheckStockAlarm()
        {
            _viewAlarmMgr = new ViewCheckAlarmMgr(connectionString);
            _paraMgr = new ParameterMgr(connectionString);
            _siteConfigMgr = new SiteConfigMgr(Server.MapPath(xmlPath));
            string msg = string.Empty;
            try
            {
                string from = string.Empty, status = string.Empty, host = string.Empty, username = string.Empty, userpasswd = string.Empty, mailport = string.Empty;

                //讀取XML中有關通知參數
                List<SiteConfig> configList = _siteConfigMgr.Query();
                if (configList.Count() > 0)
                {
                    from = configList.Where(m => m.Name.Equals("Mail_From")).FirstOrDefault().Value;
                    host = configList.Where(m => m.Name.Equals("Mail_Host")).FirstOrDefault().Value;
                    username = configList.Where(m => m.Name.Equals("Mail_UserName")).FirstOrDefault().Value;
                    userpasswd = configList.Where(m => m.Name.Equals("Mail_UserPasswd")).FirstOrDefault().Value;
                    mailport = configList.Where(m => m.Name.Equals("Mail_Port")).FirstOrDefault().Value;
                }


                string subject = Resources.VendorProduct.MAIL_SUBJECT;
                string body = _viewAlarmMgr.QueryStockAlarm();
                if (body == "") status = "2";
                StringBuilder strXml = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?><mail>");
                strXml.AppendFormat("<status>{0}</status>", status);//0 關閉,1 正常, 2 無資料,3 服務器異常
                strXml.AppendFormat("<mailfrom>{0}</mailfrom>", from);
                strXml.AppendFormat("<mailsubject>{0}</mailsubject>", subject);
                strXml.AppendFormat("<mailhost>{0}</mailhost>", host);
                strXml.AppendFormat("<mailusername>{0}</mailusername>", username);
                strXml.AppendFormat("<mailuserpasswd>{0}</mailuserpasswd>", userpasswd);
                strXml.AppendFormat("<mailport>{0}</mailport>", mailport);
                strXml.AppendFormat("<mailbody>{0}</mailbody>", HttpUtility.HtmlEncode(body));
                strXml.Append("</mail>");
                msg = strXml.ToString();
            }
            catch (Exception)
            {
                msg = "<mail><status>3</status></mail>";
            }

            this.Response.Clear();
            this.Response.Write(msg);
            this.Response.End();
            return this.Response;
        }
 public HttpResponseBase ProductPreview()
 {
     _siteConfigMgr = new SiteConfigMgr(Server.MapPath(xmlPath));
     _pMaster = new PriceMasterMgr(connectionString);
     List<SiteConfig> configList = _siteConfigMgr.Query();
     PriceMaster Pm = new PriceMaster();
     BLL.gigade.Common.HashEncrypt hash = new BLL.gigade.Common.HashEncrypt();
     string DomainName = configList.Where(m => m.Name.Equals("DoMain_Name")).FirstOrDefault().Value;
     string json = string.Empty;
     try
     {
         if (!string.IsNullOrEmpty(Request.Form["Product_Id"]))//商品ID
         {
             string type = Request.Form["Type"];
             string product_id = Request.Form["Product_Id"].ToString();
             string site_id = Request.Form["Site_Id"] == null ? "" : Request.Form["Site_Id"].ToString();
             string user_level = Request.Form["Level"] == null ? "" : Request.Form["Level"].ToString();
             string user_id = Request.Form["Master_User_Id"] == null ? "" : Request.Form["Master_User_Id"].ToString();
             string result = "";
             if (type == "0")
             {
                 result += "http://" + DomainName + "/product.php?pid=" + product_id + "&view=" + DateTime.Now.ToString("yyyyMMdd");//商品預覽
             }
             if (type == "1")
             {
                 //商品預覽+價格頁面
                 result += "http://" + DomainName + "/product.php?pid=" + product_id + "&view=" + DateTime.Now.ToString("yyyyMMdd") + "&sid=" + site_id + "&ulv=" + user_level + "&uid=" + user_id + "&view=" + DateTime.Now.ToString("yyyyMMdd");
                 result += "|";
                 result += "http://" + DomainName + "/product.php?pid=" + product_id + "&sid=" + site_id + "&code=" + hash.Md5Encrypt(product_id + "&sid=" + site_id, "32");//商品隱賣連結: + "&ulv=" + user_level
             }
             json = result.ToString().ToLower();
         }
     }
     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 = "無預覽信息";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Esempio n. 5
0
        public HttpResponseBase VendorBrandPreview()
        {
            _siteConfigMgr = new SiteConfigMgr(Server.MapPath(xmlPath));
            List<SiteConfig> configList = _siteConfigMgr.Query();
            string DomainName = configList.Where(m => m.Name.Equals("DoMain_Name")).FirstOrDefault().Value;
            string json = string.Empty;
            try
            {
                VendorBrandQuery query = new VendorBrandQuery();
                _vendorBrand = new VendorBrandMgr(connectionString);
                if (!string.IsNullOrEmpty(Request.Params["brand_id"]))
                {
                    query.Brand_Id = Convert.ToUInt32(Request.Params["brand_id"]);
                    int classify = _vendorBrand.GetClassify(query);
                    string result = string.Empty;
                    switch (classify)
                    {
                        case 10:
                            result += "http://" + DomainName + "/food/brand_food.php?b_id=" + query.Brand_Id;//商品預覽
                            break;
                        case 20:
                            result += "http://" + DomainName + "/stuff/brand_stuff.php?b_id=" + query.Brand_Id;//商品預覽
                            break;
                        default:
                            result += "http://" + DomainName + "/brand.php?b_id=" + query.Brand_Id;//商品預覽
                            break;
                        //www.gigade100.com/newweb/food/brand_food.php?b_id=332
                    }
                    json = result.ToString().ToLower();
                }

            }
            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 = "無預覽信息";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Esempio n. 6
0
        public HttpResponseBase UsersList()
        {
            List<UsersListQuery> stores = new List<UsersListQuery>();
            List<SiteConfig> configs = new List<SiteConfig>();
            SiteConfig con = new SiteConfig();
            string json = string.Empty;
            try
            {
                string path = Server.MapPath(xmlPath);
                if (System.IO.File.Exists(path))
                {
                    siteConfigMgr = new SiteConfigMgr(path);
                    configs = siteConfigMgr.Query();
                }
                foreach (SiteConfig site in configs)
                {
                    if (site.Name == "DoMain_Name")
                    {
                        con = site;
                        break;
                    }
                }
                UsersListQuery query = new UsersListQuery();

                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "20");//用於分頁的變量

                //todo:分页汇出会员信息,由于不能确定是按分页汇出还是汇出全部会员信息,暂且保留汇出全部会员信息
                //start = query.Start;
                //limit = query.Limit;
                if (!string.IsNullOrEmpty(Request.Params["serchs"]))
                {
                    query.serchtype = Request.Params["serchs"];
                }
                if (!string.IsNullOrEmpty(Request.Params["timestart"]))
                {

                    query.serchstart = Convert.ToDateTime(Request.Params["timestart"]);
                    query.serchstart = Convert.ToDateTime(query.serchstart.ToString("yyyy-MM-dd HH:mm:ss"));
                }
                if (!string.IsNullOrEmpty(Request.Params["timeend"]))
                {
                    query.serchend = Convert.ToDateTime(Request.Params["timeend"]);
                    query.serchend = Convert.ToDateTime(query.serchend.ToString("yyyy-MM-dd HH:mm:ss"));
                }

                query.content = Request.Params["serchcontent"];
                query.types = Request.Params["bonus_type"];
                query.checks = Request.Params["checkbox1"];
                if (!string.IsNullOrEmpty(Request.Params["relation_id"]))//待回覆
                {
                    query.user_id = Convert.ToUInt32(Request.Params["relation_id"]);
                }
                _uslmpgr = new UsersListMgr(mySqlConnectionString);
                _paraMgr = new ParameterMgr(mySqlConnectionString);
                int totalCount = 0;
                stores = _uslmpgr.Query(query, out totalCount);
                Parametersrc pa = new Parametersrc();
                foreach (var item in stores)
                {
                    string[] url = con.Value.Split('/');
                    item.user_url = "http://" + url[0] + "/ecservice_jump.php";//?uid=" + item.user_id;
                    if (Convert.ToBoolean(Request.Params["isSecret"]))
                    {
                        if (!string.IsNullOrEmpty(item.user_name))
                        {
                            item.user_name = item.user_name.Substring(0, 1) + "**";
                        }
                        item.user_email = item.user_email.Split('@')[0] + "@***";
                        //if (!string.IsNullOrEmpty(item.user_mobile))
                        //{
                        //    if (item.user_phone.ToString().Length > 3)
                        //    {
                        //        item.user_phone = item.user_phone.Substring(0, 3) + "***";
                        //    }
                        //    else
                        //    {
                        //        item.user_phone = item.user_phone + "***";
                        //    }
                        //}
                        if (!string.IsNullOrEmpty(item.user_mobile))
                        {
                            item.user_mobile = UnSecretMobile(item);
                            if (item.user_mobile.ToString().Length > 3)
                            {
                                item.user_mobile = item.user_mobile.Substring(0, 3) + "***";
                            }
                            else
                            {
                                item.user_mobile = item.user_mobile + "***";
                            }

                        }
                        if (item.user_address.ToString().Length > 3)
                        {
                            item.user_address = item.user_address.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.user_address = item.user_address + "***";
                        }
                    }
                    else
                    {
                        if (item.user_mobile.Length == 48)
                        {
                            item.user_mobile = EncryptComputer.EncryptDecryptTextByApi(item.user_mobile, false);
                        }
                    }
                    //獲取時間
                    item.reg_date = CommonFunction.GetNetTime(item.user_reg_date);
                    item.sfirst_time = CommonFunction.GetNetTime(item.first_time);
                    item.slast_time = CommonFunction.GetNetTime(item.last_time);
                    item.sbe4_last_time = CommonFunction.GetNetTime(item.be4_last_time);

                    pa = _paraMgr.QueryUsed(new Parametersrc { Used = 1, ParameterCode = item.user_level.ToString(), ParameterType = "UserLevel" }).FirstOrDefault();
                    if (pa != null)
                    {
                        item.userLevel = pa.parameterName;
                    }
                    #region 購物金欄位修改 add by yafeng0715j 20150924
                    BonusMasterMgr bmMgr = new BonusMasterMgr(mySqlConnectionString);
                    BonusMasterQuery bmQuery = new BonusMasterQuery();
                    bmQuery.user_id = item.user_id;
                    bmQuery.bonus_type = 1;
                    DataTable table = bmMgr.GetBonusMasterList(bmQuery);
                    uint master_total = 0;
                    int master_balance = 0;
                    if (table.Rows[0][0].ToString() != "")
                    {
                        master_total = Convert.ToUInt32(table.Rows[0][0]);
                        master_balance = Convert.ToInt32(table.Rows[0][1]);
                    }
                    item.bonus_type = 1;
                    item.bonus_typename = string.Format("購物金(剩餘{0}/總{1})", master_balance, master_total);

                    master_total = 0;
                    master_balance = 0;
                    bmQuery.bonus_type = 2;
                    table = bmMgr.GetBonusMasterList(bmQuery);
                    if (table.Rows[0][0].ToString() != "")
                    {
                        master_total = Convert.ToUInt32(table.Rows[0][0]);
                        master_balance = Convert.ToInt32(table.Rows[0][1]);
                    }
                    item.bonus_type1 = 2;
                    item.bonus_typenamequan = string.Format("抵用券(剩餘{0}/總{1})", master_balance, master_total);
                    #endregion

                }
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                //listUser是准备转换的对象
                json = "{success:true,'msg':'user',totalCount:" + totalCount + ",start:" + query.Start + ",limit:" + query.Limit + ",data:" + JsonConvert.SerializeObject(stores, 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;
        }