public HttpResponseBase GetCatagory(string id = "true")
        {
            List<ProductCategory> categoryList = new List<ProductCategory>();
            List<ProductCategoryCustom> cateList = new List<ProductCategoryCustom>();
            List<ProductCategorySet> resultList = new List<ProductCategorySet>();

            _procateMgr = new ProductCategoryMgr(connectionString);
            ParameterMgr parameterMgr = new ParameterMgr(connectionString);

            string resultStr = "";
            try
            {
                uint rootId = 0;
                categoryList = _procateMgr.QueryAll(new ProductCategory { });
                List<Parametersrc> fatherIdResult = parameterMgr.QueryUsed(new Parametersrc { ParameterType = "event_type", Used = 1, ParameterCode = "CXXM" });
                rootId = Convert.ToUInt32(fatherIdResult[0].ParameterProperty);
                cateList = getCate(categoryList, rootId);
                GetCategoryList(categoryList, ref cateList, resultList);
                resultStr = JsonConvert.SerializeObject(cateList);
            }
            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);
            }

            this.Response.Clear();
            this.Response.Write(resultStr);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 2
0
         public HttpResponseBase GetProCage1()
         {
             string resultStr = "{success:false}";

             try
             {
                 paraMgr = new ParameterMgr(connectionString);
                 resultStr = "{success:true,data:" + JsonConvert.SerializeObject(paraMgr.QueryUsed(new Parametersrc { ParameterType = "product_cate" }).Where(p => p.TopValue == "0").ToList()) + "}";
             }
             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);
             }


             this.Response.Clear();
             this.Response.Write(resultStr);
             this.Response.End();
             return this.Response;
         }
Ejemplo n.º 3
0
        public HttpResponseBase GetSelectedCage()
        {
            string resultStr = "{success:false}";

            try
            {
                string strCateId = string.Empty;
                if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
                {
                    #region 從正式表獲取
                    uint pid = uint.Parse(Request.Params["ProductId"]);
                    _productMgr = new ProductMgr(connectionString);
                    Product result = _productMgr.Query(new Product { Product_Id = pid }).FirstOrDefault();
                    if (result != null)
                    {
                        strCateId = result.Cate_Id;
                    }
                    #endregion
                }
                else
                {
                    Caller _caller = (Session["caller"] as Caller);
                    _productTempMgr = new ProductTempMgr(connectionString);
                    ProductTemp query = new ProductTemp { Writer_Id = _caller.user_id, Combo_Type = COMBO_TYPE };
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        query.Product_Id = Request.Form["OldProductId"];
                    }

                    ProductTemp tempResult = _productTempMgr.GetProTemp(query);
                    if (tempResult != null)
                    {
                        strCateId = tempResult.Cate_Id;
                    }
                }

                paraMgr = new ParameterMgr(connectionString);
                Parametersrc cate2Result = paraMgr.QueryUsed(new Parametersrc { ParameterType = "product_cate", ParameterCode = strCateId }).FirstOrDefault();
                if (cate2Result != null)
                {
                    Parametersrc cate1Result = paraMgr.QueryUsed(new Parametersrc { ParameterType = "product_cate", ParameterCode = cate2Result.TopValue.ToString() }).FirstOrDefault();
                    if (cate1Result != null)
                    {
                        StringBuilder stb = new StringBuilder("{");
                        stb.AppendFormat("cate1Name:\"{0}\",cate1Value:\"{1}\",cate1Rowid:\"{2}\",cate1TopValue:\"{3}\"", cate1Result.parameterName, cate1Result.ParameterCode, cate1Result.Rowid, cate1Result.TopValue);
                        stb.AppendFormat(",cate2Name:\"{0}\",cate2Value:\"{1}\",cate2Rowid:\"{2}\",cate2TopValue:\"{3}\"", cate2Result.parameterName, cate2Result.ParameterCode, cate2Result.Rowid, cate2Result.TopValue);
                        stb.Append("}");
                        resultStr = "{success:true,data:" + stb.ToString() + "}";
                    }
                }


            }
            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);
            }


            this.Response.Clear();
            this.Response.Write(resultStr);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 4
