private void CreateGiftCardInfoList(DataSet dsItem, string companyCode, string StoreCompanyCode, string GiftCardFabricationSysNo) { StringBuilder messageBuilder = new StringBuilder(); XmlWriterSettings setting = new XmlWriterSettings(); setting.Encoding = Encoding.Unicode; using (XmlWriter xmlWriter = XmlWriter.Create(messageBuilder, setting)) { xmlWriter.WriteStartElement("Message"); xmlWriter.WriteStartElement("Header"); #region header xmlWriter.WriteElementString("Action", "Fabrication"); xmlWriter.WriteElementString("Version", "V1"); xmlWriter.WriteElementString("From", "IPP.Content"); xmlWriter.WriteElementString("CurrencySysNo", "1"); xmlWriter.WriteElementString("Language", "zh-CN"); xmlWriter.WriteElementString("CompanyCode", companyCode); xmlWriter.WriteElementString("StoreCompanyCode", StoreCompanyCode); #endregion xmlWriter.WriteEndElement(); xmlWriter.WriteStartElement("Body"); xmlWriter.WriteElementString("EditUser", "System"); #region giftcard list xmlWriter.WriteStartElement("GiftCard"); xmlWriter.WriteElementString("ReferenceSysno", GiftCardFabricationSysNo); xmlWriter.WriteStartElement("ItemInfo"); foreach (DataRow item in dsItem.Tables[0].Rows) { xmlWriter.WriteStartElement("Item"); xmlWriter.WriteElementString("TotalAmount", item["CurrentPrice"].ToString()); xmlWriter.WriteElementString("Quantity", item["Quantity"].ToString()); xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); #endregion xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); } WriteLog("GiftCardFabricationSysNo:" + GiftCardFabricationSysNo + "SP调用生成卡号...."); GiftCardDA.GiftCardFabricationECOperateGiftCard(messageBuilder.ToString()); }
public void Starter() { DataSet dsMaster = GiftCardDA.GetGiftCardFabricationMaster(companyCode); if (dsMaster == null || dsMaster.Tables.Count == 0 || dsMaster.Tables[0].Rows.Count == 0) { WriteLog("无审核通过制作卡单,JOB运行结束..."); return; } foreach (DataRow drRow in dsMaster.Tables[0].Rows) { DataSet dsPassItem = GiftCardDA.GetPassGiftCardInfo(drRow["GiftCardFabricationSysNo"].ToString(), companyCode); if (dsPassItem != null && dsPassItem.Tables.Count > 0 && dsPassItem.Tables[0].Rows.Count > 0 && decimal.Parse(dsPassItem.Tables[0].Rows[0][0].ToString()) > 0) { continue; } DataSet dsItem = GiftCardDA.GetGiftCardFabricationItem(drRow["GiftCardFabricationSysNo"].ToString(), companyCode, gcC3Number, iManufacturerSysNo); if (dsItem == null || dsItem.Tables.Count == 0 || dsItem.Tables[0].Rows.Count == 0) { WriteLog("GiftCardFabricationSysNo:" + drRow["GiftCardFabricationSysNo"].ToString() + "无有效的礼品卡信息."); continue; } WriteLog("GiftCardFabricationSysNo:" + drRow["GiftCardFabricationSysNo"].ToString() + "礼品卡信息SP调用开始..."); decimal decTotalCount = 0; decTotalCount = (String.IsNullOrEmpty(drRow["TotalCount"].ToString())) ? 0 : decimal.Parse(drRow["TotalCount"].ToString()); DataSet dsInfoResult = GiftCardDA.CheckGiftCardInfo(); if (dsInfoResult != null && dsInfoResult.Tables.Count > 0 && dsInfoResult.Tables[0].Rows.Count > 0) { decimal TotalPass = String.IsNullOrEmpty(dsInfoResult.Tables[0].Rows[0]["TotalPass"].ToString()) ? 0 : decimal.Parse(dsInfoResult.Tables[0].Rows[0]["TotalPass"].ToString()); if (decTotalCount > TotalPass) { WriteLog("GiftCardFabricationSysNo:" + drRow["GiftCardFabricationSysNo"].ToString() + "无法生成礼品卡信息,原因:有效卡号不足."); //Console.WriteLine("有效卡号不足,JOB运行结束..."); try { SendFailEmail("GiftCardFabricationSysNo:" + drRow["GiftCardFabricationSysNo"].ToString() + " JOB无法生成礼品卡信息,原因:有效卡号不足."); } catch { } continue; } } if (decTotalCount <= ItemBatchPageSize) { CreateGiftCardInfoList(dsItem, companyCode, StoreCompanyCode, drRow["GiftCardFabricationSysNo"].ToString()); } else { BatchCreateGiftCardInfoList(dsItem, companyCode, StoreCompanyCode, drRow["GiftCardFabricationSysNo"].ToString(), ItemBatchPageSize); } WriteLog("GiftCardFabricationSysNo:" + drRow["GiftCardFabricationSysNo"].ToString() + "礼品卡信息SP调用结束..."); } WriteLog("审核通过制作卡单生成卡号成功,JOB运行结束..."); }
public static string LookPassword(string Code, int CurrentCustomerSysNo) { return(GiftCardDA.LookPassword(Code, CurrentCustomerSysNo)); }
/// <summary> /// 修改礼品卡密码 /// </summary> /// <param name="code">卡号</param> /// <param name="pwd">新密码</param> public static void ModifyGiftCardPwd(string code, string pwd) { pwd = CryptoManager.Encrypt(pwd);//加密 GiftCardDA.ModifyGiftCardPwd(code, pwd); }
/// <summary> /// 礼品卡绑定帐号 /// </summary> /// <param name="code">卡号</param> /// <param name="customerSysNo">帐户</param> /// <returns></returns> public static bool BindGiftCard(string code, int customerSysNo) { return(GiftCardDA.BindGiftCard(code, customerSysNo)); }
/// <summary> /// 通过卡号和密码加载礼品卡 /// </summary> /// <param name="code">卡号</param> /// <param name="password">密码</param> /// <returns>礼品卡信息</returns> public static GiftCardInfo LoadGiftCard(string code, string password) { password = CryptoManager.Encrypt(password);//加密比对 return(GiftCardDA.LoadGiftCard(code, password)); }
public static QueryResult <GiftCardInfo> QueryMyGiftCardInfo(MyGiftCardQueryInfoFilter filter) { return(GiftCardDA.QueryMyGiftCardInfo(filter)); }
/// <summary> /// 获取礼品卡商品基本信息 /// </summary> /// <param name="productSysNo"></param> /// <returns></returns> public static List <GiftCardProductInfo> QueryGiftCardProductInfo() { return(GiftCardDA.QueryGiftCardProductInfo()); }
/// <summary> /// 礼品卡消费记录 /// </summary> /// <param name="query"></param> /// <returns></returns> public static QueryResult <GiftCardUseInfo> QueryUsedRecord(UsedRecordQuery query) { return(GiftCardDA.QueryUsedRecord(query)); }