private void UpdateOrder() { Order order = DataAccessContext.OrderRepository.GetOne(CurrentOrderID); order.OrderDate = GetOrderDate(GetCalendarDate("uxOrderDateCalendarPopup")); order.UserName = GetText("uxUserNameText"); order.Billing = new Address(GetText("uxFirstNameText"), GetText("uxLastNameText"), GetText("uxCompanyText"), GetText("uxAddress1Text"), GetText("uxAddress2Text"), GetText("uxCityText"), GetStateList("uxStateList"), GetText("uxZipText"), GetCountryList("uxCountryList"), GetText("uxPhoneText"), GetText("uxFaxText")); order.Email = GetText("uxEmailText"); order.Shipping = new ShippingAddress( new Address(GetText("uxShippingFirstNameText"), GetText("uxShippingLastNameText"), GetText("uxShippingCompanyText"), GetText("uxShippingAddress1Text"), GetText("uxShippingAddress2Text"), GetText("uxShippingCityText"), GetStateList("StateListShipping"), GetText("uxShippingZipText"), GetCountryList("CountryListShipping"), GetText("uxShippingPhoneText"), GetText("uxShippingFaxText")), false); order.PaymentMethod = GetText("uxPaymentMethodText"); order.ShippingMethod = GetText("uxShippingMethodText"); order.PaymentComplete = GetCheck("uxPaymentCompleteCheck"); order.Processed = GetCheck("uxProcessedCheck"); order.Status = GetDrop("uxStatusDrop"); order.Cancelled = GetCheck("uxCancelledCheck"); order.IPAddress = GetText("uxIPAddressText"); order.Subtotal = DataAccessContext.OrderItemRepository.GetSubtotal(CurrentOrderID); order.Tax = ConvertUtilities.ToDecimal(GetText("uxTaxText")); order.ShippingCost = ConvertUtilities.ToDecimal(GetText("uxShippingCostText")); order.CouponID = GetText("uxCouponIDText"); order.CouponDiscount = ConvertUtilities.ToDecimal(GetText("uxCouponDiscountText")); order.CustomerComments = GetText("uxCommentText"); order.BaseCurrencyCode = GetText("uxBaseCodeText"); order.UserCurrencyCode = GetText("uxUserCurrencyCodeText"); order.UserConversionRate = ConvertUtilities.ToDouble(GetText("uxConversionRateText")); order.InvoiceNotes = GetText("uxInvoiceNotesText"); order.GiftCertificateCode = GetText("uxGiftCertificateCodeText"); order.GiftCertificate = ConvertUtilities.ToDecimal((GetText("uxGiftCertificateText"))); order.TrackingNumber = GetText("uxTrackingNumerText"); order.TrackingMethod = GetDrop("uxTrackingMethodDrop"); order.HandlingFee = ConvertUtilities.ToDecimal(GetText("uxHandlingFeeText")); order.ContainsRecurring = IsOrderContainRecurring(); order.AvsAddrStatus = ((DropDownList)uxFormView.Row.FindControl("uxAvsAddrDrop")).SelectedValue; order.AvsZipStatus = ((DropDownList)uxFormView.Row.FindControl("uxAvsZipDrop")).SelectedValue; order.CvvStatus = ((DropDownList)uxFormView.Row.FindControl("uxCvvDrop")).SelectedValue; order.PONumber = GetText("uxPONumberText"); if (IsSaleTaxExemptVisible(true) && !String.IsNullOrEmpty(GetText("uxTaxExepmtIDText"))) { order.IsTaxExempt = true; order.TaxExemptID = GetText("uxTaxExepmtIDText"); order.TaxExemptCountry = GetCountryList("uxTaxExemptCountryList"); order.TaxExemptState = GetStateList("uxTaxExemptStateList"); } else { order.IsTaxExempt = false; order.TaxExemptID = String.Empty; order.TaxExemptCountry = String.Empty; order.TaxExemptState = String.Empty; } DataAccessContext.OrderRepository.Save(order); if (order.PaymentComplete) { CustomerRewardPoint.UpdateRewardPoint(order); if (!order.IsSubscriptionApplied) { OrderNotifyService orderNotifyService = new OrderNotifyService(order.OrderID); orderNotifyService.UpdateCustomerSubscription(order); order.IsSubscriptionApplied = true; DataAccessContext.OrderRepository.Save(order); } } }
protected void uxVevoPayPADSSModeDrop_SelectedIndexChanged(object sender, EventArgs e) { uxVevoPayConfigPanel.Visible = ConvertUtilities.ToBoolean(uxVevoPayPADSSModeDrop.SelectedValue); }
public override System.Web.Security.MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { global::SoftFluent.Samples.GED.Security.User user = new global::SoftFluent.Samples.GED.Security.User(); if (providerUserKey != null) { if (providerUserKey is System.Guid) { user.Id = (System.Guid)providerUserKey; } else { status = MembershipCreateStatus.InvalidProviderUserKey; return(null); } } email = ConvertUtilities.Nullify(email, true); if ((email != null) && (email.Length > 256)) { status = MembershipCreateStatus.InvalidEmail; return(null); } if ((email == null) && RequiresUniqueEmail) { status = MembershipCreateStatus.InvalidEmail; return(null); } user.Email = email; password = ConvertUtilities.Nullify(password, true); user.PasswordSalt = GenerateSalt(); string encodedPassword = EncodePassword(password, user.PasswordSalt); if ((password == null) || (password.Length > 256)) { status = MembershipCreateStatus.InvalidPassword; return(null); } user.Password = encodedPassword; username = ConvertUtilities.Nullify(username, true); if ((username == null) || (username.Length > 256)) { status = MembershipCreateStatus.InvalidUserName; return(null); } user.UserName = username; DateTime time = DateTime.UtcNow; time = new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute, time.Second); user.IsLockedOut = false; user.LastLoginDate = time; user.LastActivityDate = time; user.LastPasswordChangeDate = time; user.LastLockoutDate = DateTime.MinValue; if (password.Length < MinRequiredPasswordLength) { status = MembershipCreateStatus.InvalidPassword; return(null); } int min = 0; for (int i = 0; i < password.Length; i++) { if (!char.IsLetterOrDigit(password, i)) { min++; } } if (min < MinRequiredNonAlphanumericCharacters) { status = MembershipCreateStatus.InvalidPassword; return(null); } if ((!string.IsNullOrEmpty(PasswordStrengthRegularExpression)) && (!Regex.IsMatch(password, PasswordStrengthRegularExpression))) { status = MembershipCreateStatus.InvalidPassword; return(null); } ValidatePasswordEventArgs e = new ValidatePasswordEventArgs(username, password, true); OnValidatingPassword(e); if (e.Cancel) { status = MembershipCreateStatus.InvalidPassword; return(null); } try { user.Save(); } catch (CodeFluent.Runtime.CodeFluentDuplicateException) { status = MembershipCreateStatus.DuplicateProviderUserKey; return(null); } status = MembershipCreateStatus.Success; return(MembershipUserFromUser(user)); }
private async void ButtonGenerate_OnClick(object sender, RoutedEventArgs e) { if (ConnectionStringObject == null) { return; } Database database = Database.Get(SelectedDatabaseSystem.ToString(), ConnectionStringObject.ToString(true)); if (!database.Exists) { MessageBox.Show("Cannot connect to the database"); return; } // Update Recent configurations Settings.Current.AddRecentConnectionString(SelectedDatabaseSystem, database); Settings.Current.SerializeToConfiguration(); // Generate try { CircularProgressBar.Visibility = Visibility.Visible; Exception exception = null; var count = ConvertUtilities.ChangeType(TextBoxRows.Text, 100); var nullCount = ConvertUtilities.ChangeType(TextBoxNullRows.Text, 5); await Task.Run(() => { Project project = new Project(database); project.BatchStatementCount = 1; project.InitializeDefaultGenerator(); SqlScriptExecutor sqlScriptExecutor = new SqlScriptExecutor(); if (Debugger.IsAttached) { project.Generate(sqlScriptExecutor, count, nullCount); } else { try { project.Generate(sqlScriptExecutor, count, nullCount); } catch (Exception ex) { exception = ex; } } }); if (exception == null) { MessageBox.Show("Done"); } else { MessageBox.Show(exception.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } finally { CircularProgressBar.Visibility = Visibility.Collapsed; } }
private int GetRewardPoint() { OrderAmount orderAmount = StoreContext.GetOrderAmount(); OrderCalculator calculator = new OrderCalculator(); return(calculator.GetPointFromPrice((orderAmount.Subtotal - orderAmount.Discount), ConvertUtilities.ToDecimal(DataAccessContext.Configurations.GetValue("RewardPoints", StoreContext.CurrentStore)))); }
public bool IsShowRecurringPeriod() { return(ConvertUtilities.ToBoolean(CurrentProduct.IsRecurring) && !CatalogUtilities.IsOutOfStock(CurrentProduct.SumStock, CurrentProduct.UseInventory)); }
protected string GetDisplayText(object groupName) { if (groupName.ToString().ToLower() == "price") { if (String.IsNullOrEmpty(MaxPrice)) { return(StoreContext.Currency.FormatPrice(ConvertUtilities.ToDecimal(MinPrice)) + GetLanguageText("andabove")); } return(StoreContext.Currency.FormatPrice(ConvertUtilities.ToDecimal(MinPrice)) + " - " + StoreContext.Currency.FormatPrice(ConvertUtilities.ToDecimal(MaxPrice))); } else if (groupName.ToString() == "[$Category]") { Category category = DataAccessContext.CategoryRepository.GetOne(StoreContext.Culture, Request.QueryString["cat"]); return(category.Name); } else if (groupName.ToString() == "[$Department]") { Department department = DataAccessContext.DepartmentRepository.GetOne(StoreContext.Culture, Request.QueryString["dep"]); return(department.Name); } else if (groupName.ToString() == "[$Manufacturer]") { Manufacturer manufacturer = DataAccessContext.ManufacturerRepository.GetOne(StoreContext.Culture, Request.QueryString["manu"]); return(manufacturer.Name); } else { SpecificationItem specItem = DataAccessContext.SpecificationItemRepository.GetOneByName(StoreContext.Culture, groupName.ToString()); SpecificationItemValue specValue = DataAccessContext.SpecificationItemValueRepository.GetOneBySpecItemIDAndValue(StoreContext.Culture, specItem.SpecificationItemID, Request.QueryString[groupName.ToString()]); return(specValue.DisplayValue); } }
public static IList <Product> GetProductList( Culture culture, string sortBy, int startIndex, int endIndex, object[] userDefined, out int howManyItems) { string categoryID = userDefined[0].ToString(); string departmentID = userDefined[1].ToString(); bool isFacet = ConvertUtilities.ToBoolean(userDefined[6]); IList <string> list = new List <string>(); IList <string> categoryids = DataAccessContext.CategoryRepository.GetLeafFromCategoryID(categoryID, list); List <string> categoryCollection = new List <string>(); foreach (string categoryItem in categoryids) { categoryCollection.Add(categoryItem); } IList <string> departmentIDs = new List <string>(); if (!String.IsNullOrEmpty(departmentID)) { IList <string> depList = new List <string>(); departmentIDs = DataAccessContext.DepartmentRepository.GetLeafFromDepartmentID(departmentID, depList); } List <string> departmentCollection = new List <string>(); foreach (string departmentItem in departmentIDs) { departmentCollection.Add(departmentItem); } if (isFacet) { return(DataAccessContext.ProductRepository.GetFacetResultByCategoryID( culture, categoryCollection.ToArray(), departmentCollection.ToArray(), userDefined[2].ToString(), userDefined[3].ToString(), userDefined[4].ToString(), (IList <SpecificationItemValue>)userDefined[5], sortBy, startIndex, endIndex, BoolFilter.ShowTrue, out howManyItems, new StoreRetriever().GetCurrentStoreID() )); } else { return(DataAccessContext.ProductRepository.GetByCategoryID( culture, userDefined[0].ToString(), sortBy, startIndex, endIndex, BoolFilter.ShowTrue, out howManyItems, new StoreRetriever().GetCurrentStoreID() )); } }
protected void uxNegotiatedRatesIndicatorDrop_SelectedIndexChanged(object sender, EventArgs e) { uxShipperNumberDiv.Visible = ConvertUtilities.ToBoolean(uxNegotiatedRatesIndicatorDrop.SelectedValue); }
private void Update() { try { if (Page.IsValid) { if (uxProductInfo.ConvertToCategoryIDs().Length > 0) { if (!uxProductAttributes.VerifyInputListOption()) { DisplayErrorOption(); return; } string price; string retailPrice; string wholeSalePrice; string wholeSalePrice2; string wholeSalePrice3; decimal giftAmount; if (uxProductAttributes.IsFixPrice( uxGiftCertificate.IsFixedPrice, uxGiftCertificate.IsGiftCertificate, uxRecurring.IsRecurring, uxProductAttributes.IsCallForPrice)) { price = uxProductAttributes.Price; retailPrice = uxProductAttributes.RetailPrice; wholeSalePrice = uxProductAttributes.WholeSalePrice; wholeSalePrice2 = uxProductAttributes.WholeSalePrice2; wholeSalePrice3 = uxProductAttributes.WholeSalePrice3; giftAmount = ConvertUtilities.ToDecimal(uxGiftCertificate.GiftAmount); } else { price = "0"; retailPrice = "0"; wholeSalePrice = "0"; wholeSalePrice2 = "0"; wholeSalePrice3 = "0"; giftAmount = 0m; } string storeID = new StoreRetriever().GetCurrentStoreID(); Product product = DataAccessContext.ProductRepository.GetOne(uxLanguageControl.CurrentCulture, CurrentID, storeID); product = SetUpProduct(product); product = DataAccessContext.ProductRepository.Save(product); uxMessage.DisplayMessage(Resources.ProductMessages.UpdateSuccess); AdminUtilities.ClearSiteMapCache(); PopulateControls(); } else { uxMessage.DisplayError(Resources.ProductMessages.AddErrorCategoryEmpty); return; } } } catch (Exception ex) { uxMessage.DisplayException(ex); } }
private bool SetShippingCouponGiftDetails() { string errMsg; bool isValid; if (!SetCoupon()) { return(false); } string giftCode = uxCouponGiftDetails.GetGiftCertificateCode(out isValid); if (!isValid) { return(false); } StoreContext.CheckoutDetails.SetGiftCertificate(giftCode); if (DataAccessContext.Configurations.GetBoolValue("PointSystemEnabled", CurrentStore)) { string rewardPoint = uxCouponGiftDetails.GetRewardPointValue(out isValid); if (!isValid) { return(false); } StoreContext.CheckoutDetails.RedeemPrice = uxCouponGiftDetails.GetPriceFromPoint(ConvertUtilities.ToDecimal(rewardPoint)); StoreContext.CheckoutDetails.RedeemPoint = ConvertUtilities.ToInt32(rewardPoint); } SetBillingAddress(); SetShippingAddress(); if (!SetShippingMethod(out errMsg)) { return(false); } return(true); }
private decimal GetPriceFromPoint(decimal point) { return(point * ConvertUtilities.ToDecimal(DataAccessContext.Configurations.GetValue("PointValue", StoreContext.CurrentStore))); }
public String getText() { return(ConvertUtilities.replaceOut(richTextBox1.Text)); }
public void setText(String t) { richTextBox1.Text = ConvertUtilities.replaceIn(t); }
protected bool IsReferenceLinkVisible(object rewardPointID) { string pointID = ConvertUtilities.ToString(rewardPointID); return(!IsPointReferenceLabelVisible(pointID)); }
protected string GetTextName(object item) { DataRowView data = ( DataRowView )item; DateTime time = new DateTime(ConvertUtilities.ToInt32(data.Row["CreateYear"]), ConvertUtilities.ToInt32(data.Row["CreateMonth"]), 1); string monthName = time.ToString("MMMM"); return(monthName + " " + data.Row["CreateYear"]); }
/// <summary> /// Update data and create change log /// </summary> /// <param name="pageLog"></param> /// <param name="pageLogModel"></param> /// <returns></returns> private string ChangeLog(PageLog pageLog, PageLogManageModel pageLogModel) { var changeLog = new StringBuilder(); const string format = "- Update field: {0}\n"; if (!ConvertUtilities.Compare(pageLog.Title, pageLogModel.Title)) { changeLog.AppendFormat(format, "Title"); pageLog.Title = pageLogModel.Title; } if (!ConvertUtilities.Compare(pageLog.FriendlyUrl, pageLogModel.FriendlyUrl)) { changeLog.AppendFormat(format, "FriendlyUrl"); pageLog.FriendlyUrl = pageLogModel.FriendlyUrl; } if (!ConvertUtilities.Compare(pageLog.Content, pageLogModel.Content)) { changeLog.AppendFormat(format, "Content"); pageLog.Content = pageLogModel.Content; } if (!ConvertUtilities.Compare(pageLog.ContentWorking, pageLogModel.ContentWorking)) { changeLog.AppendFormat(format, "ContentWorking"); pageLog.ContentWorking = pageLogModel.ContentWorking; } if (!ConvertUtilities.Compare(pageLog.Caption, pageLogModel.Caption)) { changeLog.AppendFormat(format, "Caption"); pageLog.Caption = pageLogModel.Caption; } if (!ConvertUtilities.Compare(pageLog.CaptionWorking, pageLogModel.CaptionWorking)) { changeLog.AppendFormat(format, "CaptionWorking"); pageLog.CaptionWorking = pageLogModel.CaptionWorking; } if (!ConvertUtilities.Compare(pageLog.Status, pageLogModel.Status)) { changeLog.AppendFormat(format, "Status"); pageLog.Status = pageLogModel.Status; } if (!ConvertUtilities.Compare(pageLog.Keywords, pageLogModel.Keywords)) { changeLog.AppendFormat(format, "Keywords"); pageLog.Keywords = pageLogModel.Keywords; } if (!ConvertUtilities.Compare(pageLog.FileTemplateId, pageLogModel.FileTemplateId)) { changeLog.AppendFormat(format, "FileTemplateId"); pageLog.FileTemplateId = pageLogModel.FileTemplateId; } if (!ConvertUtilities.Compare(pageLog.PageTemplateId, pageLogModel.PageTemplateId)) { changeLog.AppendFormat(format, "PageTemplateId"); pageLog.PageTemplateId = pageLogModel.PageTemplateId; } if (!ConvertUtilities.Compare(pageLog.ParentId, pageLogModel.ParentId)) { changeLog.AppendFormat(format, "ParentId"); pageLog.ParentId = pageLogModel.ParentId; } if (!ConvertUtilities.Compare(pageLog.IncludeInSiteNavigation, pageLogModel.IncludeInSiteNavigation)) { changeLog.AppendFormat(format, "IncludeInSiteNavigation"); pageLog.IncludeInSiteNavigation = pageLogModel.IncludeInSiteNavigation; } if (!ConvertUtilities.Compare(pageLog.StartPublishingDate, pageLogModel.StartPublishingDate)) { changeLog.AppendFormat(format, "StartPublishingDate"); pageLog.StartPublishingDate = pageLogModel.StartPublishingDate; } if (!ConvertUtilities.Compare(pageLog.EndPublishingDate, pageLogModel.EndPublishingDate)) { changeLog.AppendFormat(format, "EndPublishingDate"); pageLog.EndPublishingDate = pageLogModel.EndPublishingDate; } if (!string.IsNullOrEmpty(changeLog.ToString())) { changeLog.Insert(0, string.Format("** Update Page **\n")); } return(changeLog.ToString()); }
private Cell AppendCell(Row row, uint rowIndex, uint columnIndex, TableColumn <T> column, T value) { if (value == null) { return(null); } var displayValue = column.GetValue(value); if (displayValue == null) { return(null); } Cell cell = new Cell(); cell.CellReference = GetColumnIndex(columnIndex) + rowIndex; CellValues datatype; if (column.DataType == null) { datatype = GetDataType(displayValue.GetType()); } else { datatype = GetDataType(column.DataType); } switch (datatype) { case CellValues.Boolean: bool boolean; if (!ConvertUtilities.TryChangeType(displayValue, column.Culture, out boolean)) { return(null); } cell.DataType = CellValues.Boolean; cell.CellValue = new CellValue(BooleanValue.FromBoolean(boolean)); break; case CellValues.Number: string number; if (!ConvertUtilities.TryChangeType(displayValue, CultureInfo.InvariantCulture, out number)) { return(null); } cell.DataType = CellValues.Number; cell.CellValue = new CellValue(number); break; case CellValues.String: string formula; if (!ConvertUtilities.TryChangeType(displayValue, column.Culture, out formula)) { return(null); } cell.DataType = CellValues.InlineString; cell.CellFormula = new CellFormula(formula); break; case CellValues.InlineString: string text; if (!ConvertUtilities.TryChangeType(displayValue, column.Culture, out text)) { return(null); } cell.DataType = CellValues.InlineString; cell.AppendChild(new InlineString(new Text(text))); break; case CellValues.Date: DateTime datetime; if (!ConvertUtilities.TryChangeType(displayValue, column.Culture, out datetime)) { return(null); } //cell.DataType = CellValues.Date; cell.CellValue = new CellValue(datetime.ToOADate().ToString(CultureInfo.InvariantCulture)); cell.StyleIndex = 1; break; default: throw new ArgumentOutOfRangeException(); } if (column.Format != null) { cell.StyleIndex = GetStyleIndex(column); } row.AppendChild(cell); return(cell); }
public bool IsShowFreeTrialPeriodMore() { return(IsShowRecurringPeriod() && (ConvertUtilities.ToInt32(CurrentProduct.ProductRecurring.RecurringNumberOfTrialCycles) == 1) && (ConvertUtilities.ToDecimal(CurrentProduct.ProductRecurring.RecurringTrialAmount) == 0m)); }
public string FormatNumber(object obj) { decimal number = ConvertUtilities.ToDecimal(obj); return(String.Format("{0:n2}", number)); }
protected decimal GetPrice(object price) { return(ConvertUtilities.ToDecimal(price)); }
private string ConvertNumberToMonth(string month) { DateTime date = new DateTime(2000, ConvertUtilities.ToInt32(month), 1); return(date.ToString("MMMM")); }
protected string GetShortDate(object createDate) { return(ConvertUtilities.ToDateTime(createDate).ToShortDateString()); }
protected bool IsShowSeeMore(object shortDesc) { string shortDescription = ConvertUtilities.ToString(shortDesc); return(shortDescription.Length > 119); }
private void PopulateSiteMapConfig() { uxSiteMapTypeTR.Visible = ConvertUtilities.ToBoolean(uxSiteMapEnabledDrop.SelectedValue); uxSiteMapTypeDrop.SelectedValue = DataAccessContext.Configurations.GetValue("SiteMapDisplayType"); }
private Boolean CheckCondition(string templateID, string[] productIDList) { Boolean conditionPass = true; EBayAccess access = new EBayAccess(UrlPath.StorefrontUrl); EBayTemplate eBayTemplate = DataAccessContextDeluxe.EBayTemplateRepository.GetOne(templateID); EBayCategory category = access.GetCategoriesDetailsByID(eBayTemplate.PrimaryeBayCategoryID, eBayTemplate.EBayListSite); EBayCategoryFeature feature = access.GetCategoryFeatureDetail(category.PimaryCategoryID, category.CategoryLevel, eBayTemplate.EBayListSite); ShowMessageByCondition(feature, category); if (feature.IsReturnPolicyEnabled) { if (!eBayTemplate.IsAcceptReturn) { lcMessage.Text = "Return Policy is required for listing. Please check your listing template."; return(false); } } foreach (string productID in productIDList) { if (productID.Equals("")) { break; } Product product = GetProductByProductID(productID); double productPrice = 0.0; foreach (ProductPrice price in product.ProductPrices) { if (price.StoreID.Equals("0")) //use defalut price { productPrice = (double)price.Price; break; } } if (eBayTemplate.DomesticShippingType == "Calculate" || eBayTemplate.InternationalShippingType == "Calculate") { if (product.Weight <= 0) { lcMessage.Text = "Cannot list to eBay because some product does not have weight."; return(false); } } if (String.IsNullOrEmpty(product.ShortDescription)) { lcMessage.Text = "Cannot list to eBay because some product does not have short description."; return(false); } if (product.IsCustomPrice) { lcMessage.Text = "Cannot list to eBay because some product(s) enabled custom price."; return(false); } if (product.IsCallForPrice) { lcMessage.Text = "Cannot list to eBay because some product(s) enabled call for price."; return(false); } IList <ProductOptionGroup> optionGroupList = product.ProductOptionGroups; if (optionGroupList.Count > 0) { lcMessage.Text = "Cannot list to eBay because some product(s) has option."; return(false); } if (product.IsRecurring) { lcMessage.Text = "Cannot list to eBay because some product(s) enabled recurring option."; return(false); } double eBayTemplateReservePrice = 0.0; double eBayTemplateStartingPrice = 0.0; double eBayTemplateBuyItNowPrice = 0.0; if (eBayTemplate.SellingMethod.Equals("Online Auction")) { if (eBayTemplate.UseReservePrice) { switch (eBayTemplate.ReservePriceType) { case "ProductPrice": eBayTemplateReservePrice = productPrice; break; case "PricePlusAmount": eBayTemplateReservePrice = productPrice + ConvertUtilities.ToDouble(eBayTemplate.ReservePriceValue); break; case "PricePlusPercentage": eBayTemplateReservePrice = productPrice + (productPrice * (ConvertUtilities.ToDouble(eBayTemplate.ReservePriceValue) / 100)); break; case "CustomPrice": eBayTemplateReservePrice = ConvertUtilities.ToDouble(eBayTemplate.ReservePriceValue); break; default: eBayTemplateReservePrice = productPrice; break; } } if (eBayTemplate.UseBuyItNowPrice) { switch (eBayTemplate.BuyItNowPriceType) { case "ProductPrice": eBayTemplateBuyItNowPrice = productPrice; break; case "PricePlusAmount": eBayTemplateBuyItNowPrice = productPrice + ConvertUtilities.ToDouble(eBayTemplate.BuyItNowPriceValue); break; case "PricePlusPercentage": eBayTemplateBuyItNowPrice = productPrice + (productPrice * (ConvertUtilities.ToDouble(eBayTemplate.BuyItNowPriceValue) / 100)); break; case "CustomPrice": eBayTemplateBuyItNowPrice = ConvertUtilities.ToDouble(eBayTemplate.BuyItNowPriceValue); break; default: eBayTemplateBuyItNowPrice = productPrice; break; } } switch (eBayTemplate.StartingPriceType) { case "ProductPrice": eBayTemplateStartingPrice = productPrice; break; case "PricePlusAmount": eBayTemplateStartingPrice = productPrice + ConvertUtilities.ToDouble(eBayTemplate.StartingPriceValue); break; case "PricePlusPercentage": eBayTemplateStartingPrice = productPrice + (productPrice * (ConvertUtilities.ToDouble(eBayTemplate.StartingPriceValue) / 100)); break; case "CustomPrice": eBayTemplateStartingPrice = ConvertUtilities.ToDouble(eBayTemplate.StartingPriceValue); break; default: eBayTemplateStartingPrice = productPrice; break; } if (eBayTemplate.UseReservePrice) { if (eBayTemplateReservePrice < feature.MinimumReservePrice) { lcMessage.Text = "Reserve Price in template is less than eBay minimun reserve price. Please check your template."; return(false); } if (eBayTemplateReservePrice <= eBayTemplateStartingPrice) { lcMessage.Text = "The starting price must be less than the reserve price. Please check your template."; return(false); } } if (eBayTemplate.UseBuyItNowPrice) { double eBayTemplateStartingPricePlusTenPercent = eBayTemplateStartingPrice + (eBayTemplateStartingPrice * 0.1); if (eBayTemplateBuyItNowPrice <= eBayTemplateStartingPricePlusTenPercent) { lcMessage.Text = "Buy It Now price should be at least 10% more than your starting price. Please check your template."; return(false); } } } } access.VerifyAddItem(GetProductByProductID(productIDList[0]), eBayTemplate, category, false, DateTime.Now); if (access.HasError) { foreach (EBayErrorType error in access.ErrorTypeList) { lcMessage.Text += HttpUtility.HtmlEncode(error.ErrorLongMessage) + " (" + error.ErrorCode + ")<br/>"; } lcMessage.ForeColor = System.Drawing.Color.Red; return(false); } return(conditionPass); }
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { if (config == null) { throw new ArgumentNullException("config"); } if (string.IsNullOrEmpty(name)) { name = "SoftFluent.Samples.GEDMembershipProvider"; } if (string.IsNullOrEmpty(config["description"])) { config.Remove("description"); config.Add("description", SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("MembershipProviderDescription", "SoftFluent.Samples.GED")); } base.Initialize(name, config); _enablePasswordRetrieval = ConvertUtilities.ToBoolean(config["enablePasswordRetrieval"], false); _enablePasswordReset = ConvertUtilities.ToBoolean(config["enablePasswordReset"], true); _requiresUniqueEmail = true; // cannot be changed here _requiresQuestionAndAnswer = ConvertUtilities.ToBoolean(config["requiresQuestionAndAnswer"], false); _updateLastActivity = ConvertUtilities.ToBoolean(config["updateLastActivity"], true); if (_requiresQuestionAndAnswer) { throw new ProviderException(SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("UnsupportedRequiresQuestionAndAnswer", "Membership provider only supports requiresQuestionAndAnswer set to false.")); } _maxInvalidPasswordAttempts = ConvertUtilities.ToInt32(config["maxInvalidPasswordAttempts"], 5); _passwordAttemptWindow = ConvertUtilities.ToInt32(config["passwordAttemptWindow"], 10); _minRequiredPasswordLength = ConvertUtilities.ToInt32(config["minRequiredPasswordLength"], 4); _minRequiredNonAlphanumericCharacters = ConvertUtilities.ToInt32(config["minRequiredNonalphanumericCharacters"], 0); _passwordStrengthRegularExpression = ConvertUtilities.ToString(config["passwordStrengthRegularExpression"], "", true); if (_minRequiredNonAlphanumericCharacters > _minRequiredPasswordLength) { throw new ProviderException(SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("MinNonAlphanMoreThanMinRequiredPassword", "MinRequiredNonalphanumericCharacters can not be more than MinRequiredPasswordLength.")); } _applicationName = config["applicationName"]; if (string.IsNullOrEmpty(_applicationName)) { _applicationName = applicationName; } _passwordFormat = (MembershipPasswordFormat)ConvertUtilities.ToEnum(config["passwordFormat"], MembershipPasswordFormat.Hashed); if ((_passwordFormat == MembershipPasswordFormat.Hashed) && (_enablePasswordRetrieval)) { throw new ProviderException(SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("CannotRetrieveHash", "Membership provider can not retrieve hashed passwords.")); } config.Remove("enablePasswordRetrieval"); config.Remove("enablePasswordReset"); config.Remove("requiresQuestionAndAnswer"); config.Remove("applicationName"); config.Remove("requiresUniqueEmail"); config.Remove("maxInvalidPasswordAttempts"); config.Remove("passwordAttemptWindow"); config.Remove("passwordFormat"); config.Remove("name"); config.Remove("minRequiredPasswordLength"); config.Remove("minRequiredNonalphanumericCharacters"); config.Remove("passwordStrengthRegularExpression"); config.Remove("updateLastActivity"); }
private int TotalPoint() { return(ConvertUtilities.ToInt32( DataAccessContextDeluxe.CustomerRewardPointRepository.SumCustomerIDAndStoreID( CurrentID, uxStoreList.SelectedValue))); }
public bool AddItemToShoppingCart(bool isSubscriptionable, out string errMsg) { errMsg = String.Empty; if (!VerifyValidInput(out errMsg)) { DisplayErrorMessage(errMsg); return(false); } if (!IsMatchQuantity()) { return(false); } OptionItemValueCollection selectedOptions = uxProductOptionGroupDetails.GetSelectedOptions(); CartItemGiftDetails giftDetails = CreateGiftDetails(); Currency currency = DataAccessContext.CurrencyRepository.GetOne(CurrencyCode); decimal enterPrice = ConvertUtilities.ToDecimal(currency.FormatPriceWithOutSymbolInvert(ConvertUtilities.ToDecimal(uxEnterAmountText.Text))); if (enterPrice == CurrentProduct.GetProductPrice(StoreID).Price) { enterPrice = 0; } decimal customPrice = 0; if (CurrentProduct.IsCustomPrice) { customPrice = ConvertUtilities.ToDecimal(currency.FormatPriceWithOutSymbolInvert(ConvertUtilities.ToDecimal(uxEnterAmountText.Text))); } CartAddItemService addToCartService = new CartAddItemService( StoreContext.Culture, StoreContext.ShoppingCart); int currentStock; string errorOptionName; bool stockOK = addToCartService.AddToCartByAdmin( CurrentProduct, selectedOptions, ConvertUtilities.ToInt32(uxQuantityText.Text), giftDetails, customPrice, enterPrice, StoreID, out errorOptionName, out currentStock, isSubscriptionable); if (stockOK) { return(true); } else { errMsg = DisplayOutOfStockError(currentStock, errorOptionName); uxMessage.DisplayError(errMsg); return(false); } }
private void buttonOk_Click(object sender, EventArgs e) { Entity userEntity = CreateUserEntity(); Entity roleEntity = null; //Entity userRoleEntity = null; Entity loginsEntity = null; Entity claimsEntity = null; Entity roleClaimEntity = null; if (checkBoxRole.Checked) { roleEntity = CreateRoleEntity(); } //if (checkBoxUserRole.Checked) //{ // userRoleEntity = CreateUserRoleEntity(); // AddRelation(userEntity, PropertyType.Roles, userRoleEntity, PropertyType.User, RelationType.ManyToOne); // AddRelation(roleEntity, PropertyType.RoleUsers, userRoleEntity, PropertyType.Role, RelationType.ManyToOne); //} //else //{ AddRelation(userEntity, PropertyType.UserRoles, roleEntity, PropertyType.RoleUsers, RelationType.ManyToMany); //} if (checkBoxClaims.Checked) { claimsEntity = CreateUserClaimsEntity(); AddRelation(userEntity, PropertyType.UserClaims, claimsEntity, PropertyType.UserClaimUser, RelationType.ManyToOne); } if (checkBoxExternalLogins.Checked) { loginsEntity = CreateUserLoginsEntity(); AddRelation(userEntity, PropertyType.UserLogins, loginsEntity, PropertyType.UserLoginUser, RelationType.ManyToOne); } if (checkBoxRoleClaim.Checked) { roleClaimEntity = CreateRoleClaimEntity(); AddRelation(roleEntity, PropertyType.RoleClaims, roleClaimEntity, PropertyType.RoleClaimRole, RelationType.ManyToOne); } CreateUserMethods(userEntity, loginsEntity); SetCollectionMode(userEntity); SetCollectionMode(roleEntity); //SetCollectionMode(userRoleEntity); SetCollectionMode(loginsEntity); SetCollectionMode(claimsEntity); SetCollectionMode(roleClaimEntity); if (_aspNetIdentityProducer.MustCreateMessages) { ProjectMessages messages = new ProjectMessages(_project); if (messages.RoleNotFoundMessage == null) { var message = new Message { EditorName = "RoleNotFound", Class = MessageClass._default.ToString(), CultureName = ConvertUtilities.ToCultureInfo(_aspNetIdentityProducer.MessagesCulture, _project.Culture).Name, Value = IdentityRole.RoleNotFoundMessage, AddToRuntimeResourceFile = true }; message.SetAttributeValue("", "messageType", Constants.NamespaceUri, ProjectMessageType.RoleNotFound); _project.Messages.Add(message); } } this.Close(); }