0
        public List<Parametersrc> GetRelevantInfo(string path,string type)
        {
            ///獲得key的值,key值一般為 供應商,品牌,或者其他類型
            try
            {
                StringBuilder sb = new StringBuilder();
                IParametersrcImplMgr _parameteMgr = new ParameterMgr(path, ParaSourceType.XML);
                //return _parameteMgr.QueryUsed(new Parametersrc { ParameterType = "ScheduleType" });
                return _parameteMgr.QueryUsed(new Parametersrc { ParameterType = type });
            }
            catch (Exception ex)
            {
                throw new Exception("ScheduleMgr-->GetRelevantInfo" + ex.Message,ex);
            }

        }
Ejemplo n.º 5
0
 public string QueryParaName(string code, string type)
 {
     _paraMgr = new ParameterMgr(connectionString);
     Parametersrc para = _paraMgr.QueryUsed(new Parametersrc { Used = 1, ParameterCode = code, ParameterType = type }).FirstOrDefault();
     if (para != null)
     {
         return para.parameterName;
     }
     return code;
 }
Ejemplo n.º 6
0
        public string QueryBuyCate()
        {
            string resultStr = "{success:false}";

            try
            {
                List<Parametersrc> store = new List<Parametersrc>();

                if (Request.Params["topValue"] != "0" && Request.Params["topValue"] != null)
                {
                    string topValue = Request.Params["topValue"] ?? "";
                    paraMgr = new ParameterMgr(connectionString);

                    store = paraMgr.QueryUsed(new Parametersrc { ParameterType = "erp_cate", TopValue = topValue });
                }
                StringBuilder stb = new StringBuilder("");
                stb.Append("{");
                stb.Append("success:true,items:[");
                //stb.Append("{");
                //stb.AppendFormat("\"ParameterCode\":\"{0}\",\"parameterName\":\"{1}\"", 0, "請選擇購買類型");
                //stb.Append("}");
                if (store != null)
                {
                    foreach (Parametersrc item in store)
                    {
                        stb.Append("{");
                        stb.AppendFormat("\"ParameterCode\":\"{0}\",\"parameterName\":\"{1}\"", item.ParameterCode, item.parameterName);
                        stb.Append("}");
                    }
                }
                stb.Append("]}");
                resultStr = stb.ToString().Replace("}{", "},{");

                //                resultStr = "{success:true,items:" + JsonConvert.SerializeObject(paraMgr.QueryUsed(new Parametersrc { ParameterType = "erp_cate", TopValue = topValue })) + "}";
            }
            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);
            }
            this.Response.Clear();
            this.Response.Write(resultStr);
            this.Response.End();
            return resultStr;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 記得在這裡加上xml請求時 必須去 Admin.gigade\Module\ActionFilter.cs 文件中加上判斷不然每次都會提示登錄過期
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase GetXmlInfo()
        {
            string msg = string.Empty;
            try
            {
                //公共的
                _paraMgr = new ParameterMgr(connectionString);
                _siteConfigMgr = new SiteConfigMgr(Server.MapPath(xmlPath));
                List<Parametersrc> listP = _paraMgr.QueryType("");
                string to = string.Empty, sendtime = string.Empty, status = string.Empty, HttpPath = string.Empty;
                //根據parameterType數量來循環
                if (listP.Count > 0)
                {
                    string getHttp = "http://" + HttpContext.Request.Url.Authority.ToString() + "/Notification/";
                    StringBuilder strXml = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?><root>");
                    for (int i = 0, j = listP.Count; i < j; i++)
                    {
                        string type = listP[i].ParameterType;
                        //讀取數據庫中收件人與通知狀態
                        List<Parametersrc> pList = _paraMgr.QueryUsed(new Parametersrc { ParameterType = type });
                        switch (type)
                        {
                            #region 根據不同的type來處理
                            case "warn_stock":
                                to = pList.Where(rec => rec.parameterName == "sendTo").FirstOrDefault().ParameterCode;
                                to = to.Replace("\n", "");
                                sendtime = pList.Where(rec => rec.parameterName == "sendTime").FirstOrDefault().ParameterCode;
                                sendtime = sendtime.Replace("\n", "");
                                status = pList.Where(rec => rec.parameterName == "switch").FirstOrDefault().ParameterCode;
                                HttpPath = "CheckStockAlarm";

                                strXml.Append("<mail>");
                                strXml.AppendFormat("<status>{0}</status>", status);//0 關閉,1 正常, 2 無資料,3 服務器異常
                                strXml.AppendFormat("<mailto>{0}</mailto>", to);
                                strXml.AppendFormat("<sendTime>{0}</sendTime>", sendtime);
                                strXml.AppendFormat("<getHttp>{0}</getHttp>", getHttp);//網站的IP地址+controller
                                strXml.AppendFormat("<HttpPath>{0}</HttpPath>", HttpPath);//function
                                strXml.Append("</mail>");
                                break;
                            case "warn_product":
                                to = pList.Where(rec => rec.parameterName == "sendTo").FirstOrDefault().ParameterCode;
                                to = to.Replace("\n", "");
                                sendtime = pList.Where(rec => rec.parameterName == "sendTime").FirstOrDefault().ParameterCode;
                                sendtime = sendtime.Replace("\n", "");
                                status = pList.Where(rec => rec.parameterName == "switch").FirstOrDefault().ParameterCode;
                                HttpPath = "ProductUpdateNotice";

                                strXml.Append("<mail>");
                                strXml.AppendFormat("<status>{0}</status>", status);//0 關閉,1 正常, 2 無資料,3 服務器異常
                                strXml.AppendFormat("<mailto>{0}</mailto>", to);
                                strXml.AppendFormat("<sendTime>{0}</sendTime>", sendtime);
                                strXml.AppendFormat("<getHttp>{0}</getHttp>", getHttp);//網站的IP地址+controller
                                strXml.AppendFormat("<HttpPath>{0}</HttpPath>", HttpPath);//function
                                strXml.Append("</mail>");
                                break;
                            case "warn_productMap":
                                to = pList.Where(rec => rec.parameterName == "sendTo").FirstOrDefault().ParameterCode;
                                to = to.Replace("\n", "");
                                sendtime = pList.Where(rec => rec.parameterName == "sendTime").FirstOrDefault().ParameterCode;
                                sendtime = sendtime.Replace("\n", "");
                                status = pList.Where(rec => rec.parameterName == "switch").FirstOrDefault().ParameterCode;
                                HttpPath = "ProductItemUpdateNotice";

                                strXml.Append("<mail>");
                                strXml.AppendFormat("<status>{0}</status>", status);//0 關閉,1 正常, 2 無資料,3 服務器異常
                                strXml.AppendFormat("<mailto>{0}</mailto>", to);
                                strXml.AppendFormat("<sendTime>{0}</sendTime>", sendtime);
                                strXml.AppendFormat("<getHttp>{0}</getHttp>", getHttp);//網站的IP地址+controller
                                strXml.AppendFormat("<HttpPath>{0}</HttpPath>", HttpPath);//function
                                strXml.Append("</mail>");
                                break;
                            #endregion
                        }
                    }
                    strXml.Append("</root>");
                    msg = strXml.ToString();
                }
                else
                {
                    msg = "<mail><status>3</status><msg>paras are not set.</msg></mail>";
                }
            }
            catch
            {
                msg = "<mail><status>3</status></mail>";
            }
            this.Response.Clear();
            this.Response.Write(msg);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 8
0
        public HttpResponseBase GetProCategory()
        {
            List<ProductCategoryCustom> cateList = new List<ProductCategoryCustom>();
            List<Parametersrc> Paramelist = new List<Parametersrc>(); //保存全部數據項
            List<Parametersrc> ParameListByParent = new List<Parametersrc>();//保存父項Id
            string resultStr = "";
            try
            {
                //_procateMgr = new ProductCategoryMgr(connectionString);
                //cateList = _procateMgr.cateQuery(0);
                //GetCategoryList(ref cateList);
                //resultStr = JsonConvert.SerializeObject(cateList);
                ParameterMgr pm = new ParameterMgr(connectionString);
                Paramelist = pm.QueryUsed(new Parametersrc() { ParameterType = "product_cate" });
                ParameListByParent = Paramelist.FindAll(p => p.TopValue == "0");
                foreach (var p in ParameListByParent)
                {
                    cateList.Add(new ProductCategoryCustom { rowid = p.Rowid, parameterCode = p.ParameterCode, text = p.parameterName });
                }

                GetCategoryList(ref cateList, Paramelist);
                resultStr = JsonConvert.SerializeObject(cateList);
            }
            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);
            }

            this.Response.Clear();
            this.Response.Write(resultStr);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 9
