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; }
public string QueryPara() { paraMgr = new ParameterMgr(connectionString); string json = string.Empty; try { if (!string.IsNullOrEmpty(Request.QueryString["paraType"])) { json = paraMgr.Query(Request.QueryString["paraType"].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); json = "[]"; } return json; }
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; }
public HttpResponseBase GetVendorType() { string vendorType = ""; if (!string.IsNullOrEmpty(Request.Params["VendorType"])) { vendorType = Request.Params["VendorType"]; } List<Parametersrc> list = new List<Parametersrc>(); paraMgr = new ParameterMgr(connectionString); string types = "vendor_type"; list = paraMgr.GetElementType(types); string VendorTypeName = ""; string jsonStr = string.Empty; try { if (!string.IsNullOrEmpty(vendorType)) { string[] vendor_types = vendorType.Split(','); for (int i = 0; i < vendor_types.Length; i++) { for (int j = 0; j < list.Count; j++) { if (list[j].ParameterCode == vendor_types[i].ToString()) { VendorTypeName += list[j].parameterName + ","; } } } VendorTypeName = VendorTypeName.Substring(0, VendorTypeName.Length - 1); } jsonStr = "{success:true,msg:\"" + VendorTypeName + "\"}"; } 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); this.Response.End(); return this.Response; }
public HttpResponseBase GetVendorTypeStore() { paraMgr = new ParameterMgr(connectionString); List<Parametersrc> store = new List<Parametersrc>(); string json = string.Empty; List<VendorQuery> query = new List<VendorQuery>(); try { string type = "vendor_type"; store = paraMgr.GetElementType(type); for (int i = 0; i < store.Count; i++) { VendorQuery vendor = new VendorQuery(); vendor.vendor_type = store[i].ParameterCode.ToString(); vendor.vendor_type_name = store[i].parameterName.ToString(); query.Add(vendor); } json = "{success:true,data:" + JsonConvert.SerializeObject(query, Formatting.Indented) + "}"; } 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; }
public string QueryParameter(Parametersrc p) { string json = string.Empty; try { paraMgr = new ParameterMgr(connectionString); json = paraMgr.QueryBindData(p); } 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; }
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; }
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; }
public HttpResponseBase GetDspDeliverStoreList() { List<Parametersrc> stores = new List<Parametersrc>(); string json = string.Empty; try { Parametersrc p = new Parametersrc(); p.parameterName = "不分"; p.ParameterCode = "0"; IParametersrcImplMgr IPImplMgr = new ParameterMgr(connectionString); stores = IPImplMgr.ReturnParametersrcList(); if (string.IsNullOrEmpty(Request.Params["type"])) { stores.Insert(0, p); } json = "{success:true,data:" + JsonConvert.SerializeObject(stores) + "}"; } 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> /// <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; }
/// <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 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; }
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; }
public string GetStore() { string storeType = Request.Form["storeType"] ?? "0"; string channelId = Request.Form["channel_id"] ?? "0"; string resultStr = ""; ParameterMgr paraMgr = new ParameterMgr(connectionString); ChannelShippingMgr shipMgr = new ChannelShippingMgr(connectionString); //switch (storeType) //{ // case "1": resultStr = shipMgr.QueryCarry(channelId); break; // case "2": resultStr = paraMgr.Query("Deliver_Store", 1); break; // default: // break; //} resultStr = shipMgr.QueryCarry(channelId); return resultStr; }
public string GetPayment() { ParameterMgr paraMgr = new ParameterMgr(connectionString); return paraMgr.Query("payment", 1); }
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; }
public HttpResponseBase GetQuestionTypeList() { IParametersrcImplMgr parametersrcMgr = new BLL.gigade.Mgr.ParameterMgr(mySqlConnectionString); List<Parametersrc> parametersrclist = new List<Parametersrc>(); string json = string.Empty; try { string type = "problem_category"; parametersrclist = parametersrcMgr.GetElementType(type); json = "{success:true,data:" + JsonConvert.SerializeObject(parametersrclist) + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
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 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 string GetProductDeliverySet() { IParametersrcImplMgr parame = new ParameterMgr(connectionString); string parameFun = "freight_big_area"; try { return parame.Query(parameFun); } 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 ""; }
/// <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; }
public string getCateType() { string resultStr = ""; try { ParameterMgr paraMgr = new ParameterMgr(connectionString); resultStr = paraMgr.Query("product_spec"); } 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 resultStr; }
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; }
//獲取相應物流配送模式 public JsonResult GetProductDeliverySetById(string rangeid) { IParametersrcImplMgr parame = new ParameterMgr(connectionString); Parametersrc p = new Parametersrc(); JsonResult result = null; try { p.ParameterType = "freight_type"; p.TopValue = rangeid; result = Json(parame.QueryForTopValue(p)); } 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 result; }
/// <summary> /// 獲取供應商列表數據 /// </summary> /// <returns></returns> public HttpResponseBase GetVendorList() { List<VendorQuery> stores = new List<VendorQuery>(); string json = string.Empty; try { _vendorMgr = new VendorMgr(connectionString); #region 搜索條件 VendorQuery query = new VendorQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量 if (!string.IsNullOrEmpty(Request.Params["relation_id"])) { query.vendor_id = Convert.ToUInt32(Request.Params["relation_id"].ToString()); } if (!string.IsNullOrEmpty(Request.Params["VendorId"])) { query.vendor_id = Convert.ToUInt32(Request.Params["VendorId"].ToString()); } string type = string.Empty; string con = string.Empty; if (!string.IsNullOrEmpty(Request.Params["dateType"])) { type = Request.Params["dateType"].ToString(); } if (!string.IsNullOrEmpty(Request.Params["dateCon"])) { con = Request.Params["dateCon"].ToString(); } int totalCount = 0; if (!string.IsNullOrEmpty(type) && !string.IsNullOrEmpty(con) && type != "0") {//當查詢條件和查詢內容都有值時執行 switch (type) { case "0": break; case "1": query.searchEmail = con.ToLower(); break; case "2": query.searchName = con; break; case "3": query.vendor_name_full = con; break; case "4": query.searchInvoice = con; break; case "5": query.erp_id = con; break; case "6": uint isTranUint = 0; if (uint.TryParse(con, out isTranUint)) { query.vendor_id = Convert.ToUInt32(con); } break; case "7": query.vendor_code = con; break; } if (!string.IsNullOrEmpty(Request.Params["vendortype"]))//供应商类型 { query.vendor_type = Request.Params["vendortype"].ToString(); query.vendor_type = query.vendor_type.TrimEnd(','); } if (!string.IsNullOrEmpty(Request.Params["dateOne"])) { // query.create_dateOne = (uint)CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["dateOne"]).ToString("yyyy-MM-dd 00:00:00")); query.create_dateOne = (uint)CommonFunction.GetPHPTime(Request.Params["dateOne"]); } if (!string.IsNullOrEmpty(Request.Params["dateTwo"])) { //query.create_dateTwo = (uint)CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["dateTwo"]).ToString("yyyy-MM-dd 23:59:59")); query.create_dateTwo = (uint)CommonFunction.GetPHPTime(Request.Params["dateTwo"]); } stores = _vendorMgr.Query(query, ref totalCount); } else { //當查詢條件和查詢內容都沒有值時執行 if (!string.IsNullOrEmpty(Request.Params["vendortype"]))//供应商类型 { query.vendor_type = Request.Params["vendortype"].ToString(); query.vendor_type = query.vendor_type.TrimEnd(','); } if (!string.IsNullOrEmpty(Request.Params["dateOne"])) { //query.create_dateOne = (uint)CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["dateOne"]).ToString("yyyy-MM-dd 00:00:00")); query.create_dateOne = (uint)CommonFunction.GetPHPTime(Request.Params["dateOne"]); } if (!string.IsNullOrEmpty(Request.Params["dateTwo"])) { //query.create_dateTwo = (uint)CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["dateTwo"]).ToString("yyyy-MM-dd 23:59:59")); query.create_dateTwo = (uint)CommonFunction.GetPHPTime(Request.Params["dateTwo"]); } stores = _vendorMgr.Query(query, ref totalCount); } #endregion #region 供應商類型參數 List<Parametersrc> list = new List<Parametersrc>(); paraMgr = new ParameterMgr(connectionString); string types = "vendor_type"; list = paraMgr.GetElementType(types); #endregion foreach (var item in stores) { item.vendor_name_full = Server.HtmlDecode(Server.HtmlDecode(item.vendor_name_full)); item.vendor_name_simple = Server.HtmlDecode(Server.HtmlDecode(item.vendor_name_simple)); string temp = string.Empty; #region 供應商類型關聯參數表 if (!string.IsNullOrEmpty(item.vendor_type) && item.vendor_type != null) { string[] vendor_types = item.vendor_type.Split(','); for (int i = 0; i < vendor_types.Length; i++) { for (int j = 0; j < list.Count; j++) { if (list[j].ParameterCode == vendor_types[i].ToString()) { item.vendor_type_name += list[j].parameterName + ","; } } } item.vendor_type_name = item.vendor_type_name.Substring(0, item.vendor_type_name.Length - 1); } #endregion if (item.self_send_days == 0) { if (item.stuff_ware_days == 0) { if (item.dispatch_days == 0) { temp = ""; } else { temp = "調度"; } } else { if (item.dispatch_days == 0) { temp = "寄倉"; } else { temp = "寄倉,調度"; } } } else { if (item.stuff_ware_days == 0) { if (item.dispatch_days == 0) { temp = "自出"; } else { temp = "自出,調度"; } } else { if (item.dispatch_days == 0) { temp = "自出,寄倉"; } else { temp = "自出,寄倉,調度"; } } } item.vendor_mode = temp; if (Convert.ToBoolean(Request.Params["isSecret"])) { if (!string.IsNullOrEmpty(item.vendor_name_full)) { item.vendor_name_full = item.vendor_name_full.Substring(0, 1) + "**"; } // if (!string.IsNullOrEmpty(item.vendor_name_simple)) { item.vendor_name_simple = item.vendor_name_simple.Substring(0, 1) + "**"; }//vendor_company_address if (item.vendor_company_address.ToString().Length > 3) { item.vendor_company_address = item.vendor_company_address.Substring(0, 3) + "***"; } else { item.vendor_company_address = item.vendor_company_address + "***"; } if (!string.IsNullOrEmpty(item.contact_email_1)) { item.contact_email_1 = item.contact_email_1.Split('@')[0] + "@***"; } if (!string.IsNullOrEmpty(item.contact_email_2)) { item.contact_email_2 = item.contact_email_2.Split('@')[0] + "@***"; } if (!string.IsNullOrEmpty(item.contact_email_3)) { item.contact_email_3 = item.contact_email_3.Split('@')[0] + "@***"; } if (!string.IsNullOrEmpty(item.contact_email_4)) { item.contact_email_4 = item.contact_email_4.Split('@')[0] + "@***"; } if (!string.IsNullOrEmpty(item.contact_email_5)) { item.contact_email_5 = item.contact_email_5.Split('@')[0] + "@***"; } if (item.contact_mobile_1.ToString().Length > 3) { item.contact_mobile_1 = item.contact_mobile_1.Substring(0, 3) + "***"; } else { item.contact_mobile_1 = item.contact_mobile_1 + "***"; } if (item.contact_mobile_2.ToString().Length > 3) { item.contact_mobile_2 = item.contact_mobile_2.Substring(0, 3) + "***"; } else { item.contact_mobile_2 = item.contact_mobile_2 + "***"; } if (item.contact_mobile_3.ToString().Length > 3) { item.contact_mobile_3 = item.contact_mobile_3.Substring(0, 3) + "***"; } else { item.contact_mobile_3 = item.contact_mobile_3 + "***"; } if (item.contact_mobile_4.ToString().Length > 3) { item.contact_mobile_4 = item.contact_mobile_4.Substring(0, 3) + "***"; } else { item.contact_mobile_4 = item.contact_mobile_4 + "***"; } if (item.contact_mobile_5.ToString().Length > 3) { item.contact_mobile_5 = item.contact_mobile_5.Substring(0, 3) + "***"; } else { item.contact_mobile_5 = item.contact_mobile_5 + "***"; } if (item.contact_phone_1_1.ToString().Length > 3) { item.contact_phone_1_1 = item.contact_phone_1_1.Substring(0, 3) + "***"; } else { item.contact_phone_1_1 = item.contact_phone_1_1 + "***"; } if (item.contact_phone_1_2.ToString().Length > 3) { item.contact_phone_1_2 = item.contact_phone_1_2.Substring(0, 3) + "***"; } else { item.contact_phone_1_2 = item.contact_phone_1_2 + "***"; } if (item.contact_phone_1_3.ToString().Length > 3) { item.contact_phone_1_3 = item.contact_phone_1_3.Substring(0, 3) + "***"; } else { item.contact_phone_1_3 = item.contact_phone_1_3 + "***"; } if (item.contact_phone_1_4.ToString().Length > 3) { item.contact_phone_1_4 = item.contact_phone_1_4.Substring(0, 3) + "***"; } else { item.contact_phone_1_4 = item.contact_phone_1_4 + "***"; } if (item.contact_phone_1_5.ToString().Length > 3) { item.contact_phone_1_5 = item.contact_phone_1_5.Substring(0, 3) + "***"; } else { item.contact_phone_1_5 = item.contact_phone_1_5 + "***"; } if (item.contact_phone_2_1.ToString().Length > 3) { item.contact_phone_2_1 = item.contact_phone_2_1.Substring(0, 3) + "***"; } else { item.contact_phone_2_1 = item.contact_phone_2_1 + "***"; } if (item.contact_phone_2_2.ToString().Length > 3) { item.contact_phone_2_2 = item.contact_phone_2_2.Substring(0, 3) + "***"; } else { item.contact_phone_2_2 = item.contact_phone_2_2 + "***"; } if (item.contact_phone_2_3.ToString().Length > 3) { item.contact_phone_2_3 = item.contact_phone_2_3.Substring(0, 3) + "***"; } else { item.contact_phone_2_3 = item.contact_phone_2_3 + "***"; } if (item.contact_phone_2_4.ToString().Length > 3) { item.contact_phone_2_4 = item.contact_phone_2_4.Substring(0, 3) + "***"; } else { item.contact_phone_2_4 = item.contact_phone_2_4 + "***"; } if (item.contact_phone_2_5.ToString().Length > 3) { item.contact_phone_2_5 = item.contact_phone_2_5.Substring(0, 3) + "***"; } else { item.contact_phone_2_5 = item.contact_phone_2_5 + "***"; } if (!string.IsNullOrEmpty(item.contact_name_1)) { item.contact_name_1 = item.contact_name_1.Substring(0, 1) + "**"; } if (!string.IsNullOrEmpty(item.contact_name_2)) { item.contact_name_2 = item.contact_name_2.Substring(0, 1) + "**"; } if (!string.IsNullOrEmpty(item.contact_name_3)) { item.contact_name_3 = item.contact_name_3.Substring(0, 1) + "**"; } if (!string.IsNullOrEmpty(item.contact_name_4)) { item.contact_name_4 = item.contact_name_4.Substring(0, 1) + "**"; } if (!string.IsNullOrEmpty(item.contact_name_5)) { item.contact_name_5 = item.contact_name_5.Substring(0, 1) + "**"; } if (!string.IsNullOrEmpty(item.manage_name)) { item.manage_name = item.manage_name.Substring(0, 1) + "**"; } if (!string.IsNullOrEmpty(item.manage_email)) { item.manage_email = item.manage_email.Split('@')[0] + "@***"; } if (!string.IsNullOrEmpty(item.vendor_email)) { item.vendor_email = item.vendor_email.Split('@')[0] + "@***"; } if (!string.IsNullOrEmpty(item.company_person)) { item.company_person = item.company_person.Substring(0, 1) + "**"; } if (item.company_address.ToString().Length > 3) { item.company_address = item.company_address.Substring(0, 3) + "***"; } else { item.company_address = item.company_address + "***"; } if (item.invoice_address.ToString().Length > 3) { item.invoice_address = item.invoice_address.Substring(0, 3) + "***"; } else { item.invoice_address = item.invoice_address + "***"; } } } IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",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:false,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
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; }
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); } }
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; }
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; }
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; }