public CardTypeInfo GetInfoFromDataRow(DataRow theDataRow) { CardTypeInfo objCardTypeInfo = new CardTypeInfo(); objCardTypeInfo.Id = new Guid(theDataRow["id"].ToString()); objCardTypeInfo.SaasId = new Guid(theDataRow["saas_id"].ToString()); objCardTypeInfo.Batch = theDataRow["batch"].ToString(); objCardTypeInfo.Name = theDataRow["name"].ToString(); objCardTypeInfo.Memo = theDataRow["memo"].ToString(); objCardTypeInfo.CostType = (CardTypeInfo.CardTypeInfoCostType) int.Parse(theDataRow["cost_type"].ToString()); objCardTypeInfo.Purpose = (CardTypeInfo.CardTypeInfoPurpose) int.Parse(theDataRow["purpose"].ToString()); objCardTypeInfo.SubmitType = (CardTypeInfo.CardTypeInfoSubmitType) int.Parse(theDataRow["submit_type"].ToString()); objCardTypeInfo.Status = (CardTypeInfo.CardTypeInfoStatus) int.Parse(theDataRow["status"].ToString()); objCardTypeInfo.CreateTime = DateTime.Parse(theDataRow["create_time"].ToString()); objCardTypeInfo.EffectDate = DateTime.Parse(theDataRow["effect_date"].ToString()); objCardTypeInfo.OutDate = DateTime.Parse(theDataRow["out_date"].ToString()); objCardTypeInfo.MaxChargesDate = Int32.Parse(theDataRow["max_charges_date"].ToString()); objCardTypeInfo.MaxMoney = decimal.Parse(theDataRow["max_money"].ToString() == "" ? "0" : theDataRow["max_money"].ToString()); objCardTypeInfo.MaxTimes = Int32.Parse(theDataRow["max_times"].ToString()); objCardTypeInfo.DefaultChargesDate = Int32.Parse(theDataRow["default_charges_date"].ToString()); objCardTypeInfo.DefaultMoney = decimal.Parse(theDataRow["default_money"].ToString() == "" ? "0" : theDataRow["default_money"].ToString()); objCardTypeInfo.DefaultTimes = Int32.Parse(theDataRow["default_times"].ToString()); objCardTypeInfo.DefaultChange = (CardTypeInfo.CardTypeInfoDefaultChange) int.Parse(theDataRow["default_change"].ToString()); objCardTypeInfo.DefaultCardStatus = (CardTypeInfo.CardTypeInfoDefaultCardStatus) int.Parse(theDataRow["default_card_status"].ToString()); objCardTypeInfo.RowNumber = theDataRow["rowNumber"].ToString(); objCardTypeInfo.extSaasId = Int32.Parse(string.IsNullOrEmpty(theDataRow["ext_saas_id"].ToString()) ? "0" : theDataRow["ext_saas_id"].ToString()); objCardTypeInfo.extCardTypeId = Int32.Parse(string.IsNullOrEmpty(theDataRow["ext_card_type_id"].ToString()) ? "0" : theDataRow["ext_card_type_id"].ToString()); return(objCardTypeInfo); }
//针对WebSerice转换成Hashtable来转输 public Hashtable InfoToHashtable(CardTypeInfo theCardTypeInfo) { Hashtable objHashtable = new Hashtable(); objHashtable.Add("id", theCardTypeInfo.Id); objHashtable.Add("saas_id", theCardTypeInfo.SaasId); objHashtable.Add("batch", theCardTypeInfo.Batch); objHashtable.Add("name", theCardTypeInfo.Name); objHashtable.Add("purpose", theCardTypeInfo.Purpose); objHashtable.Add("cost_type", theCardTypeInfo.CostType); objHashtable.Add("submit_type", theCardTypeInfo.SubmitType); objHashtable.Add("effect_date", theCardTypeInfo.EffectDate); objHashtable.Add("out_date", theCardTypeInfo.OutDate); objHashtable.Add("max_times", theCardTypeInfo.MaxTimes); objHashtable.Add("max_money", theCardTypeInfo.MaxMoney); objHashtable.Add("max_charges_date", theCardTypeInfo.MaxChargesDate); objHashtable.Add("default_charges_date", theCardTypeInfo.DefaultChargesDate); objHashtable.Add("default_money", theCardTypeInfo.DefaultMoney); objHashtable.Add("default_times", theCardTypeInfo.DefaultTimes); objHashtable.Add("default_change", theCardTypeInfo.DefaultChange.ToString("D")); objHashtable.Add("default_card_status", theCardTypeInfo.DefaultCardStatus.ToString("D")); objHashtable.Add("memo", theCardTypeInfo.Memo); objHashtable.Add("status", theCardTypeInfo.Status.ToString("D")); objHashtable.Add("create_user", theCardTypeInfo.CreateUser); objHashtable.Add("create_time", theCardTypeInfo.CreateTime); objHashtable.Add("modify_user", theCardTypeInfo.ModifyUser); objHashtable.Add("modify_time", theCardTypeInfo.ModifyTime); return(objHashtable); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tbnSave_Click(object sender, EventArgs e) { CardTypeInfo objCardTypeInfo = GetInfoFormForm(); //增加 if (_eumActionType == ActionType.Insert) { if (objCardTypeInfo != null) { _objSystemMessageInfo = _objCardTypeBLL.Insert(ref objCardTypeInfo, null); } if (_objSystemMessageInfo.Success) { _objId = objCardTypeInfo.Id; _eumActionType = ActionType.Update; this.Text = CardTypeInfo.InfoName + "[修改]"; } } //修改 else if (_eumActionType == ActionType.Update) { if (objCardTypeInfo != null) { _objSystemMessageInfo = _objCardTypeBLL.Update(objCardTypeInfo, null); } } else if (_eumActionType == ActionType.View || _eumActionType == ActionType.Init) { if (objCardTypeInfo != null) { this.Close(); } } }
public async Task <ActionResult> Index(CreditCardForm creditCardForm) { // Validate card type. CardType expectedCardType = CardTypeInfo.GetCardType(creditCardForm.CreditCardNumber); if (expectedCardType == CardType.Unknown || expectedCardType != creditCardForm.CreditCardType) { ModelState.AddModelError("CreditCardType", "The Credit Card Type field does not match against the credit card number."); } if (!ModelState.IsValid) { return(View(creditCardForm)); } //update the store inventory var shoppingCartItem = _shoppingCart.GetShoppingCartItems(); foreach (var item in shoppingCartItem) { UpdateStoreInventory(item); } //clear shopping cart after pay await _shoppingCart.ClearCartAsync(); return(View("PaymentReceived")); }
public SystemMessageInfo Update(CardTypeInfo theCardTypeInfo, DataAccessor theDataAccessor) { SystemMessage _objSystemMessage = new SystemMessage(); SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo(); //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用 Hashtable objHashtable = InfoToHashtable(theCardTypeInfo); XmlDocument objXmlDocument = Helper.FormatConvert.HashtableToXml(objHashtable); //Hashtable objHashtable2= Helper.FormatConvert.XmlToHashtable(objXmlDocument); try { //Itsp2WebServiceNamespace.Itsp2WebService objItsp2WebService = new Itsp2WebServiceNamespace.Itsp2WebService(); //objItsp2WebService.UpdateCardTypeByCondition(objXmlDocument.OuterXml); ServiceWrapper.Current.UpdateCardTypeByCondition(objXmlDocument.OuterXml); } catch (Exception e) { _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("WebServiceConnectFail"); _objSystemMessageInfo.Success = false; _objSystemMessageInfo.Exception = e.Message; return(_objSystemMessageInfo); } _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("DataSaveSucceeded"); return(_objSystemMessageInfo); }
public async Task <IActionResult> Pay(CreditCardForm creditCardForm) { // Validate card type. CardType expectedCardType = CardTypeInfo.GetCardType(creditCardForm.CreditCardNumber); if (expectedCardType == CardType.Unknown || expectedCardType != creditCardForm.CreditCardType) { ModelState.AddModelError("CreditCardType", "The Credit Card Type field does not match against the credit card number."); } if (!ModelState.IsValid) { return(View(creditCardForm)); } var purchaseList = await customer.ProcessCart(); Order order = new Order(); order.CustomerID = customer.ID; order.Date = DateTime.Now; order.TotalPrice = decimal.Round(purchaseList.Sum(p => p.SubTotal), 2); _context.Update(order); await _context.SaveChangesAsync(); ViewData["orderID"] = order.OrderID; ViewData["TotalPrice"] = order.TotalPrice; ViewData["Date"] = order.Date; return(View("Confirmation", purchaseList)); }
/// <summary> /// Validates that tender line fulfills limits configured for card type. /// </summary> /// <param name="context">The request context.</param> /// <param name="tenderLine">Payment information.</param> /// <returns>Collection of <see cref="DataValidationFailure"/>.</returns> private static IEnumerable <DataValidationFailure> ValidateCardTypeLimits(RequestContext context, TenderLine tenderLine) { List <DataValidationFailure> failures = new List <DataValidationFailure>(); CardTypeInfo cardTypeInfo = CardTypeHelper.GetCardTypeConfiguration(tenderLine.CardTypeId, context); if (cardTypeInfo == null) { failures.Add(new DataValidationFailure(DataValidationErrors.Microsoft_Dynamics_Commerce_Runtime_ObjectNotFound, "Card type with id '{0}' not found", tenderLine.CardTypeId)); } if (tenderLine.CashBackAmount < 0) { failures.Add(new DataValidationFailure(DataValidationErrors.Microsoft_Dynamics_Commerce_Runtime_InvalidCashBackAmount, "Cash back amount cannot be negative.")); } if (tenderLine.CashBackAmount != 0 && tenderLine.Amount < 0) { failures.Add(new DataValidationFailure(DataValidationErrors.Microsoft_Dynamics_Commerce_Runtime_AmountDueMustBePaidBeforeCheckout, "Cash back not allowed for refunds.")); } if (cardTypeInfo != null && tenderLine.CashBackAmount > cardTypeInfo.CashBackLimit) { string message = string.Format("Cash back amount for card type '{0}' exceed maximum allowed value {1}.", cardTypeInfo.TypeId, cardTypeInfo.CashBackLimit); failures.Add(new DataValidationFailure(DataValidationErrors.Microsoft_Dynamics_Commerce_Runtime_InvalidCashBackAmount, message)); } return(failures); }
public CardTypeInfo GetById(Guid theId, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo) { SystemMessage _objSystemMessage = new SystemMessage(); SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo(); if (theId == SystemConstant.GuidEmpty) { return(null); } //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用 Hashtable objHashtable = new Hashtable(); objHashtable.Add("id", theId); //这里的后台写法仅支持传一个对象删除的方法 //CardTypeInfo objCardTypeInfoCondition = new CardTypeInfo(); //objCardTypeInfoCondition.Id = theId; //Hashtable objHashtable = InfoToHashtable(objCardTypeInfoCondition); XmlDocument objXmlDocument = Helper.FormatConvert.HashtableToXml(objHashtable); CardTypeInfo objCardTypeInfo = null; DataSet objDataSet = new DataSet(); try { //Itsp2WebServiceNamespace.Itsp2WebService objItsp2WebService = new Itsp2WebServiceNamespace.Itsp2WebService(); //string strReturnXml = objItsp2WebService.SelectCardTypeByCondition(objXmlDocument.OuterXml); string[] strReturnXml = ServiceWrapper.Current.SelectCardTypeByCondition(objXmlDocument.OuterXml, "effect_date desc", 1, 1); objDataSet = Helper.FormatConvert.XmlToDataSet(strReturnXml[1]); try { if (objDataSet.Tables.Count > 0) { foreach (DataRow objDataRow in objDataSet.Tables[0].Rows) { objCardTypeInfo = GetInfoFromDataRow(objDataRow); } } } catch (Exception e) { _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("WebServiceParseToInfoFail"); _objSystemMessageInfo.Success = false; _objSystemMessageInfo.Exception = e.Message; } } catch (Exception e) { _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("WebServiceConnectFail"); _objSystemMessageInfo.Success = false; _objSystemMessageInfo.Exception = e.Message; } theSystemMessageInfo = _objSystemMessageInfo; return(objCardTypeInfo); }
static public int GetPhyAttack(int id, int level, int yellowPoint = 1) { HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(id); if (null == info) { return(0); } RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity); if (rarityInfo == null) { return(0); } QualityInfo qualityInfo = GameTable.qualityRelativeAsset.LookUp(info.Quality); if (qualityInfo == null) { return(0); } CardTypeInfo cardTypeInfo = GameTable.cardTypeVariationAsset.LookUp((int)info.AttrTypeID); if (cardTypeInfo == null) { return(0); } LevelUpInfo levelUpInfo = GameTable.LevelUpTableAsset.LookUp(level); if (levelUpInfo == null) { return(0); } CardLevelInfo cardLevelInfo = GameTable.cardLevelVariationAsset.LookUp((int)info.levelTypeID); if (cardLevelInfo == null) { return(0); } YellowPointInfo yellowPointInfo = GameTable.yellowPointParamAsset.LookUp(yellowPoint); if (yellowPointInfo == null) { return(0); } //Debug.Log("(" + info.FPhyAttack + "+" + cardTypeInfo.m_phyAtt + ") * (1 +" + cardLevelInfo.m_phyAttParam + "*" + level + "+" + yellowPointInfo.m_phyAttParam + ")*(" + rarityInfo.m_mainAttrMutiply +"+"+ qualityInfo.m_mainAttrMutiply+")"); // 计算物理攻击力 float attack = (info.FPhyAttack + cardTypeInfo.m_phyAtt) * (1 + cardLevelInfo.m_phyAttParam * level + yellowPointInfo.m_phyAttParam) * (rarityInfo.m_mainAttrMutiply + qualityInfo.m_mainAttrMutiply); return((int)attack); }
// 获得当前物理防御力 static public int GetPhyDefend(int id, int level, int yellowPoint = 1) { HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(id); if (null == info) { return(0); } RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity); if (rarityInfo == null) { return(0); } QualityInfo qualityInfo = GameTable.qualityRelativeAsset.LookUp(info.Quality); if (qualityInfo == null) { return(0); } CardTypeInfo cardTypeInfo = GameTable.cardTypeVariationAsset.LookUp((int)info.AttrTypeID); if (cardTypeInfo == null) { return(0); } LevelUpInfo levelUpInfo = GameTable.LevelUpTableAsset.LookUp(level); if (levelUpInfo == null) { return(0); } CardLevelInfo cardLevelInfo = GameTable.cardLevelVariationAsset.LookUp((int)info.levelTypeID); if (cardLevelInfo == null) { return(0); } YellowPointInfo yellowPointInfo = GameTable.yellowPointParamAsset.LookUp(yellowPoint); if (yellowPointInfo == null) { return(0); } // 获得当前魔法 防御力 float attack = (info.FPhyDefend + cardTypeInfo.m_phyDef) * (1 + cardLevelInfo.m_phyDefParam * level + yellowPointInfo.m_phyDefParam) * (rarityInfo.m_mainAttrMutiply + qualityInfo.m_mainAttrMutiply); return((int)attack); }
public CardTypeInfo LookUp(int quality) { CardTypeInfo info = null; if (m_map.TryGetValue(quality, out info)) { return(info); } return(null); }
/// <summary> /// 为控件赋值 /// </summary> /// <param name="theId"></param> private void SetFormFromInfo(Guid theId) { if (theId != Bouwa.Helper.SystemConstant.GuidEmpty) { _objCardTypeInfo = _objCardTypeBLL.GetById(theId, null, ref _objSystemMessageInfo); if (!_objSystemMessageInfo.Success) { MessageBoxForm.Show(_objSystemMessageInfo, MessageBoxButtons.OK); } if (_objCardTypeInfo != null) { this.txtBatch.Text = _objCardTypeInfo.Batch; this.txtName.Text = _objCardTypeInfo.Name; this.txtMemo.Text = _objCardTypeInfo.Memo; this.ddlCostType.SelectedValue = _objCardTypeInfo.CostType; this.ddlPurpoe.SelectedValue = _objCardTypeInfo.Purpose; this.ddlSubmitType.SelectedValue = _objCardTypeInfo.SubmitType; this.ddlStatus.SelectedValue = _objCardTypeInfo.Status; this.dtpEffectDate.Value = _objCardTypeInfo.EffectDate; this.dtpOutDate.Value = _objCardTypeInfo.OutDate; this.ddlDefault_Status.SelectedValue = _objCardTypeInfo.DefaultCardStatus; this.ckbIsView.Checked = _objCardTypeInfo.DefaultChange == CardTypeInfo.CardTypeInfoDefaultChange.可变 ? true : false; if (_objCardTypeInfo.CostType == CardTypeInfo.CardTypeInfoCostType.限时卡) { this.lblDefault.Text = "预设时间:"; this.lblDefault_Unit.Text = this.lblMax_Unit.Text = "分钟"; this.lblMax.Text = "上限时间:"; this.tbxDefault.Text = _objCardTypeInfo.DefaultChargesDate.ToString(); this.tbxMax.Text = _objCardTypeInfo.MaxChargesDate.ToString(); } else if (_objCardTypeInfo.CostType == CardTypeInfo.CardTypeInfoCostType.限次卡) { this.lblDefault.Text = "预设次数:"; this.lblDefault_Unit.Text = this.lblMax_Unit.Text = "次"; this.lblMax.Text = "上限次数:"; this.tbxDefault.Text = _objCardTypeInfo.DefaultTimes.ToString(); this.tbxMax.Text = _objCardTypeInfo.MaxTimes.ToString(); } else if (_objCardTypeInfo.CostType == CardTypeInfo.CardTypeInfoCostType.限期卡) { this.lblDefault.Visible = this.lblDefault_Unit.Visible = this.lblMax_Unit.Visible = this.lblMax.Visible = this.tbxDefault.Visible = this.tbxMax.Visible = false; } else { this.tbxDefault.Text = _objCardTypeInfo.DefaultMoney.ToString(); this.tbxMax.Text = _objCardTypeInfo.MaxMoney.ToString(); } } } }
static public int GetHp(int id, int level, int yellowPoint = 1) { HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(id); if (null == info) { return(0); } RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity); if (rarityInfo == null) { return(0); } QualityInfo qualityInfo = GameTable.qualityRelativeAsset.LookUp(info.Quality); if (qualityInfo == null) { return(0); } CardTypeInfo cardTypeInfo = GameTable.cardTypeVariationAsset.LookUp((int)info.AttrTypeID); if (cardTypeInfo == null) { return(0); } CardLevelInfo cardLevelInfo = GameTable.cardLevelVariationAsset.LookUp((int)info.levelTypeID); if (cardLevelInfo == null) { return(0); } YellowPointInfo yellowPointInfo = GameTable.yellowPointParamAsset.LookUp(yellowPoint); if (yellowPointInfo == null) { return(0); } float maxLevelAttrParam = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enMaxLevelAttrParam).FloatTypeValue; float hp = (info.FHPMax + cardTypeInfo.m_hp) * (1 + cardLevelInfo.m_hpParam * level + yellowPointInfo.m_hpParam) * (rarityInfo.m_mainAttrMutiply + qualityInfo.m_mainAttrMutiply); return((int)hp); }
public void Load(byte[] bytes) { m_map = new Dictionary <int, CardTypeInfo>(); BinaryHelper helper = new BinaryHelper(bytes); int sceneCount = helper.ReadInt(); for (int index = 0; index < sceneCount; ++index) { CardTypeInfo info = new CardTypeInfo(); info.Load(helper); m_map.Add(info.m_id, info); } }
public IList <CardTypeInfo> SearchAll(DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo) { SystemMessage _objSystemMessage = new SystemMessage(); SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo(); //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用 IList <CardTypeInfo> objIListCardTypeInfo = new List <CardTypeInfo>(); DataSet objDataSet = new DataSet(); try { //Itsp2WebServiceNamespace.Itsp2WebService objItsp2WebService = new Itsp2WebServiceNamespace.Itsp2WebService(); //string strReturnXml = objItsp2WebService.GetCarType(); string strReturnXml = ServiceWrapper.Current.GetCarType(); objDataSet = Helper.FormatConvert.XmlToDataSet(strReturnXml); } catch (Exception e) { _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("WebServiceConnectFail"); _objSystemMessageInfo.Success = false; _objSystemMessageInfo.Exception = e.Message; return(null); } try { if (objDataSet.Tables.Count > 0) { foreach (DataRow objDataRow in objDataSet.Tables[0].Rows) { CardTypeInfo objCardTypeInfo = GetInfoFromDataRow(objDataRow); objIListCardTypeInfo.Add(objCardTypeInfo); } } } catch (Exception e) { _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("WebServiceParseToInfoFail"); _objSystemMessageInfo.Success = false; _objSystemMessageInfo.Exception = e.Message; return(null); } theSystemMessageInfo = _objSystemMessageInfo; return(objIListCardTypeInfo); }
private void SetRulePlane(RectTransform rt, CardTypeInfo info) { if (info == null) { return; } var desc = rt.Find("desc").GetComponent <Text>(); Util.SetText(desc, info.descId); var point = rt.Find("bg/time_txt").GetComponent <Text>(); var pTxt = string.Format(ConfigText.GetDefalutString(629, 16), info.point); var title = string.Format("{0} {1}", ConfigText.GetDefalutString(info.nameId), pTxt); Util.SetText(point, title); List <RectTransform> typeList = new List <RectTransform>(); var typeGroup = rt.Find("itemGroup").GetComponent <RectTransform>(); foreach (RectTransform item in typeGroup) { item.gameObject.SetActive(false); typeList.Add(item); } for (int i = 0; i < info.cardId.Length; i++) { if (i >= typeList.Count) { continue; } typeList[i].SafeSetActive(true); var card = ConfigManager.Get <CardInfo>(info.cardId[i]); if (card == null) { continue; } var c = typeList[i].Find("card"); AtlasHelper.SetHuazha(c.gameObject, card.icon); } var btn = typeGroup.GetComponentDefault <Button>(); btn.onClick.AddListener(delegate { SetCardPlane(info.cardId); }); }
public IList <CardTypeInfo> SearchByCondition(Hashtable theHashtable, string OrderBy, DataAccessor theDataAccessor, int Size, int BeginSize, ref SystemMessageInfo theSystemMessageInfo) { SystemMessage _objSystemMessage = new SystemMessage(); SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo(); IList <CardTypeInfo> objIListCardTypeInfo = new List <CardTypeInfo>(); XmlDocument objXmlDocument = Helper.FormatConvert.HashtableToXml(theHashtable); DataSet objDataSet = new DataSet(); try { string[] strReturnXml = ServiceWrapper.Current.SelectCardTypeByCondition(objXmlDocument.OuterXml, OrderBy, Size, BeginSize); CurrentUser.Current.TotalCount = Int32.Parse(strReturnXml[0].ToString()); objDataSet = Helper.FormatConvert.XmlToDataSet(strReturnXml[1]); try { if (objDataSet.Tables.Count > 0) { foreach (DataRow objDataRow in objDataSet.Tables[0].Rows) { CardTypeInfo objCardTypeInfo = GetInfoFromDataRow(objDataRow); objIListCardTypeInfo.Add(objCardTypeInfo); } } } catch (Exception e) { _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("WebServiceParseToInfoFail"); _objSystemMessageInfo.Success = false; _objSystemMessageInfo.Exception = e.Message; } } catch (Exception e) { _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("WebServiceConnectFail"); _objSystemMessageInfo.Success = false; _objSystemMessageInfo.Exception = e.Message; } theSystemMessageInfo = _objSystemMessageInfo; return(objIListCardTypeInfo); }
public SystemMessageInfo Delete(Guid theId, DataAccessor theDataAccessor) { SystemMessage _objSystemMessage = new SystemMessage(); SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo(); if (theId == SystemConstant.GuidEmpty) { return(null); } //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用 //Hashtable objHashtable = new Hashtable(); //objHashtable.Add("id", theId); //这里的后台写法仅支持传一个对象删除的方法 CardTypeInfo objCardTypeInfoCondition = new CardTypeInfo(); objCardTypeInfoCondition.Id = theId; Hashtable objHashtable = InfoToHashtable(objCardTypeInfoCondition); XmlDocument objXmlDocument = Helper.FormatConvert.HashtableToXml(objHashtable); try { //Itsp2WebServiceNamespace.Itsp2WebService objItsp2WebService = new Itsp2WebServiceNamespace.Itsp2WebService(); //objItsp2WebService.UpdateCardTypeByCondition(objXmlDocument.OuterXml); ServiceWrapper.Current.UpdateCardTypeByCondition(objXmlDocument.OuterXml); } catch (Exception e) { _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("WebServiceConnectFail"); _objSystemMessageInfo.Success = false; _objSystemMessageInfo.Exception = e.Message; return(_objSystemMessageInfo); } _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("DataDeleteSucceeded"); return(_objSystemMessageInfo); }
/// <summary> /// 获取已验证的卡类型对象 /// </summary> /// <param name="CardTypeInfo">卡类型对象</param> /// <returns>是否验证成功</returns> private CardTypeInfo GetInfoFormForm() { CardTypeInfo objCardTypeInfo = new CardTypeInfo(); if (_eumActionType == ActionType.Insert && _objId == SystemConstant.GuidEmpty) { objCardTypeInfo.Id = Guid.NewGuid(); } else if (_eumActionType == ActionType.Update) { objCardTypeInfo = _objCardTypeBLL.GetById(_objId, null, ref _objSystemMessageInfo); if (!_objSystemMessageInfo.Success) { MessageBoxForm.Show(_objSystemMessageInfo, MessageBoxButtons.OK); return(null); } objCardTypeInfo.Name = txtBatch.Text.Trim(); objCardTypeInfo.Memo = txtMemo.Text.Trim(); objCardTypeInfo.Status = (CardTypeInfo.CardTypeInfoStatus) int.Parse(ddlStatus.SelectedValue.ToString()); } return(objCardTypeInfo); }
public SystemMessageInfo Update(CardTypeInfo theCardTypeInfo, DataAccessor theDataAccessor) { return(_objICardTypeDAL.Update(theCardTypeInfo, theDataAccessor)); }
public SystemMessageInfo Insert(ref CardTypeInfo theCardTypeInfo, DataAccessor theDataAccessor) { return(_objICardTypeDAL.Insert(ref theCardTypeInfo, theDataAccessor)); }
public SystemMessageInfo IsValid(CardTypeInfo theCardTypeInfo, DataAccessor theDataAccessor) { _objMessageInfo.Success = true; return(_objMessageInfo); }
/// <summary> /// 为控件赋值 /// </summary> /// <param name="theId"></param> private void SetFormFromInfo(Guid theId) { if (theId != Bouwa.Helper.SystemConstant.GuidEmpty) { _objCardTypeInfo = _objCardTypeBLL.GetById(theId, null, ref _objSystemMessageInfo); if (!_objSystemMessageInfo.Success) { MessageBoxForm.Show(_objSystemMessageInfo, MessageBoxButtons.OK); } if (_objCardTypeInfo != null) { this.lblNum.Text = _objCardId; this.tbxLotNum.Text = _objCardTypeInfo.Batch; this.tbxCardType.Text = _objCardTypeInfo.Name; this.ddlStatus.Text = CardTypeInfo.CardTypeInfoDefaultCardStatus.已充值.ToString();//_objCardTypeInfo.DefaultCardStatus; this.lblSaasId.Text = _objCardTypeInfo.SaasId.ToString(); this.lblCardTypeId.Text = _objCardTypeInfo.Id.ToString("N"); this.lblCostType.Text = _objCardTypeInfo.CostType.ToString("D"); this.lblEffectDate.Text = _objCardTypeInfo.EffectDate.ToString(); this.lblOutDate.Text = _objCardTypeInfo.OutDate.ToString(); this.lblPurpose.Text = _objCardTypeInfo.Purpose.ToString("D"); this.lblSubmitType.Text = _objCardTypeInfo.SubmitType.ToString("D"); this.lblExtSaasId.Text = Convert.ToString(_objCardTypeInfo.extSaasId); this.lblExtCardTypeId.Text = Convert.ToString(_objCardTypeInfo.extCardTypeId); //判断上限金额字段是否可更改 if (_objCardTypeInfo.DefaultChange.Equals(CardTypeInfo.CardTypeInfoDefaultChange.可变)) { this.tbxOverPlus.ReadOnly = false; } else { this.tbxOverPlus.ReadOnly = true; } if ((int)_objCardTypeInfo.CostType == (int)CardTypeInfo.CardTypeInfoCostType.限时卡) { this.lblOverPlus.Text = "剩余时间:"; this.lblOverPlusUnit.Text = this.lblMaxUnit.Text = "分钟"; this.lblMax.Text = "上限时间:"; this.tbxOverPlus.Text = _objCardInfo.charges_date.ToString(); //_objCardTypeInfo.DefaultChargesDate.ToString(); this.tbxMax.Text = _objCardTypeInfo.MaxChargesDate.ToString(); } else if ((int)_objCardTypeInfo.CostType == (int)CardTypeInfo.CardTypeInfoCostType.限次卡) { this.lblOverPlus.Text = "剩余次数:"; this.lblOverPlusUnit.Text = this.lblMaxUnit.Text = "次"; this.lblMax.Text = "上限次数:"; this.tbxOverPlus.Text = _objCardInfo.times.ToString(); // _objCardTypeInfo.DefaultTimes.ToString(); this.tbxMax.Text = _objCardTypeInfo.MaxTimes.ToString(); } else if ((int)_objCardTypeInfo.CostType == (int)CardTypeInfo.CardTypeInfoCostType.限期卡) { this.lblOverPlus.Text = "到期日期:"; this.lblOverPlusUnit.Text = ""; this.tbxOverPlus.Text = _objCardInfo.end_date.ToString("yyyy-MM-dd"); ////_objCardTypeInfo.OutDate.ToString("yyyy-MM-dd"); this.lblMax.Visible = this.tbxMax.Visible = this.lblMaxUnit.Visible = false; } else { this.tbxOverPlus.Text = _objCardInfo.money.ToString("0.00"); //_objCardTypeInfo.DefaultMoney.ToString(); this.tbxMax.Text = _objCardTypeInfo.MaxMoney.ToString(); } } } }
/// <summary> /// Authorizes the payment. /// This step checks whether the loyalty card has enough reward points to redeem. If yes, it decides the points /// to redeem based on redeem ranking. /// </summary> /// <param name="request">The request.</param> /// <returns>A response containing the authorized tender line.</returns> private static AuthorizePaymentServiceResponse AuthorizePayment(AuthorizePaymentServiceRequest request) { if (request == null) { throw new ArgumentNullException("request"); } if (request.TenderLine == null) { throw new ArgumentException("request.TenderLine cannot be null."); } if (request.RequestContext == null) { throw new ArgumentException("request.RequestContext cannot be null."); } if (request.Transaction == null) { throw new ArgumentException("request.Transaction cannot be null."); } // Check tender amount. if (request.TenderLine.Amount == 0m) { throw new PaymentException(PaymentErrors.Microsoft_Dynamics_Commerce_Runtime_InvalidPaymentRequest, "The tender amount must be greater than zero."); } // Check tender currency. if (string.IsNullOrWhiteSpace(request.TenderLine.Currency)) { throw new PaymentException(PaymentErrors.Microsoft_Dynamics_Commerce_Runtime_InvalidPaymentRequest, "The tender currency is missing."); } // Check if the transaction already has loyalty payments var activeTenderLines = request.Transaction.ActiveTenderLines; if (activeTenderLines != null && activeTenderLines.Any(line => !string.IsNullOrWhiteSpace(line.LoyaltyCardId))) { throw new PaymentException(PaymentErrors.Microsoft_Dynamics_Commerce_Runtime_NoMoreThanOneLoyaltyTender, "The transaction cannot contain more than one loyalty payment line."); } SalesOrder salesOrder = request.Transaction as SalesOrder; if (salesOrder != null && salesOrder.HasLoyaltyPayment && (salesOrder.CustomerOrderMode != CustomerOrderMode.Cancellation || salesOrder.AmountDue > decimal.Zero)) { throw new PaymentException(PaymentErrors.Microsoft_Dynamics_Commerce_Runtime_NoMoreThanOneLoyaltyTender, "The transaction cannot contain more than one loyalty payment line."); } // Check whether the loyalty card is valid. var getLoyaltyCardDataRequest = new GetLoyaltyCardDataRequest(request.TenderLine.LoyaltyCardId); LoyaltyCard loyaltyCard = request.RequestContext.Execute <SingleEntityDataServiceResponse <LoyaltyCard> >(getLoyaltyCardDataRequest).Entity; if (loyaltyCard == null || string.IsNullOrWhiteSpace(loyaltyCard.CardNumber)) { throw new PaymentException(PaymentErrors.Microsoft_Dynamics_Commerce_Runtime_InvalidLoyaltyCardNumber, "The loyalty card number does not exists."); } // Check whether the loyalty card is blocked. if (loyaltyCard.CardTenderType == LoyaltyCardTenderType.Blocked) { throw new PaymentException(PaymentErrors.Microsoft_Dynamics_Commerce_Runtime_BlockedLoyaltyCard, "The loyalty card is blocked."); } if (loyaltyCard.CardTenderType == LoyaltyCardTenderType.NoTender) { throw new PaymentException(PaymentErrors.Microsoft_Dynamics_Commerce_Runtime_NoTenderLoyaltyCard, "The loyalty card is not allowed for payment."); } // Calculate redeem trans and fill in the sales transaction. if (request.TenderLine.Amount >= 0) { LoyaltyServiceHelper.FillInLoyaltyRewardPointLinesForPayment( request.RequestContext, request.Transaction, loyaltyCard, request.TenderLine.Amount, request.TenderLine.Currency); } else { LoyaltyServiceHelper.FillInLoyaltyRewardPointLinesForRefund( request.RequestContext, request.Transaction, loyaltyCard, request.TenderLine.Amount, request.TenderLine.Currency); } // Set Card Type Id for Loyalty Card if not set by the client. if (request.TenderLine.CardTypeId == null) { string tenderTypeId = request.TenderLine.TenderTypeId; var cardTypeDataRequest = new GetCardTypeDataRequest(QueryResultSettings.AllRecords); var cardTypeInfoResponse = request.RequestContext.Execute <EntityDataServiceResponse <CardTypeInfo> >(cardTypeDataRequest); IEnumerable <CardTypeInfo> cardTypes = cardTypeInfoResponse.PagedEntityCollection.Results; CardTypeInfo loyaltyCardTypeInfo = cardTypes.FirstOrDefault(cardType => cardType.PaymentMethodId == tenderTypeId); if (loyaltyCardTypeInfo == null) { throw new ConfigurationException(ConfigurationErrors.Microsoft_Dynamics_Commerce_Runtime_ConfigurationSettingNotFound, "The loyalty card payment as a tender type card is not configured for the channel."); } request.TenderLine.CardTypeId = loyaltyCardTypeInfo.TypeId; } // Authorize. request.TenderLine.Status = TenderLineStatus.PendingCommit; request.TenderLine.IsVoidable = true; return(new AuthorizePaymentServiceResponse(request.TenderLine)); }