0
        public string QueryPm()
        {
            gcMgr = new GroupCallerMgr(connectionString);
            paraMgr = new ParameterMgr(connectionString);
            fgMgr = new FgroupMgr(connectionString);
            muMgr = new ManageUserMgr(connectionString);
            groupCaller gc = new groupCaller();
            Fgroup fg = new Fgroup();
            string json = string.Empty;

            try
            {
                List<Parametersrc> parstore = paraMgr.QueryUsed(new Parametersrc { ParameterType = "vendor_pm" }).ToList();

                if (parstore.Count != 0)
                {
                    fg.groupCode = parstore[0].ParameterCode;
                    //  fg.groupName = parstore[0].parameterName;//parameterName是可變的不可依此查詢 edit by shuangshuang0420j 2015.07.28 09:48
                    Fgroup pmfg = fgMgr.GetSingle(fg);
                    if (pmfg != null)
                    {
                        gc.groupId = pmfg.rowid;
                        string pm = gcMgr.QueryCallidById(gc);
                        StringBuilder stb = new StringBuilder("");
                        stb.Append("{");
                        stb.Append("success:true,item:[");
                        //stb.Append("{");
                        //stb.AppendFormat("\"userId\":\"{0}\",\"userName\":\"{1}\"", 0, "請選擇");
                        //stb.Append("}");
                        string nameStr = string.Empty;

                        string[] pmar = pm.Split(',').ToArray();
                        foreach (var item in pmar)
                        {
                            int total = 0;
                            ManageUserQuery mu = muMgr.GetManageUserList(new ManageUserQuery { user_email = item, search_status = "-1" }, out total).FirstOrDefault();
                            if (total == 1 && mu != null)
                            {
                                stb.Append("{");
                                stb.AppendFormat("\"userId\":\"{0}\",\"userName\":\"{1}\"", mu.user_id, mu.user_username);
                                stb.Append("}");
                            }
                        }
                        stb.Append("]}");
                        json = stb.ToString().Replace("}{", "},{");
                    }
                    //else
                    //{
                    //    json = "{success:false,error:1}";
                    //}
                }
                //else
                //{
                //    json = "{success:false,error:0}";
                //}
            }
            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 = "[]";
            }

            return json;

        }
