protected void Page_Load(object sender, EventArgs e) { //Master.PageTitle = GlobalStrings.GetText(@"DefaultPageTitle"); //ltDescription.Text = GlobalStrings.GetText(@"DefaultPageBody"); if (!IsPostBack) { lblBidIdLabel.Text = SupplierProfileStrings.GetText("BidIdLabel", new System.Globalization.CultureInfo("he-IL")); lblOrderDateLabel.Text = SupplierProfileStrings.GetText("OrderDateLabel", new System.Globalization.CultureInfo("he-IL")); lblDealsIncludeLabel.Text = SupplierProfileStrings.GetText("DealsIncludeLabel", new System.Globalization.CultureInfo("he-IL")); lblPriceLabel.Text = SupplierProfileStrings.GetText("PriceLabel", new System.Globalization.CultureInfo("he-IL")); lblOrderIdlabel.Text = SupplierProfileStrings.GetText("OrderIdlabel", new System.Globalization.CultureInfo("he-IL")); LblUserLabel.Text = SupplierProfileStrings.GetText("AppUserLabel", new System.Globalization.CultureInfo("he-IL")); LblUserPhoneLabel.Text = SupplierProfileStrings.GetText("AppUserPhoneLabel", new System.Globalization.CultureInfo("he-IL")); Int64 OrderId = Request.QueryString["OrderId"] != null?Convert.ToInt64(Request.QueryString["OrderId"]) : 0; OrderUI order = OrderController.GetOrderById(OrderId); if (order != null) { //order.user. lblOrderDate.Text = order.OrderDate.ToShortDateString(); lblOrderId.Text = order.OrderId.ToString(); lblPrice.Text = order.Price.ToString(); lblBidId.Text = order.BidId.ToString(); LblUser.Text = order.user.Email; LblUserPhone.Text = order.user.Phone; lvDealsInclude.DataSource = order.LstProduct; lvDealsInclude.DataBind(); } } }
protected void revEml_ServerValidate(object source, ServerValidateEventArgs args) { if (!txtEmail.Text.IsValidEmail()) { args.IsValid = false; Master.MessageCenter.DisplayErrorMessage(SupplierProfileStrings.GetText(@"EmailWrong")); } }
protected void dgOrders_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Footer) { e.Item.Cells[2].Text = ProductsStrings.GetText("OrderCount") + " $Count"; e.Item.Cells[3].Text = SupplierProfileStrings.GetText("Shekel") + " $Sum " + ProductsStrings.GetText("OrderSum"); } }
protected void btnExport_Click(object sender, EventArgs e) { System.Data.DataTable dt = new System.Data.DataTable(); dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"OrderId"), typeof(string))); dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"OrderDate"), typeof(string))); dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"BidId"), typeof(string))); dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"TotalPrice"), typeof(string))); dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"ApprovedDeal"), typeof(string))); dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"DealDetails"), typeof(string))); int year = Convert.ToInt32(ddlyear.SelectedValue); int month = Convert.ToInt32(ddlMonth.SelectedValue); int from = Convert.ToInt32(ddlDayFrom.SelectedValue); int to = Convert.ToInt32(ddlDayTo.SelectedValue); DateTime?start = null; DateTime?end = null; if (year != 0 && month != 0 && from != 0) { start = new DateTime(year, month, from); end = (to != 0 ? new DateTime(year, month, to) : end = new DateTime(year, month, DateTime.DaysInMonth(year, month))); } else if (year != 0 && month != 0) { start = new DateTime(year, month, 1); end = new DateTime(year, month, DateTime.DaysInMonth(year, month)); } else if (year != 0) { start = new DateTime(year, 1, 1); end = new DateTime(year, 12, 31); } List <OrderUI> orders = OrderController.GetOrderSupplierHistoryExcel(SuppliersSessionHelper.SupplierId(), start, end); foreach (OrderUI order in orders) { int i = 0; System.Data.DataRow row = dt.NewRow(); row[i++] = order.OrderId; row[i++] = order.OrderDate; row[i++] = order.BidId; row[i++] = order.Price; row[i++] = GlobalStrings.GetYesNo(order.IsPayed); row[i++] = ListTostring(order.LstProduct); dt.Rows.Add(row); } SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, true, true); Response.Clear(); Response.AddHeader(@"content-disposition", @"attachment;filename=Deals_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension); Response.Charset = @"UTF-8"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = ex.FileContentType; Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble()); Response.Write(ex.ToString()); Response.End(); }
protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } Int64 SupplierId = SuppliersSessionHelper.SupplierId(); AppSupplier supplier = AppSupplier.FetchByID(SupplierId); if (supplier.ApprovedTermsDate != null || !supplier.IsService) { Save(supplier); } else { Master.MessageCenter.DisplayErrorMessage(SupplierProfileStrings.GetText(@"ErrorApproveTerms")); } }
protected void btnTerms_Click(object sender, EventArgs e) { termsLoader.Visible = true; if (!Page.IsValid) { return; } if (ApproveTermsCb.Checked) { Int64 SupplierId = SuppliersSessionHelper.SupplierId(); AppSupplier supplier = AppSupplier.FetchByID(SupplierId); Save(supplier); } else { Response.Redirect("EditMyProfile.aspx"); Master.MessageCenter.DisplayErrorMessage(SupplierProfileStrings.GetText(@"ErrorApproveTerms")); } termsLoader.Visible = false; }
private void Save(AppSupplier supplier) { supplier.BusinessName = txtbusiness.Text; supplier.ContactName = txtContactName.Text; supplier.Email = txtEmail.Text; supplier.ContactPhone = txtContactPhone.Text; supplier.HouseNum = txtNumber.Text; supplier.Street = txtStreet.Text; supplier.CityId = Convert.ToInt64(ddlCity.SelectedValue); supplier.Phone = txtPhone.Text; supplier.Description = txtDescription.Text; supplier.Discount = txtDiscount.Text; if (txtPassword.Text.Trim() != "" && txtConfirmPassword.Text.Trim() != "") { string pwd, salt; AppMembership.EncodePassword(txtPassword.Text.Trim(), out pwd, out salt); supplier.Password = pwd; supplier.PasswordSalt = salt; } if (supplier.IsService) { supplier.ApprovedTermsDate = DateTime.Now; if (fuImage.HasFile) { string fn = MediaUtility.SaveFile(fuImage.PostedFile, "SupplupCityier/225x225", 0, true); supplier.ProfileImage = fn; imgImage.ImageUrl = Snoopi.core.MediaUtility.GetImagePath("Supplier", supplier.ProfileImage, 0, 225, 225); ImageFileHandler(fuImage, imgImage, btnDeleteImage, imgImage.ImageUrl); } else if (supplier.ProfileImage != "" && fuImage.Visible) { MediaUtility.DeleteImageFilePath("Supplier", supplier.ProfileImage, 225, 225, 0); supplier.ProfileImage = ""; } } supplier.Save(); Response.Redirect("MyProfile.aspx"); Master.MessageCenter.DisplaySuccessMessage(SupplierProfileStrings.GetText(@"Success")); }
protected void ddlMonth_SelectedIndexChanged(object sender, EventArgs e) { List <int> LstDays = new List <int>(); if (ddlyear.SelectedValue == "0" || ddlMonth.SelectedValue == "0") { Master.MessageCenter.DisplayErrorMessage(SupplierProfileStrings.GetText("ChooseYearOrMonth")); return; } DateTime Date = new DateTime(Convert.ToInt32(ddlyear.SelectedValue), Convert.ToInt32(ddlMonth.SelectedValue), 1); for (int i = 1; i <= DateTime.DaysInMonth(Convert.ToInt32(ddlyear.SelectedValue), Convert.ToInt32(ddlMonth.SelectedValue)); i++) { LstDays.Add(i); } ddlDayFrom.DataSource = LstDays; ddlDayFrom.DataBind(); ddlDayFrom.Items.Insert(0, new ListItem(ProductsStrings.GetText("Choose"), "0")); ddlDayFrom.Enabled = true; ddlDayTo.DataSource = LstDays; ddlDayTo.DataBind(); ddlDayTo.Items.Insert(0, new ListItem(ProductsStrings.GetText("Choose"), "0")); ddlDayTo.Enabled = true; }