public IEnumerable <CategoryModel> GetCategory(string catCode) { ICategoryBL catBL = new CategoryBL(); List <CategoryModel> catList = catBL.GetCategory(catCode); return(catList); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { category = new List <CategoryDTO>(); categorybl = new CategoryBL(); category = categorybl.GetCategory(); foreach (CategoryDTO cat in categorybl.GetCategory()) { RadioButtonListCat.Items.Add(new ListItem(cat.CategoryName, cat.CategoryId.ToString())); } } }
private void loadCategory(int categoryID) { CategoryBL categoryBL = new CategoryBL(); Category category = categoryBL.GetCategory(categoryID); txtName.Text = category.Name; txtUrl.Text = category.Url; txtImageUrl.Text = category.ImageUrl; cmbParent.SelectedValue = cmbParent.Items.FindByValue(category.ParentCategoryID.ToString()).Value; txtSortOrder.Text = category.SortOrder.ToString(); lblCategoryID.Value = category.CategoryID.ToString(); txtPricePercent.Text = category.PricePercent.ToString(); txtWebPricePercent.Text = category.WebPricePercent.ToString(); chkShowOnFirstPage.Checked = category.ShowOnFirstPage; txtNumber.Text = category.NumberOfProducts.ToString(); txtSortOrderFirstPage.Text = category.firstPageSortOrder.ToString(); if (category.firstPageOrderBy != string.Empty && category.firstPageOrderBy != null) { cmbCriterion.SelectedValue = cmbCriterion.Items.FindByText(category.firstPageOrderBy).Value; } setFirstPageControls(category.ShowOnFirstPage); Page.Title = category.Name + " | Admin panel"; ViewState.Add("pageTitle", Page.Title); txtDescription.Text = category.Description; chkActive.Checked = category.Active; cmbCategoryBanner.SelectedValue = category.CategoryBannerID != null?category.CategoryBannerID.ToString() : "-1"; if (lblCategoryID.Value != string.Empty) { AttributeBL attributeBL = new AttributeBL(); dgvAttributes.DataSource = attributeBL.GetAttributesForCategory(categoryID); dgvAttributes.DataBind(); } }
private void loadCategory(int categoryID) { CategoryBL categoryBL = new CategoryBL(); Category category = categoryBL.GetCategory(categoryID); txtName.Text = category.Name; txtUrl.Text = category.Url; txtImageUrl.Text = category.ImageUrl; //cmbParent.SelectedValue = cmbParent.Items.FindByValue(category.ParentCategoryID.ToString()).Value; cmbParent.SelectedValue = category.ParentCategoryID.ToString(); txtSortOrder.Text = category.SortOrder.ToString(); lblCategoryID.Value = category.CategoryID.ToString(); txtPricePercent.Text = category.PricePercent.ToString(); txtWebPricePercent.Text = category.WebPricePercent.ToString(); chkShowOnFirstPage.Checked = category.ShowOnFirstPage; txtNumber.Text = category.NumberOfProducts.ToString(); txtSortOrderFirstPage.Text = category.firstPageSortOrder.ToString(); if (category.firstPageOrderBy != string.Empty && category.firstPageOrderBy != null) { cmbCriterion.SelectedValue = cmbCriterion.Items.FindByText(category.firstPageOrderBy).Value; } setFirstPageControls(category.ShowOnFirstPage); Page.Title = category.Name + " | Admin panel"; ViewState.Add("pageTitle", Page.Title); txtDescription.Text = category.Description; chkActive.Checked = category.Active; if (category.Slider != null) { cmbSlider.SelectedValue = category.Slider.SliderID.ToString(); } cmbCategoryBanner.SelectedValue = category.CategoryBannerID != 0 ? category.CategoryBannerID.ToString() : "-1"; chkUpdateProductsFromExternalApplication.Checked = category.UpdateProductsFromExternalApplication; chkExportProducts.Checked = category.ExportProducts; imgIcon.ImageUrl = category.ImageUrl != string.Empty ? ResolveUrl("~/images/" + category.ImageUrl) : ResolveUrl("~/images/no-image.jpg"); lblCategoryName.Text = category.Name; ViewState.Add("categoryName", category.Name); txtExternalID.Text = category.ExternalID.ToString(); txtExternalParentID.Text = category.ExternalParentID.ToString(); if (lblCategoryID.Value != string.Empty) { AttributeBL attributeBL = new AttributeBL(); dgvAttributes.DataSource = attributeBL.GetAttributesForCategory(categoryID); dgvAttributes.DataBind(); } chkShowInFooter.Checked = category.ShowInFooter; rdbImageTypeStandard.Checked = category.ImageUrlSource == 0; rdbImageTypeSprite.Checked = category.ImageUrlSource == 1; txtPositionX.Text = category.ImageUrlPositionX.ToString(); txtPositionY.Text = category.ImageUrlPositionY.ToString(); txtIcon.Text = category.Icon; chkShowProductsFromSubCategories.Checked = category.ShowProductsFromSubCategories; txtPriceFixedAmount.Text = string.Format("{0:N2}", category.PriceFixedAmount); loadCategoryBrandPrice(); }
public JsonResult GetCategory(long id) { var model = _categoryBL.GetCategory(id); ComboboxParent item = new ComboboxParent(); item.id = 0; item.name = "--Select child-- "; model.Add(item); return(Json(model.OrderBy(x => x.id), JsonRequestBehavior.AllowGet)); }
void PoupulateCategoryGrid() { CategoryBL categoryBL = new CategoryBL(); List <Category> lstCategory = categoryBL.GetCategory(); BindingSource categoryListBS = new BindingSource(); if (lstCategory != null && lstCategory.Count > 0) { categoryListBS.DataSource = lstCategory; } else { categoryListBS.DataSource = new List <Vendor>(); } dgvCategory.DataSource = categoryListBS; }
public static void Order(Customer c) { string choice1 = ""; OrderBL orderbl = new OrderBL(); Orders o = new Orders(); List <Items> lito = new List <Items>(); CategoryBL cbl = new CategoryBL(); List <Category> lc = new List <Category>(); lc = cbl.GetCategory(); Console.WriteLine("___________________________________________"); Console.WriteLine("|----------- Danh Mục Sản Phẩm -----------|"); Console.WriteLine("|-----------------------------------------|"); foreach (var item in lc) { Console.WriteLine("|" + item.CategoryID + " | " + item.CategoryName); } int choice; do { Console.Write("-chọn: "); choice = Convert.ToInt32(Console.ReadLine()); } while ((choice < 1) || (choice > lc.Count)); Item_BL ibl = new Item_BL(); List <Items> lit = new List <Items>(); lit = ibl.getItemByCategoryId(choice); while (true) { Console.Clear(); Console.WriteLine("___________________________________________________________________________________________________________"); Console.WriteLine("|========================================== Sản Phẩm ======================================================|"); Console.WriteLine("|__________________________________________________________________________________________________________|"); Console.WriteLine("|ID | Tên Sản Phẩm | Giá Sản Phẩm | Số Lượng |"); foreach (var item in lit) { Console.WriteLine("|{0,-3} | {1,-51} | {2,21} VND| {3,-14} ", item.ItemId, item.ItemName, item.ItemPrice, item.ItemAmount); Console.WriteLine("|----------------------------------------------------------------------------------------------------------|"); } Console.Write("1.Chọn ID sản phẩm bạn muốn mua :"); int product; Items io = null; while (true) { product = Validate.InputInt(Console.ReadLine()); int count = 0; foreach (var iteml in lit) { if (product == iteml.ItemId) { count++; } } if (count == 0) { Console.Write("Không có sản phẩm này trong danh mục bạn chọn , mời nhập lại: "); continue; } else { break; } } io = ibl.getItemById(product); int quantity; Console.Write(" Nhập số lượng: "); while (true) { quantity = Validate.InputInt(Console.ReadLine()); if (quantity <= io.ItemAmount) { break; } Console.Write("Số lượng không đúng, mời nhập lại: "); } io.ItemAmount = quantity; int dem = 0; int index = 0; foreach (var item in lito) { if (item.ItemId == product) { dem++; break; } index++; } if (io.ItemAmount != 0 && dem == 0) { lito.Add(io); } else if (dem > 0) { lito[index].ItemAmount += quantity; } while (true) { Console.WriteLine("Bạn có muốn tiếp tục thêm sản phẩm không? (C/K) "); choice1 = Console.ReadLine().ToUpper(); switch (choice1) { case "C": Console.Clear(); break; case "K": Console.Clear(); break; default: continue; } break; } if (choice1 == "C") { Console.Clear(); continue; } else if (choice1 == "K") { Console.Clear(); break; } } // listitem = lito; Console.WriteLine("____________________________________________________________________________________________________"); Console.WriteLine("|-----------------------------------------Đơn Hàng--------------------------------------------------|"); Console.WriteLine("| Tên Sản Phẩm | Số Lượng | Giá Sản Phẩm | Thành Tiền |"); Console.WriteLine("----------------------------------------------------------------------------------------------------"); decimal totalprice = 0; // Console.WriteLine(o.listItems.Count); foreach (var item in lito) { decimal a = 0; a = item.ItemPrice * item.ItemAmount; totalprice += a; Console.WriteLine("|{0,-48}|{1,-14}|{2,15} VND|{3,11} VND|", item.ItemName, item.ItemAmount, pricevalid(item.ItemPrice), a); } Console.WriteLine("_____________________________________________________________________________________________________"); Console.WriteLine("Tổng tiền: {0} VND", pricevalid(totalprice)); while (true) { Console.Write("Bạn có muốn thanh toán đơn hàng? (C/K)?"); choice1 = Console.ReadLine().ToUpper(); switch (choice1) { case "C": break; case "K": Console.Clear(); return; default: continue; } break; } Console.Write("Nhập số tiền khách trả(đồng): "); decimal cusmoney; while (true) { try { cusmoney = Convert.ToDecimal(Console.ReadLine()); if (cusmoney < 0) { Console.Write("Số tiền trả không thể nhỏ hơn 0, mời bạn nhập lại(đồng): "); continue; } else if (cusmoney > 999999999) { Console.Write("Số tiền quá lớn, mời nhập lại(đồng): "); continue; } else if (cusmoney < totalprice) { Console.Write("Số tiền trả không đủ, mời nhập lại(đồng): "); continue; } } catch (System.Exception) { Console.Write("Dữ liệu nhập vào không đúng hoặc số tiền quá lớn, mời bạn nhập lại(đồng): "); continue; } break; } if ((cusmoney - totalprice) > 0) { Console.WriteLine("Tiền trả lại: {0} VND", pricevalid(cusmoney - totalprice)); } Customer_Bl cbl1 = new Customer_Bl(); o.listItems = lito; // Console.WriteLine(o.listItems.ToString()); o.customer = c; o.Status = 1; Console.WriteLine(" Tạo Order " + (orderbl.AddOrder(o) ? "Hoàn tất!" : "Không hoàn tất!") + " Ấn phím bất kì để thoát!"); // listitem = o.listItems; Console.ReadKey(); Console.Clear(); // List<Items> newlit = ibl.GetItemsByOrderId(); }
protected void Page_Load(object sender, EventArgs e) { TxtOwnRangeRequiredFieldValidator.Enabled = false; TxtOwnRangeRequiredFieldValidator.Visible = false; TxtDescription.config.toolbar = new object[] { new object[] { "Clear", "Preview" }, new object[] { "Cut", "Copy", "Paste", "PasteText", "PasteFromWord" }, new object[] { "Undo", "Redo", "-", "Find", "Replace", "-", "SelectAll", "RemoveFormat" }, new object[] { "Form", "Checkbox", "Radio", "TextField", "Textarea", "Select", "Button", "ImageButton", "HiddenField" }, "/", new object[] { "Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript" }, new object[] { "NumberedList", "BulletedList", "-", "Outdent", "Indent", "Blockquote" }, new object[] { "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock" }, new object[] { "BidiLtr", "BidiRtl" }, new object[] { "Link", "Unlink", "Anchor" }, new object[] { "Image", "Flash", "Table", "HorizontalRule", "Smiley", "SpecialChar", "PageBreak", "Iframe" }, "/", new object[] { "Styles", "Format", "Font", "FontSize" }, new object[] { "TextColor", "BGColor" }, new object[] { "Maximize", "ShowBlocks" } }; //System.Diagnostics.Debugger.Break(); if (!IsPostBack) { category = new CategoryBL(); DateTime MaxDate = new DateTime(); MaxDate = DateTime.Today.AddYears(1); ValidateData(); DrpdlstCategory.DataSource = category.GetCategory(); DrpdlstCategory.DataBind(); RangeValidator1.MinimumValue = DateTime.Today.ToShortDateString(); RangeValidator1.MaximumValue = DateTime.Today.AddYears(1).ToShortDateString(); RangeValidator1.ErrorMessage = "Date should be between" + DateTime.Today.ToShortDateString() + " and " + DateTime.Today.AddYears(1).ToShortDateString(); //Edit Flow if (Request.QueryString["ProjectId"] != null && Request.QueryString["ProjectId"] != "") { project = new ProjectDTO(); projectbl = new ProjectBL(); project = projectbl.SelectProjectById(Convert.ToInt64(Request.QueryString["ProjectId"])); TxtProjectName.Text = project.ProjectTitle; DdlBudget.SelectedValue = project.Budget; TxtDescription.Text = project.Description; TxtBidOpenTill.Text = Convert.ToDateTime(project.BidOpenTill).ToString("dd/MM/yyyy"); DrpdlstCategory.Visible = false; DrpdlstSubcategory.Visible = false; // CmpvalCategory.Visible = false; //Cmpvalsubcategory.Visible = false; DrpdlstCategory.Enabled = false; DrpdlstSubcategory.Enabled = false; // CmpvalCategory.Enabled = false; //Cmpvalsubcategory.Enabled = false; LblCategory.Text = project.ProjectCategory; Lblsubcategory.Text = project.ProjectsubCategory; LblCategory.Visible = true; Lblsubcategory.Visible = true; string[] skills = Regex.Split(project.ProjectSkills.ToString(), ", "); foreach (string skill in skills) { ListItem newskill = new ListItem(skill, skill); ListBoxSkills.Items.Add(newskill); ListBoxSkills.DataBind(); } if (project.ProjectLocation.ToString().ToLower() != "No Preference".ToLower()) { RadioBtnPreferredlocation.Checked = true; Page.RegisterStartupScript("ShowCountryKey", "<script>ShowCountry(true)</script>"); drplstCountry.SelectedValue = project.ProjectLocation.ToString(); } else { RadioBtnPrefrence.Checked = true; } if (project.Budget.Substring(0, 1) == "$") { DdlBudget.SelectedValue = "Enter My Own Ranges"; LblMyownRange.Visible = true; TxtOwnRange.Visible = true; TxtOwnRange.Enabled = true; TxtOwnRange.Text = project.Budget.Replace("$", ""); } else { DdlBudget.SelectedValue = project.Budget; } if (project.PlannedStart == "Immediately") { RdBtnStartImmediately.Checked = true; } else { RdioBtnStartDate.Checked = true; Page.RegisterStartupScript("StartDateTextBoxKey", "<script>ShowStartDateTextBox(true)</script>"); TxtStartDate.Text = Convert.ToDateTime(project.ProjectCreatedOn).ToString("dd/MM/yyyy"); } RadioBtnPrefrence.Attributes.Add("onClick", " (false)"); RadioBtnPreferredlocation.Attributes.Add("onClick", "ShowCountry(true)"); RdBtnStartImmediately.Attributes.Add("onClick", "ShowStartDateTextBox(false)"); RdioBtnStartDate.Attributes.Add("onClick", "ShowStartDateTextBox(true)"); } else { RadioBtnPrefrence.Attributes.Add("onClick", "ShowCountry(false)"); RadioBtnPreferredlocation.Attributes.Add("onClick", "ShowCountry(true)"); RdBtnStartImmediately.Attributes.Add("onClick", "ShowStartDateTextBox(false)"); RdioBtnStartDate.Attributes.Add("onClick", "ShowStartDateTextBox(true)"); DrpdlstSubcategory.SelectedIndex = 0; } } }