Ejemplo n.º 10
0
        /// <summary>
        /// 單一商品
        /// </summary>
        /// <param name="priceMaster"></param>
        /// <param name="batch"></param>
        /// <param name="applyId"></param>
        /// <param name="excuteSql"></param>
        /// <param name="priceType">1為依折扣,2為依活動價</param>  // add by zhuoqin0830w  2015/02/10
        /// <param name="chkCost">0 為 活動成本 設定 原成本,1 為 活動成本 依 折數 計算</param>  //add by zhuoqin0830w  2015/04/02
        /// <returns></returns>
        public bool SaveSingleProduct(PriceMasterCustom priceMaster, HistoryBatch batch, int applyId, ArrayList excuteSql, int priceType, int chkCost)
        {
            bool result = false;
            if (_tableHistoryMgr.SaveHistory<PriceMaster>(priceMaster, batch, excuteSql))
            {
                _itemPriceTsMgr = new ItemPriceTsMgr("");
                _itemPriceMgr = new ItemPriceMgr(connectionString);
                List<ItemPriceCustom> itemPrices = _itemPriceMgr.Query(new ItemPrice() { price_master_id = priceMaster.price_master_id });

                DBTableInfo tableInfo = BLL.gigade.Common.CommonFunction.GetDBInfo<ItemPrice>();
                IParametersrcImplMgr parametersrcMgr = new ParameterMgr(connectionString);
                var paras = parametersrcMgr.QueryUsed(new Parametersrc { ParameterType = "ColumnHistory", ParameterCode = tableInfo.DBName, Used = 1 });
                List<string> cols = (from p in paras
                                     select p.parameterName.Trim().ToLower()).ToList();

                var columns = _tableHistoryMgr.Query_COL_Comment(tableInfo.DBName);
                string pkName = _tableHistoryMgr.Query_TB_PK(tableInfo.DBName);

                foreach (var item in itemPrices)
                {
                    item.apply_id = (uint)applyId;
                    if (priceType == 1)
                    {
                        item.event_money = (uint)CommonFunction.ArithmeticalDiscount((int)item.item_money, priceMaster.event_price_discount);// (uint)Math.Round(item.item_money * priceMaster.event_price_discount * 0.01, 0);
                        //add by zhuoqin0830w  2015/04/02  判斷是否是  依原成本設定值
                        if (chkCost == 1)
                        {
                            //eidt by zhuoqin0830w  更改商品活動成本驗算公式使活動價乘以折扣  2015/02/27
                            item.event_cost = (uint)CommonFunction.ArithmeticalDiscount((int)item.event_money, priceMaster.event_cost_discount);// (uint)Math.Round(item.item_cost * priceMaster.event_cost_discount * 0.01, 0);
                        }
                        else { item.event_cost = (uint)priceMaster.event_cost; }
                    }
                    else
                    {
                        item.event_money = (uint)priceMaster.event_price;
                        item.event_cost = (uint)priceMaster.event_cost;
                    }
                    excuteSql = new ArrayList();
                    excuteSql.Add(_itemPriceTsMgr.UpdateTs(item));
                    if (_tableHistoryMgr.SaveHistory<ItemPrice>(item, batch, excuteSql, cols, columns, pkName))
                    {
                        result = true;
                    }
                }
            }
            return result;
        }
