void OnPress(bool isOver) { if (isOver) { } else { Camera camera = GameObject.Find("MogoMainUI").transform.GetChild(0).GetComponentInChildren <Camera>(); BoxCollider bc = transform.GetComponentInChildren <BoxCollider>(); RaycastHit hit = new RaycastHit(); if (bc.Raycast(camera.ScreenPointToRay(Input.mousePosition), out hit, 10000.0f)) { if (ChooseCharacterUIDict.ButtonTypeToEventUp[transform.name] == null) { LoggerHelper.Error("No ButtonTypeToEventUp Info"); return; } ChooseCharacterUIDict.ButtonTypeToEventUp[transform.name](); } } }
public JsonResultEntity Delete(int id) { var cityBL = new CityBL(); JsonResultEntity response = new JsonResultEntity(); try { var result = cityBL.DeleteById(id); if (result.HasWarning()) { response.Message = String.Join(",", result.Warning); return(response); } response.Success = true; response.Data = result.Value; } catch (Exception e) { response.Message = e.Message; LoggerHelper.Error(e); } return(response); }
public override JsonResultEntity Get([FromBody] DBParamEntity dbParamEntity) { CityBL cityBL = new CityBL(); JsonResultEntity response = new JsonResultEntity(); try { var result = cityBL.GetAll(dbParamEntity); if (result.HasWarning()) { response.Message = String.Join(",", result.Warning); return(response); } var dataFound = cityBL.GetTotalRows(dbParamEntity); var totalPages = Convert.ToInt32(Math.Ceiling(dataFound.Value / Convert.ToDouble(dbParamEntity.Limit))); response.Success = true; response.Data = result.Value; response.MetaInfo = new MetaInfoEntity { DataFound = dataFound.Value, DataPerPage = dbParamEntity.Limit, Page = dbParamEntity.Page, TotalPages = totalPages == 0 ? 1 : totalPages }; } catch (Exception ex) { response.Message = ex.Message; LoggerHelper.Error(ex); } return(response); }
public static bool SendInvoiceSMS(InvoiceModel invoiceModel, string locale) { LoggerHelper.Info($"NotificationSvcProvider:SendReceiptSms. customerId={invoiceModel.CustomerId}, receiptId={invoiceModel.DisplayMemberInvoiceNumber}, distributorId={invoiceModel.MemberId}, customerPhone: {invoiceModel.SMSNumber}."); try { var result = new NotifyCustomerReceiptResponse_V01(); var proxy = ServiceClientProvider.GetNotificationServiceProxy(); var request = new NotifyOrderingReceiptRequest_V01 { CustomerPhone = "1" + invoiceModel.SMSNumber, CustomerFirstName = invoiceModel.FirstName, CustomerLastName = invoiceModel.LastName, MemberType = "DS", CustomerId = string.IsNullOrEmpty(invoiceModel.CustomerId) ? 0: Convert.ToInt32(invoiceModel.CustomerId), ReceiptId = Convert.ToString(invoiceModel.MemberInvoiceNumber), LocaleCode = locale, DistributorId = invoiceModel.MemberId, CustomerEmail = invoiceModel.Email, }; var response = proxy.NotifyOrdering(new NotifyOrderingRequest(request)) as NotifyOrderingResponse; if (response.NotifyOrderingResult.Status == ServiceProvider.NotificationSVC.ServiceResponseStatusType.Success) { return(true); } else { LoggerHelper.Error($"NotificationService Service : NotifyOrdering Error: {result.Message}, DistributorID:{invoiceModel.MemberId}"); return(false); } } catch (Exception ex) { LoggerHelper.Error(string.Format("NotificationService Service : NotifyOrdering Error: {0}\n", ex.Message)); } return(false); }
public static ordering.AddressBase Get(string locale, TemplateControl control, string controlPath, bool isXml) { ordering.AddressBase addressBase = null; try { if (!isXml) { addressBase = control.LoadControl(controlPath) as ordering.AddressBase; addressBase.LoadPage(); } else { addressBase = new ordering.AddressControl(); addressBase.XMLFile = controlPath; } } catch (HttpException ex) { LoggerHelper.Error(ex.ToString()); } return(addressBase); }
public override List <Address_V01> AddressSearch(string SearchTerm) { var addrFound = new List <Address_V01>(); try { var proxy = ServiceClientProvider.GetShippingServiceProxy(); var request = new SearchAddressDataRequest_V01 { SearchText = SearchTerm }; var response = proxy.GetAddressData(new GetAddressDataRequest(request)).GetAddressDataResult as SearchAddressDataResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { if (response.AddressData != null && response.AddressData.Count > 0) { AddressData_V02 addressData = response.AddressData.First(); addrFound.Add(new Address_V01 { Country = "BR", StateProvinceTerritory = addressData.State, City = addressData.City, Line1 = addressData.Street, Line2 = addressData.Neighbourhood, PostalCode = addressData.PostCode } ); } return(addrFound); } } catch (Exception ex) { LoggerHelper.Error(string.Format("AddressSearch error: Country {0}, error: {1}", "BR", ex)); } return(addrFound); }
public void Init() { string targetProperty = string.Empty; string configuration = string.Empty; string configurationProperty = string.Empty; string modifier = string.Empty; foreach (ConfiguredParam p in Params) { switch (p.Name) { case "TargetProperty": targetProperty = p.Value; break; case "Configuration": configuration = p.Value; break; case "ConfigurationProperty": configurationProperty = p.Value; break; case "Modifier": modifier = p.Value; break; default: break; } if (string.IsNullOrEmpty(targetProperty) || string.IsNullOrEmpty(configuration) || string.IsNullOrEmpty(configurationProperty)) { continue; } TargetName = targetProperty; var pInfo = HLConfigManager.Configurations.GetType().GetProperty(configuration); if (pInfo != null) { object value = null; if ((value = pInfo.GetValue(HLConfigManager.Configurations, null)) != null) { pInfo = value.GetType().GetProperty(configurationProperty); if (pInfo != null) { if (!string.IsNullOrEmpty(modifier)) { if (modifier == "Not") { try { bool bValue = (bool)pInfo.GetValue(value, null); TargetValue = !bValue; } catch (Exception ex) { LoggerHelper.Error( string.Format( "ControlConfigLoader -Invalid Modifier {0} for configured property {1}. Property must be boolean.\r\n{2}", modifier, string.Concat(configuration, ".", configurationProperty), ex.Message)); } } else { LoggerHelper.Error( string.Format( "ControlConfigLoader -Invalid Boolean Modifier {0} for configured property {1}", modifier, string.Concat(configuration, ".", configurationProperty))); } } else { TargetValue = pInfo.GetValue(value, null); } } } } } }
// 计算攻击伤害。 攻击者可能是 玩家或者 dummy 对象。 // 受击者,则反之。 public static List <int> CacuDamage(int hitActionID, uint attackerID, uint victimID) { bool isDebugInfo = false; List <int> result = new List <int>(); EntityParent attacker = null; EntityParent defender = null; double levelCorrect = 1.00f; if (attackerID == MogoWorld.thePlayer.ID && MogoWorld.Entities.ContainsKey(victimID)) { //玩家打dummy attacker = MogoWorld.thePlayer; defender = MogoWorld.Entities[victimID] as EntityDummy; double levelGap = defender.level - attacker.level; if (levelGap >= 20) { levelCorrect = 0.1f; } else if (levelGap > 10 && levelGap < 20) { levelCorrect = 1 - levelGap * 0.05f; } } else if (victimID == MogoWorld.thePlayer.ID && MogoWorld.Entities.ContainsKey(attackerID)) { //dummy打玩家 defender = MogoWorld.thePlayer; attacker = MogoWorld.Entities[attackerID] as EntityDummy; } else if (MogoWorld.Entities[attackerID] is EntityDummy && MogoWorld.Entities[victimID] is EntityMercenary) { //dummy打Mercenary attacker = MogoWorld.Entities[attackerID] as EntityDummy; defender = MogoWorld.Entities[victimID] as EntityMercenary; } else if (MogoWorld.Entities[attackerID] is EntityMercenary) { //Mercenary打dummy attacker = MogoWorld.Entities[attackerID] as EntityMercenary; defender = MogoWorld.Entities[victimID] as EntityDummy; isDebugInfo = true; } else { LoggerHelper.Error("CacuDamage Error. eid not exist."); result.Add(-1); result.Add(0); return(result); } if (RandomHelper.GetRandomFloat() > GetHitRate(attacker, defender)) { result.Add(1); result.Add(0); return(result); } bool critFlag = false; bool strikeFlag = false; var atk = GetProperty(attacker, "atk"); //角色伤害值 double extraCritDamage = 0.00f; double dmgCorrect = 1.00f; //减伤修正,破击时为1 double dmgMultiply = 1.00f; if (RandomHelper.GetRandomFloat() <= GetCritRate(attacker, defender)) { //发生暴击 critFlag = true; extraCritDamage = GetProperty(attacker, "critExtraAttack"); dmgCorrect = GetDmgCorrect(attacker, defender); dmgMultiply = 1 + 0.2f; } else if (RandomHelper.GetRandomFloat() <= GetTrueStrikeRate(attacker, defender)) { //发生破击 strikeFlag = true; } else { dmgCorrect = GetDmgCorrect(attacker, defender); } // 4 暴击 3破击 2普通攻击 1miss int retFlag; if (strikeFlag) { retFlag = 3; } else if (critFlag) { retFlag = 4; } else { retFlag = 2; } ///技能数据伤害 对应 伤害*技能比例+技能加成固定值 SkillAction skillData = SkillAction.dataMap[hitActionID]; var skillMul = skillData.damageMul; var skillAdd = skillData.damageAdd; var dmgNormal = ((atk * (skillMul) * dmgMultiply + skillAdd) + extraCritDamage) * dmgCorrect; var dmgAll = dmgNormal + GetElemDamage(attacker, defender); var damageReduce = GetProperty(defender, "damageReduceRate"); int pvpCorrect = 1; result.Add(retFlag); result.Add((int)(Math.Ceiling(dmgAll * (1 - damageReduce) * pvpCorrect * levelCorrect * RandomHelper.GetRandomFloat(0.90f, 1.10f)))); if (isDebugInfo) { //LoggerHelper.Error("dmgAll:" + dmgAll + " dmgNormal:" + dmgNormal + " atk:" + atk + " skillMul:" + skillMul + " skillAdd:" + skillAdd + " dmgCorrect:" + dmgCorrect + " damageReduce:" + damageReduce + " result:" + (Math.Ceiling(dmgAll / temp * RandomHelper.GetRandomFloat(0.90f, 1.10f)))); } return(result); }
protected override void BindTotals() { decimal earnBase = 0.00M; List <DistributorShoppingCartItem> lstShoppingCartItems = (Page as ProductsBase).ShoppingCart.ShoppingCartItems; try { if (lstShoppingCartItems.Count > 0 && _shoppingCart.Totals != null) { OrderTotals_V01 totals = _shoppingCart.Totals as OrderTotals_V01; foreach (DistributorShoppingCartItem shoppingCartItem in lstShoppingCartItems) { earnBase += shoppingCartItem.EarnBase; } lblDiscountRate.Text = _shoppingCart.Totals == null ? "0%" : (totals.DiscountPercentage).ToString() + "%"; lblDistributorSubtotal.Text = getAmountString(totals.DiscountedItemsTotal); lblEarnBase.Text = getAmountString(GetTotalEarnBase(lstShoppingCartItems)); if (ProductsBase.IsEventTicketMode) { var orderMonthShortString = string.Empty; var ordermonth = OrderMonth.DualOrderMonthForEventTicket(true, out orderMonthShortString); // dual ordermonth should be desable for ETO lblOrderMonth.Text = string.IsNullOrWhiteSpace(ordermonth) ? GetOrderMonthString() : ordermonth; var currentSession = SessionInfo; if (null != currentSession && !string.IsNullOrWhiteSpace(orderMonthShortString)) { currentSession.OrderMonthString = ordermonth; currentSession.OrderMonthShortString = orderMonthShortString; } } else { lblOrderMonth.Text = GetOrderMonthString(); } decimal currentMonthVolume = 0; if (decimal.TryParse((Page as ProductsBase).CurrentMonthVolume, out currentMonthVolume)) { lblOrderMonthVolume.Text = HLConfigManager.Configurations.CheckoutConfiguration.UseUSPricesFormat ? currentMonthVolume.ToString("N", CultureInfo.GetCultureInfo("en-US")) : currentMonthVolume.ToString("N2"); } else { lblOrderMonthVolume.Text = (Page as ProductsBase).CurrentMonthVolume; } Charge_V01 otherCharges = totals.ChargeList.Find( delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.OTHER); }) as Charge_V01 ?? new Charge_V01(ChargeTypes.OTHER, (decimal)0.0); Charge_V01 pHCharge = totals.ChargeList.Find( delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.PH); }) as Charge_V01 ?? new Charge_V01(ChargeTypes.PH, (decimal)0.0); Charge_V01 freightCharge = totals.ChargeList.Find( delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.FREIGHT); }) as Charge_V01 ?? new Charge_V01(ChargeTypes.FREIGHT, (decimal)0.0); lblOtherCharges.Text = getAmountString(otherCharges.Amount); Charge_V01 localTaxCharge = OrderProvider.GetLocalTax(_shoppingCart.Totals as OrderTotals_V01); lblLocalTax.Text = getAmountString(localTaxCharge.Amount); lblPackageHandling.Text = getAmountString(pHCharge.Amount); Charge_V01 logisticCharge = totals.ChargeList.Find( delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOGISTICS_CHARGE); }) as Charge_V01 ?? new Charge_V01(ChargeTypes.LOGISTICS_CHARGE, (decimal)0.0); lblLogisticCharges.Text = getAmountString(logisticCharge.Amount); var amount = GetSubTotalValue(totals, CountryCode); lblSubtotal.Text = getAmountString(amount); lblRetailPrice.Text = getAmountString(totals.ItemsTotal); lblShippingCharges.Text = getAmountString(freightCharge.Amount); lblTaxVAT.Text = getAmountString(OrderProvider.GetTaxAmount(_shoppingCart.Totals as OrderTotals_V01)); Charge_V01 taxedNet = totals.ChargeList.Find( delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.TAXEDNET); }) as Charge_V01 ?? new Charge_V01(ChargeTypes.TAXEDNET, (decimal)0.0); lblTaxedNet.Text = getAmountString(taxedNet.Amount); lblVolumePoints.Text = HLConfigManager.Configurations.CheckoutConfiguration.UseUSPricesFormat ? totals.VolumePoints.ToString("N", CultureInfo.GetCultureInfo( "en-US")) : totals.VolumePoints.ToString("N2"); lblGrandTotal.Text = getAmountString(totals.AmountDue); } else { DisplayEmptyLabels(); } if (HLConfigManager.Configurations.CheckoutConfiguration.HasTotalTaxable) { trTaxedNet.Visible = true; trTax.Visible = false; } if (_shoppingCart.Totals != null) { OrderTotals_V01 totals = _shoppingCart.Totals as OrderTotals_V01; if (HLConfigManager.Configurations.CheckoutConfiguration.HasTaxPercentage) { trTaxPercentage.Visible = true; //lblPercentage.Text = HLConfigManager.Configurations.CheckoutConfiguration.TaxPercentage + "%"; lblPercentage.Text = _shoppingCart.Totals != null ? getAmountString(OrderProvider.GetTaxAmount(_shoppingCart.Totals as OrderTotals_V01)) : string.Empty; } if (HLConfigManager.Configurations.CheckoutConfiguration.HasTotalDiscount) { trTotalDiscount.Visible = true; lblTotalDiscount2.Text = _shoppingCart.Totals != null ? getAmountString(totals.TotalItemDiscount) : string.Empty; } // hide this row if there is no local tax return trLocalTax.Visible = OrderProvider.HasLocalTax(totals); } } catch (Exception ex) { //Log Exception LoggerHelper.Error("Exception while displaying totals - " + ex); DisplayEmptyLabels(); } }
protected override void BindTotals() { var lstShoppingCartItems = (Page as ProductsBase).ShoppingCart.ShoppingCartItems; try { if ((HLConfigManager.Configurations.DOConfiguration.CalculateWithoutItems && _shoppingCart.Totals != null && (_shoppingCart.Totals as OrderTotals_V01).AmountDue != decimal.Zero) || (lstShoppingCartItems.Count > 0 && ShoppingCart.Totals != null)) // if (lstShoppingCartItems.Count > 0 && ShoppingCart.Totals != null) { OrderTotals_V01 totals = ShoppingCart.Totals as OrderTotals_V01; lblDiscountRate.Text = _shoppingCart.Totals == null ? "0%" : ((_shoppingCart.Totals as OrderTotals_V01).DiscountPercentage).ToString() + "%"; _shoppingCart.EmailValues.DistributorSubTotal = OrderProvider.GetDistributorSubTotal(_shoppingCart.Totals as OrderTotals_V01); _shoppingCart.EmailValues.DistributorSubTotalFormatted = getAmountString(_shoppingCart.EmailValues.DistributorSubTotal); lblDistributorSubtotal.Text = _shoppingCart.EmailValues.DistributorSubTotalFormatted; lblEarnBase.Text = getAmountString(GetTotalEarnBase(lstShoppingCartItems)); if (lblDiscountTotal != null) { lblDiscountTotal.Text = getAmountString(CheckoutTotalsDetailed.GetDiscountTotal(lstShoppingCartItems)); } // added for China DO if (HLConfigManager.Configurations.CheckoutConfiguration.HasDiscountAmount) { OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02; if (totals_V02 != null) { HLRulesManager.Manager.PerformDiscountRules(_shoppingCart, null, Locale, ShoppingCartRuleReason.CartCalculated); lblDiscountAmount.Text = getAmountString(totals_V02.DiscountAmount); trDiscountRate.Visible = false; } } if (HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU) { if (trDonationAmount != null) { trDonationAmount.Visible = true; OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02; if (totals_V02 != null) { lblDonationAmount.Text = getAmountString(totals_V02.Donation); } } } lblOrderMonth.Text = GetOrderMonthString(); decimal currentMonthVolume = 0; if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayFormatNeedsDecimal) { lblOrderMonthVolume.Text = decimal.TryParse(ProductsBase.CurrentMonthVolume, NumberStyles.Any, CultureInfo.InstalledUICulture, out currentMonthVolume) ? ProductsBase.GetVolumePointsFormat(currentMonthVolume) : (Page as ProductsBase).CurrentMonthVolume; } else if (decimal.TryParse((Page as ProductsBase).CurrentMonthVolume, out currentMonthVolume)) { lblOrderMonthVolume.Text = ProductsBase.GetVolumePointsFormat(currentMonthVolume); } else { lblOrderMonthVolume.Text = (Page as ProductsBase).CurrentMonthVolume; } Charge_V01 otherCharges = totals.ChargeList.Find( delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.OTHER); }) as Charge_V01 ?? new Charge_V01(ChargeTypes.OTHER, (decimal)0.0); Charge_V01 pHCharge = totals.ChargeList.Find( delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.PH); }) as Charge_V01 ?? new Charge_V01(ChargeTypes.PH, (decimal)0.0); Charge_V01 freightCharge = totals.ChargeList.Find( delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.FREIGHT); }) as Charge_V01 ?? new Charge_V01(ChargeTypes.FREIGHT, (decimal)0.0); Charge_V01 localTaxCharge = totals.ChargeList.Find( delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOCALTAX); }) as Charge_V01 ?? new Charge_V01(ChargeTypes.LOCALTAX, (decimal)0.0); lblOtherCharges.Text = getAmountString(otherCharges.Amount); lblLocalTax.Text = getAmountString(localTaxCharge.Amount); Charge_V01 logisticCharge = totals.ChargeList.Find( delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOGISTICS_CHARGE); }) as Charge_V01 ?? new Charge_V01(ChargeTypes.LOGISTICS_CHARGE, (decimal)0.0); lblLogisticCharges.Text = getAmountString(logisticCharge.Amount); lblPackageHandling.Text = getAmountString(pHCharge.Amount + totals.MarketingFundAmount); lblShippingCharges.Text = getAmountString(freightCharge.Amount); lblRetailPrice.Text = getAmountString(totals.ItemsTotal); decimal vatTax = totals.VatTax != null ? (decimal)totals.VatTax : decimal.Zero; lblTaxVAT.Text = getAmountString(vatTax); //Changes as per User Story 235045 bool hideLabels = RemovePHCharge(); decimal serviceTax = totals.ServiceTax != null ? (decimal)totals.ServiceTax: decimal.Zero; lblServiceTax.Text = getAmountString(serviceTax); if (serviceTax == 0) { serviceTAX.Visible = hideLabels ? false : true; } decimal bharatTax = totals.SwachhBharatCess != null ? (decimal)totals.SwachhBharatCess : decimal.Zero; lblBharatCessTax.Text = getAmountString(bharatTax); if (bharatTax == 0) { bharatCessTAX.Visible = hideLabels ? false : true; } var kkcEnabled = HL.Common.Configuration.Settings.GetRequiredAppSetting("KKCEnabled", false); if (kkcEnabled) { decimal krishiTax = totals.KrishiKalyanCess != null ? (decimal)totals.KrishiKalyanCess : decimal.Zero; lblKKCTax.Text = getAmountString(krishiTax); if (krishiTax == 0) { kkcTax.Visible = hideLabels ? false : true; } } else { kkcTax.Visible = false; } //User Story 251995:GDO[PRODUCTION SUPPORT]: IN: For fixing the Tax display issue on GDO Checkout page for Additional/Exceptional Tax applicable states decimal AdditionalTax = totals.AdditionalTaxCess != null ? (decimal)totals.AdditionalTaxCess : decimal.Zero; lblAdditionalTax.Text = getAmountString(AdditionalTax); if (AdditionalTax == 0) { additionalTax.Visible = hideLabels ? false : true; } decimal CSTTax = totals.CstTax != null ? (decimal)totals.CstTax : decimal.Zero; lblCSTTax.Text = getAmountString(CSTTax); if (CSTTax == 0) { cstTax.Visible = hideLabels ? false : true; } // if (lblSubtotal != null) { lblSubtotal.Text = getAmountString(logisticCharge.Amount); } if (lblAdditionalDiscount != null) { lblAdditionalDiscount.Text = getAmountString(otherCharges.Amount); } lblVolumePoints.Text = ProductsBase.GetVolumePointsFormat(totals.VolumePoints); } else { if (HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU) { if (trDonationAmount != null) { trDonationAmount.Visible = true; OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02; if (totals_V02 != null) { lblDonationAmount.Text = getAmountString(totals_V02.Donation); } } } DisplayEmptyLabels(); } } catch (Exception ex) { //Log Exception LoggerHelper.Error("Exception while displaying totals - " + ex); DisplayEmptyLabels(); } }
private decimal GetBehalfDonationAmount() { if (blErrors != null) { blErrors.Items.Clear(); } decimal _totalDonation = decimal.Zero; try { _otherAmount = 0; string phone = txtContactNumber.Text.Replace("_", String.Empty) .Replace("(", String.Empty) .Replace(")", String.Empty) .Replace("-", String.Empty) .Trim(); if (btnBehalf5Rmb.Checked) { _behalfAmount = 5; } else if (btnBehalf10Rmb.Checked) { _behalfAmount = 10; } else if (!String.IsNullOrEmpty(txtOtherAmount2.Text.ToString()) && decimal.TryParse(txtOtherAmount2.Text.ToString(), out _otherAmount)) { _behalfAmount = _otherAmount; } else if (btnBehalfOther.Checked) { txtOtherAmount2.Enabled = true; } SessionInfo.CancelBehalfOfDonation = SessionInfo.CancelBehalfOfDonation + _behalfAmount; bool isValidDonation = true; if (_behalfAmount < 1) { isValidDonation = false; ShowError("InvalidDonationAmount"); } var cart = ShoppingCart as MyHLShoppingCart; if (_behalfAmount > 0) { if (String.IsNullOrEmpty(txtDonatorName.Text.Trim())) { //isValidDonation = false; //ShowError("NoCustomerNameEntered"); txtDonatorName.Text = "匿名"; } if (String.IsNullOrEmpty(phone) || phone.Length < 11) { isValidDonation = false; ShowError("NoCustomerPhoneNoEntered"); } if (!isValidDonation) { if (errors != null && errors.Count > 0) { blErrors.DataSource = errors; blErrors.DataBind(); errors.Clear(); return(0); } } cart.BehalfDonationName = txtDonatorName.Text; cart.BehalfOfContactNumber = phone; cart.BehalfOfMemberId = DistributorID; if (cart.BehalfOfAmount > 0) { cart.BehalfOfAmount = cart.BehalfOfAmount + _behalfAmount; } else { cart.BehalfOfAmount = _behalfAmount; } if (cart.BehalfOfSelfAmount > 0) { cart.BehalfOfSelfAmount = cart.BehalfOfSelfAmount; } } if ((_behalfAmount > decimal.Zero) && HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU) { var myShoppingCart = (Page as ProductsBase).ShoppingCart; if (myShoppingCart.Totals == null) { myShoppingCart.Totals = new OrderTotals_V02(); } OrderTotals_V02 totals = myShoppingCart.Totals as OrderTotals_V02; if (totals == null) { totals = new OrderTotals_V02(); } if (_behalfAmount > decimal.Zero) { _totalDonation = _behalfAmount; } } if (errors != null && errors.Count > 0) { blErrors.DataSource = errors; blErrors.DataBind(); errors.Clear(); return(0); } } catch (Exception ex) { LoggerHelper.Error("AddHFFFailed!\n" + ex); } return(_totalDonation); }
private void DonationClicked(decimal donationAmount) { decimal quantity = donationAmount; //if (int.TryParse(tbQuantity.Text.Trim(), out quantity)) if (quantity > 0) { var myShoppingCart = (Page as ProductsBase).ShoppingCart; //Add the donation amount to cart if (!string.IsNullOrEmpty(HLConfigManager.Configurations.DOConfiguration.HFFHerbalifeSku)) { try { if (quantity > 0) { int quantiti = Decimal.ToInt32(quantity); if (!ProductsBase.AddHFFSKU(quantiti)) { lblHFFMsg.Text = string.Format(PlatformResources.GetGlobalResourceString("ErrorMessage", "AddHFFFailed")); divMsg.Visible = true; } else { lblHFFMsg.Text = string.Format(PlatformResources.GetGlobalResourceString("ErrorMessage", "AddHFFSucceeded")); divMsg.Visible = true; } } //else //{ // lblHFFMsg.Text = // string.Format(PlatformResources.GetGlobalResourceString("ErrorMessage", "AddHFFZero")); // divMsg.Visible = true; //} } catch (Exception ex) { LoggerHelper.Error("HFF Herbalife Can not be added to cart!\n" + ex); } } else if (HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU) { if (myShoppingCart.Totals == null) { myShoppingCart.Totals = new OrderTotals_V02(); } if (myShoppingCart.Totals != null) { OrderTotals_V02 totals = myShoppingCart.Totals as OrderTotals_V02; if (totals != null) { if (totals != null && totals.Donation > 0) { totals.Donation = totals.Donation + quantity; } else { totals.Donation = quantity; } myShoppingCart.Calculate(); OnQuoteRetrieved(null, null); lblHFFMsg.Text = string.Format(PlatformResources.GetGlobalResourceString("ErrorMessage", "AddHFFSucceeded")); divMsg.Visible = true; ClearDonation.Visible = true; if (SessionInfo.CancelSelfDonation > 0) { ClearDonation2.Visible = true; } else { ClearDonation2.Visible = false; } if (SessionInfo.CancelBehalfOfDonation > 0) { ClearBehalfDonation2.Visible = true; } else { ClearBehalfDonation2.Visible = false; } } } //tbQuantity.Text = HLConfigManager.Configurations.DOConfiguration.HFFHerbalifeDefaultValue.ToString(); } else { LoggerHelper.Error(string.Format("HFF SKU missing from Config for {0}.", Locale)); } } //else //{ // //tbQuantity.Text = string.Empty; // lblHFFMsg.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "AddHFFZero"); // divMsg.Visible = true; //} }
public bool DeleteFile( Guid transactionid, Guid userid, List <BigFileItemInfo> infolist, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string paramstr = string.Empty; paramstr += $"userid:{userid}"; foreach (BigFileItemInfo bi in infolist) { paramstr += $"||ID:{bi.ID}"; } string funname = "DeleteFile"; try { do { AttachResultInfo resultinfo = new AttachResultInfo(); BigAttachDBProvider Provider = new BigAttachDBProvider(); for (int i = 0; i < infolist.Count; i++) { BigFileItemInfo info = infolist[i]; result = Provider.DeleteFile(transactionid, userid, ref info, out error); if (result == true) { //delete temp file if (info.FilePath != string.Empty) { FileInfo fi = new FileInfo(info.FilePath); if (fi.Exists) { fi.Delete(); } } } } if (result == true) { resultinfo.data = true; strJsonResult = JsonConvert.SerializeObject(resultinfo); LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), true, transactionid); result = true; break; } else { resultinfo.data = false; LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; } } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error($"BigAttachManager调用{funname}异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
private string GetStaticGroupList(HttpContext context) { string strJsonResult = string.Empty; string userAccount = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); Guid transactionid = Guid.NewGuid(); string funname = "GetStaticGroupList"; try { do { string strAccesstoken = context.Request["accessToken"]; //判断AccessToken if (string.IsNullOrEmpty(strAccesstoken)) { error.Code = ErrorCode.TokenEmpty; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } AdminInfo admin = new AdminInfo(); if (!TokenManager.ValidateUserToken(transactionid, strAccesstoken, out admin, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } userAccount = admin.UserAccount; string pagesizeStr = context.Request["PageSize"]; if (string.IsNullOrEmpty(pagesizeStr)) { error.Code = ErrorCode.PageSizeEmpty; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } int pagesize = 0; if (!Int32.TryParse(pagesizeStr, out pagesize)) { error.Code = ErrorCode.PageSizeIllegal; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } else { pagesize = Convert.ToInt32(pagesizeStr); } string curpageStr = context.Request["CurPage"]; if (string.IsNullOrEmpty(curpageStr)) { error.Code = ErrorCode.CurPageEmpty; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } int curpage = 0; if (!Int32.TryParse(curpageStr, out curpage)) { error.Code = ErrorCode.CurPageIllegal; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } else { curpage = Convert.ToInt32(curpageStr); } string searchstr = context.Request["Searchstr"]; StaticGroupManager manager = new StaticGroupManager(ClientIP); manager.GetStaticGroupList(transactionid, admin, curpage, pagesize, searchstr, out strJsonResult); } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Error("StaticGroup.ashx调用接口GetStaticGroupList异常", context.Request.RawUrl, ex.ToString(), transactionid); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); } return(strJsonResult); }
public bool AddOperateLog(Guid transactionid, LogInfo log, out ErrorCodeInfo error) { error = new ErrorCodeInfo(); string strError = string.Empty; bool bResult = true; string paramstr = string.Empty; paramstr += $"AdminID:{log.AdminID}"; paramstr += $"||AdminAccount:{log.AdminAccount}"; paramstr += $"||RoleID:{log.RoleID}"; paramstr += $"||OperateType:{log.OperateType}"; paramstr += $"||OperateTimeName:{log.OperateTimeName}"; paramstr += $"||OperateTime:{log.OperateTime}"; paramstr += $"||OperateResult:{log.OperateResult}"; paramstr += $"||OperateLog:{log.OperateLog}"; try { CParameters paras = new CParameters(); SqlParameter paraAdminID = new SqlParameter("@AdminID", log.AdminID); paras.Add(paraAdminID); SqlParameter paraAdminAccount = new SqlParameter("@AdminAccount", log.AdminAccount); paras.Add(paraAdminAccount); SqlParameter paraRoleID = new SqlParameter("@RoleID", log.RoleID); paras.Add(paraRoleID); SqlParameter paraOperateType = new SqlParameter("@OperateType", log.OperateType); paras.Add(paraOperateType); SqlParameter paraOperateLog = new SqlParameter("@OperateLog", log.OperateLog); paras.Add(paraOperateLog); SqlParameter paraOperateResult = new SqlParameter("@OperateResult", log.OperateResult); paras.Add(paraOperateResult); SqlParameter paraClientIP = new SqlParameter("@ClientIP", log.ClientIP); paras.Add(paraClientIP); CBaseDB _db = new CBaseDB(Conntection.strConnection); do { DataSet ds = new DataSet(); if (!_db.ExcuteByTransaction(paras, "dbo.[prc_AddOperateLog]", out ds, out strError)) { strError = "prc_AddOperateLog数据库执行失败,Error:" + strError; bResult = false; error.Code = ErrorCode.SQLException; break; } if (ds != null && ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { int iResult = 0; iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]); switch (iResult) { case 1: bResult = true; break; case -1: bResult = false; error.Code = ErrorCode.HaveSameOu; break; case -9999: bResult = false; error.Code = ErrorCode.SQLException; LoggerHelper.Error("LogDBProvider调用AddOperateLog异常", "", "-9999", transactionid); break; default: bResult = false; error.Code = ErrorCode.Exception; break; } } else { bResult = false; error.Code = ErrorCode.Exception; break; } } else { bResult = false; error.Code = ErrorCode.Exception; LoggerHelper.Error("LogDBProvider调用AddOperateLog异常", "", "ds = null 或者 ds.Tables.Count <= 0", transactionid); } } while (false); } catch (Exception ex) { bResult = false; error.Code = ErrorCode.Exception; LoggerHelper.Error("LogDBProvider调用AddOperateLog异常", paramstr, ex.ToString(), transactionid); } return(bResult); }
private void webClient_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { Action mycontinue = null; Action again = null; string url = e.UserState.ToString(); DownloadTask task = this.GetTask(url); if (task != null) { if (e.Error != null) { if (mycontinue == null) { mycontinue = delegate { task.bDownloadAgain = false; task.bFineshed = true; this.CheckDownLoadList(); }; } if (again == null) { again = delegate { task.bDownloadAgain = true; task.bFineshed = false; this.CheckDownLoadList(); }; } HandleNetworkError(e.Error, mycontinue, again, null); } else { string str2 = Utils.BuildFileMd5(task.FileName); if (str2.Trim() != task.MD5.Trim()) { if (System.IO.File.Exists(task.FileName)) { System.IO.File.Delete(task.FileName); } LoggerHelper.Error("MD5验证失败,从新下载:" + task.FileName + "--" + str2 + " vs " + task.MD5, true); task.bDownloadAgain = true; task.bFineshed = false; this.CheckDownLoadList(); } else { LoggerHelper.Debug("下载验证全部通过,下载完成:" + task.FileName, true, 0); if (this.FileDecompress != null) { this.FileDecompress(true); } task.bDownloadAgain = false; task.bFineshed = true; task.Finished(); if (this.FileDecompress != null) { this.FileDecompress(false); } LoggerHelper.Debug("下载完成后,再次核对下载列表", true, 0); this.CheckDownLoadList(); } } } }
private static List <DeliveryOption> GetDeliveryPickupAlternativesFromCache(ShippingAddress_V01 address) { var deliveryOptions = new List <DeliveryOption>(); var cacheKey = Get7ElevenCacheKey(); var locations = HttpRuntime.Cache[cacheKey] as Dictionary <string, List <DeliveryOption> >; var member = (MembershipUser <DistributorProfileModel>)Membership.GetUser(); if (member == null || member.Value == null) { return(deliveryOptions); } var distributorId = member.Value.Id; if (locations == null || !locations.ContainsKey(distributorId)) { if (locations == null) { locations = new Dictionary <string, List <DeliveryOption> >(); } var proxy = ServiceClientProvider.GetShippingServiceProxy(); try { var pickupAlternativesResponse = proxy.GetDeliveryPickupAlternatives(new GetDeliveryPickupAlternativesRequest(new DeliveryPickupAlternativesRequest_V05() { CountryCode = "TH", DistributorId = distributorId })).GetDeliveryPickupAlternativesResult as DeliveryPickupAlternativesResponse_V05; if (pickupAlternativesResponse != null && pickupAlternativesResponse.DeliveryPickupAlternatives != null) { deliveryOptions.AddRange(from po in pickupAlternativesResponse.DeliveryPickupAlternatives select new DeliveryOption(po, true)); deliveryOptions.ForEach(po => { po.DisplayName = string.Format("{0} #{1}", SevenElevenNickName, po.CourierStoreId); po.Description = po.Name; }); } if (deliveryOptions.Any()) { locations.Add(distributorId, deliveryOptions); HttpRuntime.Cache.Insert(cacheKey, locations, null, DateTime.Now.AddMinutes(SevenElevenCacheMinutes), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null); } } catch (Exception ex) { LoggerHelper.Error( string.Format("GetDeliveryPickupAlternativesFromCache error: Country: TH, error: {0}", ex.Message)); } } if (locations.ContainsKey(distributorId)) { var locList = locations.FirstOrDefault(l => l.Key == distributorId); deliveryOptions = locList.Value; } return(deliveryOptions); }
public bool Upload( Guid transactionid, Guid userid, UploadFileItemInfo info, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); AttachResultInfo resultinfo = new AttachResultInfo(); string paramstr = string.Empty; paramstr += $"userid:{userid}"; paramstr += $"||FileName:{info.FileName}"; paramstr += $"||HashCode:{info.HashCode}"; paramstr += $"||TempID:{info.TempID}"; paramstr += $"||TotalChunks:{info.TotalChunks}"; paramstr += $"||ChunkIndex:{info.ChunkIndex}"; paramstr += $"||Position:{info.Position}"; paramstr += $"||FileSizeInt:{info.FileSizeInt}"; string funname = "Upload"; try { do { BigAttachDBProvider Provider = new BigAttachDBProvider(); UploadFileItemInfo infonow = new UploadFileItemInfo(); infonow.TempID = info.TempID; infonow.FileName = info.FileName; infonow.FileSize = info.FileSizeInt; infonow.ChunkIndex = info.ChunkIndex; infonow.HashCode = info.HashCode; if (info.FileName.IndexOf('.') > 0) { infonow.ExtensionName = info.FileName.Substring(info.FileName.LastIndexOf('.')); } result = Provider.CheckFile(transactionid, userid, ref infonow, out error); if (result == false) { //error //? break; } //check file exists and create FileInfo finfo = new FileInfo(infonow.FilePath); if (finfo.Exists == false && infonow.ChunkIndex != 0) { //error //? break; } if (finfo.Exists == false && infonow.ChunkIndex == 0) { FileStream createfs = finfo.Create(); createfs.Close(); } finfo.Refresh(); long sizenow = finfo.Length; FileStream fs = null; try { if (sizenow < info.Position) { ErrorResult er = new ErrorResult(); er.ErrorCode = "3003"; er.ChunkIndex = infonow.ChunkIndex; resultinfo.data = info; strJsonResult = JsonConvert.SerializeObject(resultinfo); result = true; //delete file //finfo.Delete(); //BigFileItemInfo deleteinfo = new BigFileItemInfo(); //deleteinfo.TempID = infonow.TempID; //Provider.CancelUpload(transactionid, userid, ref deleteinfo, out error); //error // to do break; } else if (sizenow > info.Position) { ErrorResult er = new ErrorResult(); er.ErrorCode = "3003"; er.ChunkIndex = infonow.ChunkIndex; resultinfo.data = info; strJsonResult = JsonConvert.SerializeObject(resultinfo); result = true; } else { fs = new FileStream(infonow.FilePath, FileMode.Append, FileAccess.Write, FileShare.Read, 1024); fs.Write(info.Data, 0, info.Data.Length); fs.Close(); } } catch (Exception ex) { LoggerHelper.Error($"BigAttachManager调用{funname}异常", paramstr, ex.ToString(), transactionid); } finally { if (fs != null) { fs.Close(); } } finfo.Refresh(); info.TempID = infonow.TempID; if (finfo.Length == infonow.FileSizeInt) { // upload finish // move file to new folder string newpath = infonow.FilePath.Substring(0, infonow.FilePath.LastIndexOf("\\temp\\")) + @"\" + DateTime.Now.ToString("yyyy-MM-dd"); string newfilepath = newpath + infonow.FilePath.Substring(infonow.FilePath.LastIndexOf('\\')); if (Directory.Exists(newpath) == false) { Directory.CreateDirectory(newpath); } finfo.MoveTo(newfilepath); info.FilePath = newfilepath; result = Provider.UploadFinish(transactionid, userid, ref info, out error); if (result == true) { info.Succeed = true; resultinfo.data = info; strJsonResult = JsonConvert.SerializeObject(resultinfo); //LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), true, transactionid); result = true; break; } } else { result = Provider.Upload(transactionid, userid, ref info, out error); if (result == true) { info.Succeed = false; resultinfo.data = info; strJsonResult = JsonConvert.SerializeObject(resultinfo); result = true; break; } } } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error($"BigAttachManager调用{funname}异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
private decimal GetDonationAmount() { if (blErrors != null) { blErrors.Items.Clear(); } decimal _totalDonation = decimal.Zero; try { // ShoppingCartID.Value = ShoppingCart.ShoppingCartID.ToString(); //divSubmitDonation.Visible = divCancelDonation.Visible = false; if (btn5Rmb.Checked || btn10Rmb.Checked || btnOtherAmount.Checked) { if (btn5Rmb.Checked) { _selfAmount = 5; } else if (btn10Rmb.Checked) { _selfAmount = 10; } else if (btnOtherAmount.Checked && !String.IsNullOrEmpty(txtOtherAmount.Text.ToString())) { if (decimal.TryParse(txtOtherAmount.Text.ToString(), out _otherAmount)) { _selfAmount = _otherAmount; } } else if (btnOtherAmount.Checked) { txtOtherAmount.Enabled = true; } SessionInfo.CancelSelfDonation = SessionInfo.CancelSelfDonation + _selfAmount; } SessionInfo.CancelBehalfOfDonation = _behalfAmount; bool isValidDonation = true; if (_selfAmount < 1) { isValidDonation = false; ShowError("InvalidDonationAmount"); } var cart = ShoppingCart as MyHLShoppingCart; if (_selfAmount > 0) { var distributorOrderingProfile = DistributorOrderingProfileProvider.GetProfile(cart.DistributorID, "CN"); if (distributorOrderingProfile.PhoneNumbers.Any()) { var phoneNumber = distributorOrderingProfile.PhoneNumbers.Where(p => p.IsPrimary) as PhoneNumber_V03 != null ? distributorOrderingProfile.PhoneNumbers.Where( p => p.IsPrimary) as PhoneNumber_V03 : distributorOrderingProfile.PhoneNumbers.FirstOrDefault() as PhoneNumber_V03; if (phoneNumber != null) { cart.BehalfOfContactNumber = phoneNumber.Number; } else { cart.BehalfOfContactNumber = "21-61033719"; } } cart.BehalfDonationName = ProductsBase.DistributorName; cart.BehalfOfMemberId = DistributorID; if (cart.BehalfOfSelfAmount > 0) { cart.BehalfOfSelfAmount = cart.BehalfOfSelfAmount + _selfAmount; } else { cart.BehalfOfSelfAmount = _selfAmount; } if (cart.BehalfOfAmount > 0) { cart.BehalfOfAmount = cart.BehalfOfAmount; } } if ((_selfAmount > decimal.Zero) && HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU) { var myShoppingCart = (Page as ProductsBase).ShoppingCart; if (myShoppingCart.Totals == null) { myShoppingCart.Totals = new OrderTotals_V02(); } OrderTotals_V02 totals = myShoppingCart.Totals as OrderTotals_V02; if (totals == null) { totals = new OrderTotals_V02(); } if (_selfAmount > decimal.Zero) { _totalDonation = _selfAmount; } } if (errors != null && errors.Count > 0) { blErrors.DataSource = errors; blErrors.DataBind(); errors.Clear(); return(0); } } catch (Exception ex) { LoggerHelper.Error("AddHFFFailed!\n" + ex); } return(_totalDonation); }
public bool Share( Guid transactionid, Guid userid, List <BigFileItemInfo> infolist, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string paramstr = string.Empty; paramstr += $"userid:{userid}"; foreach (BigFileItemInfo bi in infolist) { paramstr += $"||ID:{bi.ID}"; } string funname = "Share"; try { do { AttachResultInfo resultinfo = new AttachResultInfo(); BigAttachDBProvider Provider = new BigAttachDBProvider(); ShareSettingsInfo ssi = new ShareSettingsInfo(); result = Provider.GetShareSettings(transactionid, userid, ref ssi, out error); if (result == false) { resultinfo.data = false; LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } string template = ssi.ShareNotificationTemplate; string filestr = string.Empty; for (int i = 0; i < infolist.Count; i++) { BigFileItemInfo info = infolist[i]; result = Provider.GetFileByID(transactionid, userid, ref info, out error); if (result == true) { filestr += $"<span>{info.FileName}<br /></span>"; } } template = template.Replace("{filename}", filestr); ShareInfo si = new ShareInfo(); result = Provider.AddShare(transactionid, userid, ref si, out error); if (result == false) { resultinfo.data = false; LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } template = template.Replace("{exptime}", si.ExpireTime.ToString("yyyy-MM-dd")); template = template.Replace("{url}", si.ShortUrl); template = template.Replace("{validatecode}", si.ValCode); if (result == true) { for (int i = 0; i < infolist.Count; i++) { BigFileItemInfo info = infolist[i]; result = Provider.AddShareFile(transactionid, si.ShareID, info.ID, out error); } resultinfo.data = template; JsonSerializerSettings jsetting = new JsonSerializerSettings(); jsetting.StringEscapeHandling = StringEscapeHandling.EscapeHtml; strJsonResult = JsonConvert.SerializeObject(resultinfo); LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), true, transactionid); result = true; break; } else { resultinfo.data = false; LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; } } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error($"BigAttachManager调用{funname}异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
public override void CreateActualModel() { AvatarModelData data = AvatarModelData.dataMap.GetValueOrDefault(m_monsterData.model, null); if (data == null) { LoggerHelper.Error("Model not found: " + m_monsterData.model); return; } LoggerHelper.Debug("monster create:" + ID + ",name:" + data.prefabName); SubAssetCacheMgr.GetCharacterInstance(data.prefabName, (prefab, guid, gameObject) => { if (this.Actor) { this.Actor.Release(); } if (Transform) { AssetCacheMgr.ReleaseLocalInstance(Transform.gameObject); } GameObject = (gameObject as GameObject); Transform = GameObject.transform; Transform.localScale = scale; if (data.scale > 0) { Transform.localScale = new Vector3(data.scale, data.scale, data.scale); } Transform.tag = "Monster"; Transform.gameObject.layer = 11; sfxHandler = GameObject.AddComponent <SfxHandler>(); motor = GameObject.AddComponent <MogoMotorServer>(); audioSource = GameObject.AddComponent <AudioSource>(); audioSource.rolloffMode = AudioRolloffMode.Custom; CharacterController controller = GameObject.GetComponent <CharacterController>(); controller.radius = m_monsterData.scaleRadius / 100f; controller.height = EntityColiderHeight; float centerY = (controller.height > controller.radius * 2) ? (controller.height * 0.5f) : (controller.radius); controller.center = new Vector3(0, centerY, 0); animator = GameObject.GetComponent <Animator>(); ActorMercenary ap = GameObject.AddComponent <ActorMercenary>(); ap.theEntity = this; this.Actor = ap; UpdatePosition(); if (data.originalRotation != null && data.originalRotation.Count == 3) { Transform.eulerAngles = new Vector3(data.originalRotation[0], data.originalRotation[1], data.originalRotation[2]); } else { Vector3 targetToLookAt = MogoWorld.thePlayer.Transform.position; Transform.LookAt(new Vector3(targetToLookAt.x, Transform.position.y, targetToLookAt.z)); } motor.canTurn = !NotTurn(); base.CreateModel(); motor.SetAngularSpeed(400f); motor.acceleration = 2f; if (!NotTurn()) { Vector3 bornTargetToLookAt = MogoWorld.thePlayer.position; Transform.LookAt(new Vector3(bornTargetToLookAt.x, Transform.position.y, bornTargetToLookAt.z)); } #region Shader if (ShaderData.dataMap.ContainsKey(m_monsterData.shader) && GameObject.GetComponentsInChildren <SkinnedMeshRenderer>(true) != null && ID != MogoWorld.theLittleGuyID) { MogoFXManager.Instance.SetObjShader(GameObject, ShaderData.dataMap[m_monsterData.shader].name, ShaderData.dataMap[m_monsterData.shader].color); MogoFXManager.Instance.AlphaFadeIn(GameObject, fadeInTime); } #endregion try { if (m_monsterData != null && m_monsterData.bornFx != null) { foreach (var item in m_monsterData.bornFx) { sfxHandler.HandleFx(item); } } } catch (Exception ex) { LoggerHelper.Except(ex); } //开始执行出生流程 m_bModelBuilded = true; m_aiRoot = AIContainer.container.Get((uint)m_monsterData.aiId); uint waitTime = (uint)m_monsterData.bornTime; if (waitTime <= 1) //容错 { waitTime = 3000; } if (blackBoard.timeoutId > 0) { TimerHeap.DelTimer(blackBoard.timeoutId); } m_currentSee = m_monsterData.see; blackBoard.ChangeState(Mogo.AI.AIState.THINK_STATE); TimerHeap.AddTimer(waitTime, 0, RebornAnimationDelay); TimerHeap.AddTimer(waitTime, 0, BornedHandler); Actor.ActChangeHandle = ActionChange; } ); }
/// <summary> /// 获取特定红包当前是否可用--解志辉 /// </summary> /// <param name="reqst">The reqst.</param> /// <returns>ResultInfo<System.String>.</returns> public ResultInfo <string> CheckBonus(RequestParam <RequestCheckBonus> reqst) { var ri = new ResultInfo <string>("99999"); try { var userId = ConvertHelper.ParseValue(reqst.body.userId, 0); var bonusId = reqst.body.bonusId; if (reqst.body.userId <= 0) { ri.code = "1000000000"; } //else if (reqst.body.bonusId <= 0) //{ // ri.code = "3000000000"; //} else { #region 获取优惠券数据 var entity = bonusLogic.SelectBonusById(userId, bonusId); #region 注释代码 //switch (entity.reward_state) //{ // case 1://已使用 // { // ri.code = "3000000002"; // ri.message = Settings.Instance.GetErrorMsg(ri.code); // return ri; // } // break; // case 2://已过期 // { // ri.code = "3000000003"; // ri.message = Settings.Instance.GetErrorMsg(ri.code); // return ri; // } // break; // case 3://已锁定 // { // ri.code = "3000000004"; // ri.message = Settings.Instance.GetErrorMsg(ri.code); // return ri; // } // break; //} #endregion var investAmount = reqst.body.investAmount; if (entity == null) { ri.code = "3000000000"; ri.message = Settings.Instance.GetErrorMsg(ri.code); return(ri); } var limitAmount = entity.Sum(t => t.use_lower_limit); if (investAmount < limitAmount) { ri.code = "3000000005"; ri.message = Settings.Instance.GetErrorMsg(ri.code).Replace("$limit$", limitAmount.ToString()); return(ri); } //可以使用 ri.code = "1"; var str = ""; foreach (var item in entity) { switch (item.reward_state) { case 0: //可以使用 { str += item.bonus_account_id + "|"; } break; default: //不可以使用 { } break; } } ri.body = str; #endregion } ri.message = Settings.Instance.GetErrorMsg(ri.code); return(ri); } catch (Exception ex) { LoggerHelper.Error(ex.ToString()); LoggerHelper.Error(JsonHelper.Entity2Json(reqst)); ri.code = "500"; ri.message = Settings.Instance.GetErrorMsg(ri.code); return(ri); } }
protected override void DoPageLoad() { if (HLConfigManager.Configurations.PaymentsConfiguration.ShowBigGrandTotal) { lblGrandTotal.Attributes.Add("class", "Title"); lblDisplayGrandTotal.Attributes.Add("class", "Title"); } _shoppingCart = (Page as ProductsBase).ShoppingCart; BindTotals(); if ((HLConfigManager.Configurations.DOConfiguration.CalculateWithoutItems && _shoppingCart.Totals != null && (_shoppingCart.Totals as OrderTotals_V01).AmountDue != decimal.Zero) || (_shoppingCart.CartItems.Count > 0 && ShoppingCart.Totals != null)) // if (_shoppingCart.CartItems.Count > 0 && ShoppingCart.Totals != null) { OrderTotals_V01 totals = ShoppingCart.Totals as OrderTotals_V01; if (HLConfigManager.Configurations.CheckoutConfiguration.ConvertAmountDue) { decimal amountDue = OrderProvider.GetConvertedAmount(totals.AmountDue, CountryCode); if (amountDue == 0.0M) { LoggerHelper.Error("Exception while getting the currency conversion - "); DisplayEmptyLabels(); var eventArgs = new PageVisitRefusedEventArgs(Request.Url.PathAndQuery, String.Empty, PageVisitRefusedReason.UnableToPrice); OnPageVisitRefused(this, eventArgs); return; } if (HLConfigManager.Configurations.PaymentsConfiguration.RoundAmountDue == "Standard") { amountDue = Math.Round(amountDue); } lblGrandTotal.Text = getAmountString(amountDue, true); } else { if (HLConfigManager.Configurations.PaymentsConfiguration.RoundAmountDue == "Standard") { totals.AmountDue = Math.Round(totals.AmountDue); } lblGrandTotal.Text = getAmountString(_shoppingCart.Totals != null ? totals.AmountDue : (decimal)0.00); } } if (_shoppingCart.OrderCategory == OrderCategoryType.ETO || !HLConfigManager.Configurations.CheckoutConfiguration.HasEarnBase) { if (_shoppingCart.OrderCategory == OrderCategoryType.ETO || !HLConfigManager.Configurations.CheckoutConfiguration.HasSummaryEarnBase) { trEarnBase.Visible = false; } } //if (_shoppingCart.OrderCategory == HL.Common.ValueObjects.OrderCategoryType.ETO || HLConfigManager.Configurations.CheckoutConfiguration.HidePHShippingForETO) //{ // trPackageHandling.Visible = trShippingCharges.Visible = false; //} var control = loadPurchasingLimitsControl(true); if (control != null) { trLimits.Visible = true; pnlPurchaseLimits.Controls.Add(control); } if (HLConfigManager.Configurations.CheckoutConfiguration.HasOtherCharges) { trOtherCharges.Visible = true; } // Conditioning tax vat row visibility. if (trTaxVat != null) { trTaxVat.Visible = HLConfigManager.Configurations.CheckoutConfiguration.HasTaxVat; } if (HLConfigManager.Configurations.CheckoutConfiguration.HasLocalTax) { trLocalTax.Visible = true; } if (HLConfigManager.Configurations.CheckoutConfiguration.HasDiscountAmount) { trDiscountAmount.Visible = true; } if (trAdditionalDiscount != null) { trAdditionalDiscount.Visible = HLConfigManager.Configurations.CheckoutConfiguration.MergePHAndShippingCharges; } if (trSubtotal != null) { trSubtotal.Visible = HLConfigManager.Configurations.CheckoutConfiguration.MergePHAndShippingCharges; } if (HLConfigManager.Configurations.CheckoutConfiguration.HidePHShippingForETO) { if (SessionInfo.IsEventTicketMode) { trPackingHandling.Visible = false; trShippingCharge.Visible = false; if (!HLConfigManager.Configurations.CheckoutConfiguration.ShowVolumePoinsForETO) { trVolumePoints.Visible = false; } if (HLConfigManager.Configurations.CheckoutConfiguration.HasSubTotalOnTotalsDetailed) { trDistributorSubtotal.Visible = false; } else { trDistributorSubtotal.Visible = true; } } } if (DistributorOrderingProfile != null && DistributorOrderingProfile.IsPC) { trVolumePoints.Visible = trOrderMonthVolume.Visible = false; } if (!HLConfigManager.Configurations.CheckoutConfiguration.HasOrderMonthVolumePoints) { trOrderMonthVolume.Visible = false; } if (HLConfigManager.Configurations.CheckoutConfiguration.HideFreightCharges && _shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Pickup) { trShippingCharge.Visible = false; } if (HLConfigManager.Configurations.CheckoutConfiguration.HideShippingCharges) { trShippingCharge.Visible = false; } if (!HLConfigManager.Configurations.CheckoutConfiguration.HasRetailPrice) { if (trRetailPrice != null) { trRetailPrice.Visible = false; } } else if (SessionInfo.IsEventTicketMode && trRetailPrice != null) { trRetailPrice.Visible = HLConfigManager.Configurations.CheckoutConfiguration.HasRetailPriceForETO; } if (HLConfigManager.Configurations.CheckoutConfiguration.HasLogisticCharges) { if (trLogisticCharge != null) { trLogisticCharge.Visible = true; } } if (_shoppingCart.DeliveryInfo != null) { if (_shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Pickup) { if (HLConfigManager.Configurations.CheckoutConfiguration.HasPickupCharge) { if (lblDisplayShippingCharges != null) { lblDisplayShippingCharges.Text = (string)GetLocalResourceObject("lblDisplayPickupCharges"); } } else { trShippingCharge.Visible = false; } } } //New Code to hide/display the ? string levelDSType = (Page as ProductsBase).Level; if (levelDSType == "DS") { imgOrderMonth.Visible = true; } else { imgOrderMonth.Visible = false; } // Check for NPS updates. if (imgEarnBase != null) { imgEarnBase.Visible = ShowEarnBaseHelpInfo(); } if (trDiscountTotal != null) { trDiscountTotal.Visible = HLConfigManager.Configurations.CheckoutConfiguration.ShowDisocuntTotal; } if (RemovePHCharge()) { if (trPackingHandling != null) { trPackingHandling.Visible = false; } } }
public bool GetMovePointStraight(int skillRange) { // LoggerHelper.Error("GetMovePointStraight"); EntityParent enemy = GetTargetEntity(); Container enemyTrap = GetTargetContainer(); if (enemy == null && enemyTrap == null) { return(false); } if (enemy != null) { if (enemy.Transform == null) { LoggerHelper.Error("enemy.Transform == null"); } else if (Transform == null) { LoggerHelper.Error("Transform == null"); } int distance = skillRange; float entityRadius = enemy.MonsterData.scaleRadius; if (entityRadius <= 0.1f) { entityRadius = (float)enemy.GetIntAttr("scaleRadius"); } int curdistance = (int)(Vector3.Distance(Transform.position, enemy.Transform.position) * 100 - entityRadius); if (distance >= curdistance)// || curdistance-distance < 0.1f { StopMove(); return(false); } else { blackBoard.navTargetDistance = (uint)skillRange + (uint)entityRadius; blackBoard.movePoint = enemy.Transform.position; } float tmpDis = Vector3.Distance(Transform.position, new Vector3(blackBoard.movePoint.x, Transform.position.y, blackBoard.movePoint.z)); if (tmpDis < 1.0f) { StopMove(); return(false); } return(true); } else if (enemyTrap != null) { if (enemyTrap.transform == null) { LoggerHelper.Error("enemy.Transform == null"); } else if (Transform == null) { LoggerHelper.Error("Transform == null"); } int distance = skillRange; int curdistance = (int)(Vector3.Distance(Transform.position, enemyTrap.transform.position) * 100); if (distance >= curdistance)// || curdistance-distance < 0.1f { StopMove(); return(false); } else { blackBoard.navTargetDistance = (uint)skillRange; blackBoard.movePoint = enemyTrap.transform.position; } float tmpDis = Vector3.Distance(Transform.position, new Vector3(blackBoard.movePoint.x, Transform.position.y, blackBoard.movePoint.z)); if (tmpDis < 1.0f) { StopMove(); return(false); } return(true); } else { return(false); } }
void webClient_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { String keyurl = e.UserState.ToString(); DownloadTask task = GetTask(keyurl); if (task != null) { //先校验网络是否异常 if (e.Error != null) { HandleNetworkError(e.Error, () => { //跳过当前这个下载下一个 task.bDownloadAgain = false; task.bFineshed = true; CheckDownLoadList(); }, () => { //从新下载这个 task.bDownloadAgain = true; task.bFineshed = false; CheckDownLoadList(); }); } else { //验证MD5 #if UNITY_IPHONE //ios下如果封装该方法在一个函数中,调用该函数来产生文件的MD5的时候,就会抛JIT异常。 //如果直接把这个产生MD5的方法体放在直接执行,就可以正常执行,这个原因还不清楚。 string md5Compute = null; using (System.IO.FileStream fileStream = System.IO.File.OpenRead(task.FileName)) { System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create(); byte[] fileMD5Bytes = md5.ComputeHash(fileStream); md5Compute = System.BitConverter.ToString(fileMD5Bytes).Replace("-", "").ToLower(); } #else String md5Compute = Utils.BuildFileMd5(task.FileName); #endif //md5验证失败 if (md5Compute.Trim() != task.MD5.Trim()) { //如果md5验证失败,删除原文件 if (File.Exists(task.FileName)) { File.Delete(task.FileName); } LoggerHelper.Error("MD5验证失败,从新下载:" + task.FileName + "--" + md5Compute + " vs " + task.MD5); task.bDownloadAgain = true; task.bFineshed = false; CheckDownLoadList(); return; } //所有通过验证就认为是下载完成 LoggerHelper.Debug("下载验证全部通过,下载完成:" + task.FileName); if (FileDecompress != null) { FileDecompress(true); } task.bDownloadAgain = false; task.bFineshed = true; task.Finished(); if (FileDecompress != null) { FileDecompress(false); } LoggerHelper.Debug("下载完成后,再次核对下载列表"); CheckDownLoadList(); } } }
void OnPress(bool isOver) { if (isOver) { Physics.Raycast(m_relatedCam.ScreenPointToRay(Input.mousePosition), out m_rayHit, 10000.0f); m_iDragStartID = m_rayHit.transform.GetComponentsInChildren <DragonUIPackageGrid>(true)[0].ID; EventDispatcher.TriggerEvent <int>("DragonUIPackageGridDown", ID); } else { if (m_bStartCount) { m_bStartCount = false; if (m_fTime <= CLICKELISP) { if (m_relatedCollider.Raycast(m_relatedCam.ScreenPointToRay(Input.mousePosition), out m_rayHit, 10000.0f)) { if (DragonUIDict.ButtonTypeToEventUp[transform.name + "Double"] == null) { LoggerHelper.Error("No ButtonTypeToEventUp Info"); return; } DragonUIDict.ButtonTypeToEventUp[transform.name + "Double"](ID); } } } else { m_bStartCount = true; } m_fTime = 0; m_oldClick = transform; if (m_bIsDragging) { m_bIsDragging = false; if (Physics.Raycast(m_relatedCam.ScreenPointToRay(Input.mousePosition), out m_rayHit, 10000.0f) && (m_rayHit.transform.GetComponentsInChildren <DragonUIPackageGrid>(true).Length > 0)) { int id = m_rayHit.transform.GetComponentsInChildren <DragonUIPackageGrid>(true)[0].ID; EventDispatcher.TriggerEvent <int, int>("DragonUIPackageGridDrag", id, m_iDragStartID); // m_iDragStartID = id; } else { EventDispatcher.TriggerEvent("DragonUIPackageGridDragOutside"); } } m_bIsDragBegin = false; } }
/// <summary> /// 投资记录实体列表 /// </summary> public List <InvestRecordEntity> InvestRecordEntity(DataTable dt) { var entityList = new List <InvestRecordEntity>(); try { int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int n = 0; n < rowsCount; n++) { var entity = new InvestRecordEntity(); var row = dt.Rows[n]; if (ContainsColumn(dt.Columns, "tender_id", row)) { entity.tender_id = dt.Rows[n]["tender_id"].ToString(); } if (ContainsColumn(dt.Columns, "username", row)) { entity.username = dt.Rows[n]["username"].ToString().Substring(0, 4) + "*****"; } if (ContainsColumn(dt.Columns, "account", row)) { entity.account = ConvertHelper.ParseValue(dt.Rows[n]["account"], 0M); } //系统状态:1 成功 2 失败 3流标返还 //第三方状态:0 待审核 1 待回款 2 成功回款 3 坏账 4债权转让 5投标失败 if (ContainsColumn(dt.Columns, "state", row)) { switch (dt.Rows[n]["state"].ToString()) { case "1": entity.status = "2"; break; case "2": entity.status = "5"; break; case "3": entity.status = "2"; break; default: entity.status = "0"; break; } } if (ContainsColumn(dt.Columns, "borrow_id", row)) { entity.borrow_id = dt.Rows[n]["borrow_id"].ToString(); } if (ContainsColumn(dt.Columns, "tender_time", row)) { entity.tender_time = dt.Rows[n]["tender_time"].ToString(); } entityList.Add(entity); } } else { return(null); } } catch (Exception ex) { LoggerHelper.Error(" public List<InvestRecordEntity> InvestRecordEntity(DataTable dt) throw exception:", ex); } return(entityList); }
//导出一个 private static IEnumerator ExportItem() { Stopwatch exportTime = new Stopwatch(); exportTime.Start(); string[] allPathes = null; ResourceIndexInfo.Instance.Init(Application.streamingAssetsPath + "/ResourceIndexInfo.txt", () => { allPathes = ResourceIndexInfo.Instance.GetLeftFilePathes(); LoggerHelper.Debug("Export Items Count:" + allPathes.Length); }); var sw = new Stopwatch(); sw.Start(); while (allPathes == null || allPathes.Length == 0) { if (sw.ElapsedMilliseconds > 3000) { LoggerHelper.Info("Cache assets timeout"); break; } LoggerHelper.Debug("allPathes==null"); } sw.Stop(); LoggerHelper.Debug("allPathes!=null"); foreach (var srcName in allPathes) { //非空闲时不导出 while (!_bExportable) { LoggerHelper.Debug("Game busy,Not Export:" + _bExportable); yield return(0); } var dstPath = String.Concat(SystemConfig.ResourceFolder, srcName); ////暂时用于测试的,最后会关掉 //if (File.Exists(dstPath)) // File.Delete(dstPath); if (!File.Exists(dstPath)) { var srcPath = Utils.GetStreamPath(srcName); LoggerHelper.Debug("Export:" + srcPath); var www = new WWW(srcPath); yield return(www); LoggerHelper.Debug("Export Finish:" + srcPath); if (www.bytes != null && www.bytes.Length != 0) { var tempFile = dstPath + "_temp"; XMLParser.SaveBytes(tempFile, www.bytes); File.Move(tempFile, dstPath); LoggerHelper.Debug("Cache asset to sd card:" + dstPath); } else { LoggerHelper.Error(string.Format("file not exist: {0}", srcName)); } //每隔多少帧 var frameCount = FrameCount; while (frameCount-- >= 0) { yield return(0); } } } LoggerHelper.Info("Cache all assets finish,all time:" + exportTime.ElapsedMilliseconds / 1000); exportTime.Stop(); yield return(0); }
private static ContactResultModel DoLoadContacts(string memberId, GridPageModel data) { try { if (null != data && null != data.filter && null != data.filter.Filters && data.filter.Filters.Any()) { var filter = data.filter.Filters.FirstOrDefault(); if (null != filter && null != filter.Filters && filter.Filters.Any()) { var anyFilter = filter.Filters.FirstOrDefault(); if (null != anyFilter && null != anyFilter.Value) { var filteredContacts = _contactsSource.SearchContacts(memberId, anyFilter.Value.ToString()); if (null != filteredContacts && filteredContacts.Any()) { return(new ContactResultModel { Items = filteredContacts.Skip(data.skip).Take(data.take).ToList(), TotalCount = filteredContacts.Count() }); } return(new ContactResultModel { Items = new List <ContactViewModel>(), TotalCount = 0 }); } } } var contacts = _contactsSource.GetContacts(memberId); if (null == contacts) { LoggerHelper.Error("_contactsSource is returning null for " + memberId); return(new ContactResultModel { Items = new List <ContactViewModel>(), TotalCount = 0 }); } if (null == data) { return(new ContactResultModel { Items = contacts, TotalCount = contacts.Count }); } return(new ContactResultModel { Items = contacts.Skip(data.skip).Take(data.take).ToList(), TotalCount = contacts.Count }); } catch (Exception ex) { LoggerHelper.Exception("System.Exception", ex, "DoLoadContacts ContactsController is throwing error for " + memberId); return(new ContactResultModel { Items = new List <ContactViewModel>(), TotalCount = 0 }); } }
public void AttachFXToTimeLimitActivityInfoUI(Transform tranFxPos, Action <GameObject> action) { if (m_infoGridListMogoListImproved.SourceCamera == null) { m_infoGridListMogoListImproved.SourceCamera = GameObject.Find("Camera").GetComponentsInChildren <Camera>(true)[0]; } if (m_infoGridListMogoListImproved.ObjCamera == null) { LoggerHelper.Error("m_infoGridListMogoListImproved.ObjCamera is null"); return; } INSTANCE_COUNT++; MogoGlobleUIManager.Instance.ShowWaitingTip(true); if (m_gridTimeLimitActivityListCamera == null) { m_gridTimeLimitActivityListCamera = m_infoGridListMogoListImproved.ObjCamera.GetComponentsInChildren <Camera>(true)[0]; } if (m_gridTimeLimitActivityListCameraFX == null) { GameObject goTimeLimitActivityInfoCameraFx = new GameObject(); goTimeLimitActivityInfoCameraFx.name = "TimeLimitActivityInfoCameraFx"; goTimeLimitActivityInfoCameraFx.transform.parent = m_infoGridListMogoListImproved.ObjCamera.transform; goTimeLimitActivityInfoCameraFx.transform.localPosition = new Vector3(0, 0, 0); goTimeLimitActivityInfoCameraFx.transform.localScale = new Vector3(1, 1, 1); // 设置特效摄像机 m_gridTimeLimitActivityListCameraFX = goTimeLimitActivityInfoCameraFx.AddComponent <Camera>(); m_gridTimeLimitActivityListCameraFX.clearFlags = CameraClearFlags.Depth; m_gridTimeLimitActivityListCameraFX.cullingMask = 1 << 0; m_gridTimeLimitActivityListCameraFX.orthographic = true; m_gridTimeLimitActivityListCameraFX.orthographicSize = m_gridTimeLimitActivityListCamera.orthographicSize; m_gridTimeLimitActivityListCameraFX.nearClipPlane = -50; m_gridTimeLimitActivityListCameraFX.farClipPlane = 50; m_gridTimeLimitActivityListCameraFX.depth = 30; m_gridTimeLimitActivityListCameraFX.rect = m_gridTimeLimitActivityListCamera.rect; } Vector3 pos = m_gridTimeLimitActivityListCamera.WorldToScreenPoint(tranFxPos.position); pos = m_gridTimeLimitActivityListCameraFX.ScreenToWorldPoint(pos); AssetCacheMgr.GetUIInstance("fx_ui_skill_yes.prefab", (prefab, id, go) => { GameObject goFx = null; goFx = (GameObject)go; goFx.name = "TimeLimitActivityInfoFinishedFx"; goFx.transform.parent = m_goTimeLimitActivityInfoGridListFx.transform; goFx.transform.position = pos; goFx.transform.localPosition += new Vector3(3, -120, 0); goFx.transform.localScale = new Vector3(1f, 1f, 1f); INSTANCE_COUNT--; if (INSTANCE_COUNT <= 0) { MogoGlobleUIManager.Instance.ShowWaitingTip(false); } if (action != null) { action(goFx); } }); }