Ejemplo n.º 11
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;
        }
        public HttpResponseBase GetSelectedCage()
        {
            string resultStr = "{success:false}";

            try
            {
                string strCateId = string.Empty;
                string vendor_pid = string.Empty;
                if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
                {
                    vendor_pid = Request.Params["ProductId"];
                }
                //if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                //{
                //    vendor_pid = Request.Form["OldProductId"];
                //}

                BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"];
                int writer_id = Convert.ToInt32(vendorModel.vendor_id);

                _productTempMgr = new ProductTempMgr(connectionString);
                ProductTemp query = new ProductTemp { Writer_Id = writer_id, Combo_Type = COMBO_TYPE, Product_Id = vendor_pid };

                ProductTemp tempResult = _productTempMgr.GetVendorProTemp(query);
                if (tempResult != null)
                {
                    strCateId = tempResult.Cate_Id;
                }


                paraMgr = new ParameterMgr(connectionString);
                Parametersrc cate2Result = paraMgr.QueryUsed(new Parametersrc { ParameterType = "product_cate", ParameterCode = strCateId }).FirstOrDefault();
                if (cate2Result != null)
                {
                    Parametersrc cate1Result = paraMgr.QueryUsed(new Parametersrc { ParameterType = "product_cate", ParameterCode = cate2Result.TopValue.ToString() }).FirstOrDefault();
                    if (cate1Result != null)
                    {
                        StringBuilder stb = new StringBuilder("{");
                        stb.AppendFormat("cate1Name:\"{0}\",cate1Value:\"{1}\",cate1Rowid:\"{2}\",cate1TopValue:\"{3}\"", cate1Result.parameterName, cate1Result.ParameterCode, cate1Result.Rowid, cate1Result.TopValue);
                        stb.AppendFormat(",cate2Name:\"{0}\",cate2Value:\"{1}\",cate2Rowid:\"{2}\",cate2TopValue:\"{3}\"", cate2Result.parameterName, cate2Result.ParameterCode, cate2Result.Rowid, cate2Result.TopValue);
                        stb.Append("}");
                        resultStr = "{success:true,data:" + stb.ToString() + "}";
                    }
                }
            }
            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);
            }


            this.Response.Clear();
            this.Response.Write(resultStr);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 13
0
        public HttpResponseBase SaveChannel()
        {
            zMgr = new ZipMgr(connectString);
            chMgr = new ChannelMgr(connectString);
            uMgr = new UsersMgr(connectString);

            string json = string.Empty;
            bool result = false;
            string channel_id = Request.Form["channel_id"] ?? string.Empty;
            try
            {
                if (!string.IsNullOrEmpty(Request.Form["channel_status"]))
                {
                    ch.channel_status = Int32.Parse(Request.Form["channel_status"].ToString());
                }

                if (!string.IsNullOrEmpty(Request.Form["channel_type"]))
                {
                    ch.channel_type = Int32.Parse(Request.Form["channel_type"].ToString());
                }

                if (!string.IsNullOrEmpty(Request.Form["channel_name_full"]))
                {
                    ch.channel_name_full = Request.Form["channel_name_full"].ToString();
                    u.user_name = Request.Form["channel_name_full"].ToString();
                    List<Channel> channel = chMgr.QueryC(" and channel_name_full='" + Request.Form["channel_name_full"] + "'");
                    if (channel != null && channel.Count > 0 && channel.Where(m => m.channel_id == int.Parse(string.IsNullOrEmpty(channel_id) ? "0" : channel_id)).Count() == 0)
                    {
                        json = "{success:true,msg:\""+Resources.Channel.CHANNEL_HAS_EXIST+"。\",channelId:\"" + channel_id + "\"}";

                        this.Response.Clear();
                        this.Response.Write(json);
                        this.Response.End();
                        return this.Response;
                    }
                }

                if (!string.IsNullOrEmpty(Request.Form["channel_name_simple"]))
                {
                    ch.channel_name_simple = Request.Form["channel_name_simple"].ToString();
                }

                if (!string.IsNullOrEmpty(Request.Form["channel_invoice"]))
                {
                    ch.channel_invoice = Request.Form["channel_invoice"].ToString();
                    u.user_password = Request.Form["channel_invoice"].ToString();
                }

                if (!string.IsNullOrEmpty(Request.Form["channel_email"]))
                {
                    ch.channel_email = Request.Form["channel_email"].ToString();
                }
                else
                {
                    ch.channel_email = "";
                }

                if (!string.IsNullOrEmpty(Request.Form["company_cphonenum"]))
                {
                    ch.company_phone = Request.Form["company_cphone"].ToString() +Request.Form["company_cphonenum"].ToString();
                }
                else
                {
                    ch.company_phone = "";
                }

                if (!string.IsNullOrEmpty(Request.Form["company_cfaxnum"]))
                {
                    ch.company_fax = Request.Form["company_cfax"].ToString() +Request.Form["company_cfaxnum"].ToString();
                }
                else
                {
                    ch.company_fax = "";
                }

                if (!string.IsNullOrEmpty(Request.Form["company_zip"]))
                {
                    ch.company_zip = Int32.Parse(Request.Form["company_zip"].ToString());
                }
                else
                {
                    ch.company_zip = 0;
                }

                if (!string.IsNullOrEmpty(Request.Form["company_address"]))
                {
                    ch.company_address = Request.Form["company_address"].ToString();
                }
                else
                {
                    ch.company_address = "";
                }

                if (!string.IsNullOrEmpty(Request.Form["invoice_title"]))
                {
                    ch.invoice_title = Request.Form["invoice_title"].ToString();
                }

                if (!string.IsNullOrEmpty(Request.Form["invoice_zip"]))
                {
                    ch.invoice_zip = Int32.Parse(Request.Form["invoice_zip"].ToString());
                }

                if (!string.IsNullOrEmpty(Request.Form["invoice_address"]))
                {
                    ch.invoice_address = Request.Form["invoice_address"].ToString();
                }

                if (!string.IsNullOrEmpty(Request.Form["contract_createdate"]))
                {
                    ch.contract_createdate = DateTime.Parse(Request.Form["contract_createdate"].ToString());
                }
                else
                {
                    ch.contract_createdate = DateTime.MinValue;
                }

                if (!string.IsNullOrEmpty(Request.Form["contract_start"]))
                {
                    ch.contract_start = DateTime.Parse(Request.Form["contract_start"].ToString());
                }
                else
                {
                    ch.contract_start = DateTime.MinValue;
                }

                if (!string.IsNullOrEmpty(Request.Form["contract_end"]))
                {
                    ch.contract_end = DateTime.Parse(Request.Form["contract_end"].ToString());
                }
                else
                {
                    ch.contract_end = DateTime.MinValue;
                }

                if (!string.IsNullOrEmpty(Request.Form["annaul_fee"]))
                {
                    ch.annaul_fee = Decimal.Parse(Request.Form["annaul_fee"].ToString());
                }
                else
                {
                    ch.annaul_fee = 0;
                }

                if (!string.IsNullOrEmpty(Request.Form["renew_fee"]))
                {
                    ch.renew_fee = Decimal.Parse(Request.Form["renew_fee"].ToString());
                }
                else
                {
                    ch.renew_fee = 0;
                }

                if (!string.IsNullOrEmpty(Request.Form["model_in"]))
                {
                    ch.model_in = Request.Form["model_in"].ToString();
                }
                else
                {
                    ch.model_in = "1";
                }

                if (!string.IsNullOrEmpty(Request.Form["notify_sms"]))
                {
                    ch.notify_sms = Int32.Parse(Request.Form["notify_sms"].ToString());
                }
                else
                {
                    ch.notify_sms = 0;
                }

                //add by xiangwang0413w 2014/06/26 增加 ERP客戶代號
                if (!string.IsNullOrEmpty(Request.Form["erp_id"]))
                {
                    ch.erp_id = Request.Form["erp_id"];
                }

                DataTable dtUsers = uMgr.Query(Request.Form["manager_Email"].ToString());
                if (dtUsers.Rows.Count > 0)//會員信箱已存在
                {
                    DataTable dtUserId = chMgr.QueryUser(dtUsers.Rows[0]["user_id"].ToString());
                    if (string.IsNullOrEmpty(channel_id))//新增
                    {                        
                        if (dtUserId.Rows.Count > 0)//是否被外站使用
                        {
                            json = "{success:true,msg:\""+Resources.Channel.MAIL_WAS_USED+"。\",channelId:\"" + channel_id + "\"}";

                            this.Response.Clear();
                            this.Response.Write(json);
                            this.Response.End();
                            return this.Response;
                        }
                        else
                        {
                            ch.user_id = Int32.Parse(dtUsers.Rows[0]["user_id"].ToString());
                            channel_id = chMgr.Save(ch).ToString();
                            result = Int32.Parse(channel_id) > 0;
                        }
                    }                    
                    else
                    {
                        //修改
                        if (dtUserId.Rows.Count > 0)
                        {
                            if (dtUserId.Rows[0]["channel_id"].ToString() != channel_id)
                            {
                                json = "{success:true,msg:\"" + Resources.Channel.MAIL_WAS_USED + "。\",channelId:\"" + channel_id + "\"}";

                                this.Response.Clear();
                                this.Response.Write(json);
                                this.Response.End();
                                return this.Response;
                            }
                            else
                            {
                                ch.user_id = Int32.Parse(dtUsers.Rows[0]["user_id"].ToString());
                            }
                        }
                        else
                        {
                            ch.user_id = Int32.Parse(dtUsers.Rows[0]["user_id"].ToString());
                        }

                        ch.channel_id = Int32.Parse(channel_id);

                        result = chMgr.Edit(ch) > 0;
                    }
                }
                else
                {
                    //會員信箱不存在
                    u.user_email = Request.Form["manager_Email"].ToString();
                    u.user_name = Request.Form["channel_name_full"].ToString();

                    BLL.gigade.Common.HashEncrypt hash = new BLL.gigade.Common.HashEncrypt();
                    u.user_password = hash.SHA256Encrypt(Request.Form["invoice_title"].ToString());

                    u.user_mobile = "0227833183";
                    u.user_phone = "0227833183";
                    u.user_zip = 115;
                    u.user_address = Resources.Channel.USER_ADDRESS;
                    u.user_status = 1;
                    u.user_reg_date = (int)BLL.gigade.Common.CommonFunction.GetPHPTime();
                    u.user_updatedate = (int)BLL.gigade.Common.CommonFunction.GetPHPTime();
                    u.user_birthday_year = 1900;
                    u.user_birthday_month = 01;
                    u.user_birthday_day = 01;

                    if (uMgr.SelSaveID(u) > 0)
                    {
                        ch.user_id = Convert.ToInt32(u.user_id);
                    }
                    if (string.IsNullOrEmpty(channel_id))
                    {
                        channel_id=chMgr.Save(ch).ToString();
                        /**
                         *如果外站類型是gigade,則將參數表中type=deliver_store(即所有物流方式)全部插入channel_shipping表中
                         ***/
                        if (ch.channel_type == 2)
                        {
                            paraMgr = new ParameterMgr(connectString);
                            chsMgr = new ChannelShippingMgr(connectString);
                            List<Parametersrc> Deliver_result = paraMgr.QueryUsed(new Parametersrc { ParameterType = "deliver_store", Used = 1 });
                            foreach (Parametersrc item in Deliver_result)
                            {
                                chs.channel_id = int.Parse(channel_id);
                                chs.shipping_carrior = int.Parse(item.ParameterCode);
                                chs.shipco = item.parameterName;
                                chsMgr.Save(chs);
                            }

                        }
                        /*
                         end by zhongyu0304w at 2013/10/10
                         */
                        result = Int32.Parse(channel_id) > 0;
                    }
                    else
                    {
                        ch.channel_id = int.Parse(channel_id);
                        result = chMgr.Edit(ch) > 0;
                    }
                }

                
                if (result)
                {
                    
                    json = "{success:true,msg:\""+Resources.Channel.SUCCESS+"。\",channelId:\"" + channel_id + "\"}";
                }
                else
                {
                    json = "{success:true,msg:\""+Resources.Channel.FAILED+"\",channelId:\"" + channel_id + "\"}";
                }
            }
            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,msg:\"" + Resources.Channel.FAILED + "\",channelId:\"" + channel_id + "\"}";
            }

            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 14
0
 public HttpResponseBase QueryDelivery()
 {
     string json = string.Empty;
     try
     {
         IParametersrcImplMgr paraMgr = new ParameterMgr(connectionString);
         json = "{success:true,items:" + JsonConvert.SerializeObject(paraMgr.QueryUsed(new Parametersrc { ParameterType = "Deliver_Store", Used = 1 }).Where(m => m.Sort == 1)) + "}";
     }
     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;
 }
Ejemplo n.º 15
0
        public HttpResponseBase mailSetQuery()
        {
            string result = "{success:false}";

            try
            {
                if (!string.IsNullOrEmpty(Request.Params["paraType"]))
                {
                    string paratype = Request.Params["paraType"];
                    StringBuilder stb = new StringBuilder();
                    string tempStr = string.Empty;
                    IParametersrcImplMgr _paraMgr = new BLL.gigade.Mgr.ParameterMgr(connectionString);
                    List<Parametersrc> paraList = _paraMgr.QueryUsed(new Parametersrc { ParameterType = paratype });

                    if (paraList.Count > 2)//為了防止就版本2014/05/23 之前 沒有Sendtime 參數 edit by hufeng0813w 2014/05/23
                    {
                        Parametersrc paraSwitch = paraList.Where(m => m.parameterName == "switch").FirstOrDefault();
                        Parametersrc paraSendTo = paraList.Where(m => m.parameterName == "sendTo").FirstOrDefault();
                        Parametersrc paraSendTime = paraList.Where(m => m.parameterName == "sendTime").FirstOrDefault();

                        switch (paraList[0].ParameterType)
                        {
                            case "warn_stock":
                            case "warn_product":
                            case "warn_productMap": stb.AppendFormat("switchId:'{0}',switch:'{1}',sendToId:'{2}',sendTo:'{3}',sendTimeId:'{4}',sendTime:'{5}'", paraSwitch.Rowid, paraSwitch.ParameterCode, paraSendTo.Rowid, paraSendTo.ParameterCode.Replace("\n", "\\n"), paraSendTime.Rowid, paraSendTime.ParameterCode.Replace("\n", "\\n")); break;
                            default:
                                break;
                        }
                        tempStr = "{" + stb.ToString() + "}";

                    }
                    else
                    {
                        tempStr = "null";
                    }
                    result = "{success:true,data:" + tempStr + "}";
                }

            }
            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);
            }


            this.Response.Clear();
            this.Response.Write(result);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 16
0
        public HttpResponseBase mailSetSave()
        {
            string result = "{success:false}";

            try
            {
                if (!string.IsNullOrEmpty(Request.Params["jsonSave"]))
                {
                    string json = Request.Params["jsonSave"];
                    System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
                    List<Parametersrc> paraList = js.Deserialize<List<Parametersrc>>(json);
                    IParametersrcImplMgr _paraMgr = new BLL.gigade.Mgr.ParameterMgr(connectionString);

                    if (paraList.Count() > 0)
                    {
                        if (paraList[0].Rowid != 0)         //更新
                        {
                            List<Parametersrc> updateList = new List<Parametersrc>();
                            paraList.ForEach(m =>
                            {
                                Parametersrc query = _paraMgr.QueryUsed(new Parametersrc { Rowid = m.Rowid }).FirstOrDefault();
                                query.ParameterCode = m.ParameterCode;
                                updateList.Add(query);
                            });
                            if (_paraMgr.Update(updateList))
                            {
                                result = "{success:true}";
                            }
                        }
                        else                                //保存
                        {
                            string c_kuser = (Session["caller"] as Caller).user_email;
                            paraList.ForEach(m => m.Kuser = c_kuser);
                            if (_paraMgr.Save(paraList))
                            {
                                result = "{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);
            }


            this.Response.Clear();
            this.Response.Write(result);
            this.Response.End();
            return this.Response;
        }