public void callInfo() { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from a in db.Texts where a.TextID == 1067 select a).FirstOrDefault(); lblCall.Text = (IdentifyCulture.cultureName().Contains("fa")) ? n.TextDescription : ((IdentifyCulture.cultureName().Contains("en")) ? n.EN_TextDescription : ((IdentifyCulture.cultureName().Contains("ru")) ? n.Rus_TextDescription : ((IdentifyCulture.cultureName().Contains("zh")) ? n.China_TextDescription : n.TextDescription))); var n2 = (from a in db.Texts where a.TextID == 1071 select a).FirstOrDefault(); ltPageTitle.Text = (IdentifyCulture.cultureName().Contains("fa")) ? n2.TextTitle : ((IdentifyCulture.cultureName().Contains("en")) ? n2.EN_TextTitle : ((IdentifyCulture.cultureName().Contains("ru")) ? n2.Rus_TextTitle : ((IdentifyCulture.cultureName().Contains("zh")) ? n2.China_TextDescription : n2.TextTitle))); ltPageDesc.Text = (IdentifyCulture.cultureName().Contains("fa")) ? n2.TextDescription : ((IdentifyCulture.cultureName().Contains("en")) ? n2.EN_TextDescription : ((IdentifyCulture.cultureName().Contains("ru")) ? n2.Rus_TextDescription : ((IdentifyCulture.cultureName().Contains("zh")) ? n2.China_TextDescription : n.TextDescription))); } }
public void Insert_Log_LoginAttemp(Boolean IsSuccess) { using (MashadCarpetEntities db = new MashadCarpetEntities()) { Log_LoginAttemps lmEnter = new Log_LoginAttemps(); lmEnter.IP = Request.UserHostAddress; lmEnter.VisitDate = DateTime.Now; if (Request.UrlReferrer != null) { lmEnter.RefrallPage = Request.UrlReferrer.ToString(); } else { lmEnter.RefrallPage = "ورود مستقیم"; } System.Web.HttpBrowserCapabilities browser = Request.Browser; lmEnter.Browser = browser.Type; lmEnter.OS = OSIdentify.OSName(); lmEnter.Username = txtEmail.Text; lmEnter.Password = txtPass.Text; lmEnter.IsSuccess = IsSuccess; db.Log_LoginAttemps.Add(lmEnter); db.SaveChanges(); } }
public void InserForm() { using (MashadCarpetEntities db = new MashadCarpetEntities()) { Tickets p = new Tickets(); p.TicketID = Guid.NewGuid(); //p.fk_TicketGroupID = new Guid(ddlTicketGroup.SelectedValue); p.TicketSubject = txtSubject.Text; //p.TicketPriority = int.Parse(ddlPriority.SelectedValue); p.TicketMessage = txtMessage.Text; p.TicketDate = DateTime.Now; p.IsDelete = false; p.fk_UserID = new Guid(ddlUser.SelectedValue); if (Request.QueryString["StatusID"] != null) { int StatusID = int.Parse(Request.QueryString["StatusID"].ToString()); p.Status = Convert.ToByte(StatusID); } else { p.Status = 1; } db.Tickets.Add(p); db.SaveChanges(); } }
public void rptService1Bind() { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Texts.AsEnumerable() where u.GroupID == 8 && u.IsDelete == false select new { u.TextName, u.TextID, u.TextImage, TextTitle = (IdentifyCulture.cultureName().Contains("fa")) ? u.TextTitle : ((IdentifyCulture.cultureName().Contains("en")) ? u.EN_TextTitle : ((IdentifyCulture.cultureName().Contains("ru")) ? u.Rus_TextTitle : ((IdentifyCulture.cultureName().Contains("zh")) ? u.China_TextTitle : u.TextTitle))), TextDescription = (IdentifyCulture.cultureName().Contains("fa")) ? u.TextDescription : ((IdentifyCulture.cultureName().Contains("en")) ? u.EN_TextDescription : ((IdentifyCulture.cultureName().Contains("ru")) ? u.Rus_TextDescription : ((IdentifyCulture.cultureName().Contains("zh")) ? u.China_TextDescription : u.TextDescription))), }).ToList(); rptService1.DataSource = n; rptService1.DataBind(); } }
protected void cvName_ServerValidate(object source, ServerValidateEventArgs args) { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Colors where u.ColorName == txtName.Text && u.IsDelete == false select u).FirstOrDefault(); if (ViewState["btn"].ToString() == "Insert") { args.IsValid = n == null; } else if (ViewState["btn"].ToString() == "Update") { int ColorID = int.Parse(ViewState["ColorID"].ToString()); var m = (from u in db.Colors where u.ColorID == ColorID select u).FirstOrDefault(); if (m.ColorName == txtName.Text) { args.IsValid = true; } else { args.IsValid = n == null; } } } }
protected void btnSend_Click(object sender, EventArgs e) { Guid TicketID = new Guid(ViewState["TicketID"].ToString()); if (HttpContext.Current.User.Identity.IsAuthenticated) { Guid UserID = new Guid(HttpContext.Current.User.Identity.Name); using (MashadCarpetEntities db = new MashadCarpetEntities()) { TicketResponse t = new TicketResponse(); t.TicketResponseID = Guid.NewGuid(); t.fk_TicketID = TicketID; t.fk_UserID = UserID; t.ResponseText = txtAnswerText.Text; t.ResponseDate = DateTime.Now; t.IsDelete = false; db.TicketResponse.Add(t); db.SaveChanges(); } rptAnswersBind(TicketID); txtAnswerText.Text = string.Empty; } }
public void Update() { string new_filename = string.Empty; if (fuImg.PostedFile.ContentLength != 0) { string original_filename = Path.GetFileName(fuImg.PostedFile.FileName); new_filename = Guid.NewGuid().ToString() + Path.GetExtension(original_filename); string new_filepath = Server.MapPath("~/Uploads/Sliders/" + new_filename); fuImg.PostedFile.SaveAs(new_filepath); ViewState["NewImg"] = new_filename; } int SLiderID = int.Parse(ViewState["SliderID"].ToString()); using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Slider where u.SliderID == SLiderID select u).FirstOrDefault(); n.SliderTitle = txtTitle.Text; n.SliderImage = ViewState["NewImg"].ToString(); db.SaveChanges(); } }
protected void grdProductGroup_RowCommand(object sender, GridViewCommandEventArgs e) { Guid UserID = new Guid(e.CommandArgument.ToString()); ViewState["UserID"] = UserID; switch (e.CommandName) { case "DoEdit": { ViewState["btn"] = "Update"; FillViewEdit(UserID); break; } case "DoDelete": { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Users where u.UserID == UserID select u).FirstOrDefault(); lblDelete.Text = n.UserName + " " + n.UserFamily; mvSetting.SetActiveView(vwDelete); } break; } } }
//protected void rptProductGroup_ItemDataBound(object sender, RepeaterItemEventArgs e) //{ // if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) // { // HiddenField hfProductGroupID = (HiddenField)e.Item.FindControl("hfProductGroupID"); // Guid ProductGroupID = new Guid(hfProductGroupID.Value.ToString()); // Repeater rptProduct = (Repeater)e.Item.FindControl("rptProduct"); // using(MashadCarpetEntities db=new MashadCarpetEntities()) // { // var n = (from u in db.Products where u.IsDelete == false && u.fk_ProductGroupID == ProductGroupID select u).Take(5).ToList(); // rptProduct.DataSource = n; // rptProduct.DataBind(); // } // } //} protected void rptBasketItems_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { HiddenField hfOrderDetailID = (HiddenField)e.Item.FindControl("hfOrderDetailID"); Guid OrderDetailID = new Guid(hfOrderDetailID.Value); Label lblPrice = (Label)e.Item.FindControl("lblPrice"); using (MashadCarpetEntities db = new MashadCarpetEntities()) { var m = (from u in db.OrderDetails join i in db.ProductColorSizes on u.fk_ProductColorSizeID equals i.ProductColorSizeID where u.OrderDetailID == OrderDetailID select new { u.Count, i.ProductPrice }).FirstOrDefault(); //lblPrice.Text = string.Format("{0:N0}", (m.Count * (m.ProductPrice))) + " تومان"; lblPrice.Text = (IdentifyCulture.cultureName().Contains("fa")) ? string.Format("{0:N0}", (m.Count * (m.ProductPrice))) + " تومان" : ((IdentifyCulture.cultureName().Contains("en")) ? string.Format("{0:N0}", (m.Count * (m.ProductPrice))) + " Toman" : ((IdentifyCulture.cultureName().Contains("ru")) ? string.Format("{0:N0}", (m.Count * (m.ProductPrice))) + " RS" : ((IdentifyCulture.cultureName().Contains("zh")) ? string.Format("{0:N0}", (m.Count * (m.ProductPrice))) + " RS" : string.Format("{0:N0}", (m.Count * (m.ProductPrice))) + " تومان"))); } } }
protected void grdTable_DataBound(object sender, EventArgs e) { foreach (GridViewRow r in grdTable.Rows) { HiddenField hfRoleID = (HiddenField)r.FindControl("hfRoleID"); int RoleID = int.Parse(hfRoleID.Value); Label lblRole = (Label)r.FindControl("lblRole"); HiddenField hfUserID = (HiddenField)r.FindControl("hfUserID"); Label lblpass = (Label)r.FindControl("lblpass"); Guid UserID = new Guid(hfUserID.Value); using (MashadCarpetEntities db = new MashadCarpetEntities()) { var m = (from a in db.Users where a.UserID == UserID && a.IsDelete == false select a).FirstOrDefault(); if (RoleID == 1) { lblpass.Text = "******"; } else { lblpass.Text = m.Password; } var n = (from u in db.Roles where u.RoleID == RoleID select u).FirstOrDefault(); lblRole.Text = n.RoleTitle; } } }
protected void cvEmail_ServerValidate(object source, ServerValidateEventArgs args) { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Users where u.Email == txtEmail.Text && u.IsDelete != true select u).FirstOrDefault(); if (ViewState["btn"].ToString() == "Insert") { args.IsValid = n == null; } else if (ViewState["btn"].ToString() == "Update") { Guid UserID = new Guid(ViewState["UserID"].ToString()); var m = (from u in db.Users where u.UserID == UserID && u.IsDelete != true select u).FirstOrDefault(); if (m.Email == txtEmail.Text) { args.IsValid = true; } else { args.IsValid = n == null; } } } }
public void Update() { Guid UserID = new Guid(ViewState["UserID"].ToString()); using (MashadCarpetEntities db = new MashadCarpetEntities()) { var u = (from n in db.Users where n.UserID == UserID select n).FirstOrDefault(); if (u.fk_RoleID == 2) { u.Password = txtpass.Text; } u.UserName = txtFirstName.Text; u.Email = txtEmail.Text; u.Phone = txtPhone.Text; u.Address1 = txtAddress1.Text; u.fk_RoleID = Convert.ToInt32(ddlRoles.SelectedValue); u.Address2 = txtAddress2.Text; u.CityID = int.Parse(ddlCity.SelectedValue); u.ProvinceID = int.Parse(ddlProvince.SelectedValue); u.PostalCode = txtPostalCode.Text; u.Mobile = txtMobile.Text; u.UserFamily = txtFamily.Text; db.SaveChanges(); } }
public void Insert() { using (MashadCarpetEntities db = new MashadCarpetEntities()) { Users u = new Users(); u.UserID = Guid.NewGuid(); u.UserName = txtFirstName.Text; u.Email = txtEmail.Text; u.Phone = txtPhone.Text; u.RegisterDate = DateTime.Now; u.Password = txtpass.Text; u.fk_RoleID = Convert.ToInt32(ddlRoles.SelectedValue); u.RegisterIP = Request.UserHostAddress; u.Address1 = txtAddress1.Text; u.Address2 = txtAddress2.Text; u.CityID = int.Parse(ddlCity.SelectedValue); u.ProvinceID = int.Parse(ddlProvince.SelectedValue); u.PostalCode = txtPostalCode.Text; u.Mobile = txtMobile.Text; u.IsDelete = false; u.UserFamily = txtFamily.Text; db.Users.Add(u); db.SaveChanges(); } }
public void FillViewEdit(Guid UserID) { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Users where u.UserID == UserID select u).FirstOrDefault(); if (n.fk_RoleID == 1) { txtpass.Text = "*****"; txtpass.Enabled = false; } else { txtpass.Text = n.Password; } txtEmail.Text = n.Email; txtFirstName.Text = n.UserName; txtAddress1.Text = n.Address1; txtPhone.Text = n.Phone; FillDDLRoles(); ddlRoles.SelectedValue = n.fk_RoleID.ToString(); txtFamily.Text = n.UserFamily; txtAddress2.Text = n.Address2; ddlProvince.SelectedValue = n.ProvinceID.ToString(); ddlCity.SelectedValue = n.CityID.ToString(); txtPostalCode.Text = n.PostalCode; txtMobile.Text = n.Mobile; mvSetting.SetActiveView(vwEdit); } }
public void rptLatestBlogsBind() { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Blogs.AsEnumerable() join aa in db.BlogGroups on u.fk_BlogGroupID equals aa.BlogGroupID where u.IsDelete == false orderby u.SubmitDate descending select new { aa.BlogGroupName, u.BlogImage, u.SubmitDate, //u.BlogTitle, //BlogText = (u.BlogText.Length > 100) ? u.BlogText.Substring(0, 100) : u.BlogText, BlogTitle = (IdentifyCulture.cultureName().Contains("fa")) ? u.BlogTitle : ((IdentifyCulture.cultureName().Contains("en")) ? u.EN_BlogTitle : ((IdentifyCulture.cultureName().Contains("ru")) ? u.Rus_BlogTitle : ((IdentifyCulture.cultureName().Contains("zh")) ? u.China_BlogTitle : u.BlogTitle))), BlogText = (IdentifyCulture.cultureName().Contains("fa")) ? (u.BlogSummery) : ((IdentifyCulture.cultureName().Contains("en")) ? (u.EN_BlogSummery) : ((IdentifyCulture.cultureName().Contains("ru")) ? (u.Rus_BlogSummery) : ((IdentifyCulture.cultureName().Contains("zh")) ? (u.China_BlogSummery) : (u.BlogSummery)))), u.BlogName }).ToList().Take(3); rptLatestBlogs.DataSource = n; rptLatestBlogs.DataBind(); } }
public void PaymentBtnAddress() { if (HttpContext.Current.User.Identity.IsAuthenticated) { Guid UserID = new Guid(HttpContext.Current.User.Identity.Name); using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from a in db.Orders where a.fk_UserID == UserID && a.IsFinalized == false && a.IsDelete == false select a).FirstOrDefault(); if (n != null) { hlPayment.NavigateUrl = "~/bank.aspx?OID=" + n.OrderID.ToString() + "&&UID=" + UserID.ToString(); pnlIsActiveFactor.Visible = true; hlPayment2.NavigateUrl = "~/bank.aspx?OID=" + n.OrderID.ToString() + "&&UID=" + UserID.ToString(); pnlIsActiveFactor2.Visible = true; } else { pnlIsActiveFactor.Visible = false; pnlIsActiveFactor2.Visible = false; } } } else { pnlIsActiveFactor.Visible = false; pnlIsActiveFactor2.Visible = false; } }
protected void rptBlogGroup_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { HiddenField hfBlogGroupID = (HiddenField)e.Item.FindControl("hfBlogGroupID"); Guid BlogGroupID = new Guid(hfBlogGroupID.Value.ToString()); Repeater rptBlogs = (Repeater)e.Item.FindControl("rptBlogs"); using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Blogs.AsEnumerable() join aa in db.BlogGroups on u.fk_BlogGroupID equals aa.BlogGroupID where u.fk_BlogGroupID == BlogGroupID && u.IsDelete == false select new { BlogTitle = (IdentifyCulture.cultureName().Contains("fa")) ? u.BlogTitle : ((IdentifyCulture.cultureName().Contains("en")) ? u.EN_BlogTitle : ((IdentifyCulture.cultureName().Contains("ru")) ? u.Rus_BlogTitle : ((IdentifyCulture.cultureName().Contains("zh")) ? u.China_BlogTitle : u.BlogTitle))), u.BlogName, aa.BlogGroupName }).ToList(); rptBlogs.DataSource = n; rptBlogs.DataBind(); } } }
public void FillDDLsUpdate(Guid productId, int selectedColorId) { using (MashadCarpetEntities db = new MashadCarpetEntities()) { List <ProductColors> productColors = db.ProductColors.Where(current => current.fk_ProductID == productId).ToList(); ddlColors.Items.Clear(); ddlColors.Items.Add(new ListItem("رنگ ", "-1")); foreach (var i in productColors) { ddlColors.Items.Add(new ListItem(i.Colors.ColorTitle, i.Colors.ColorID.ToString())); } ProductColors selectedProductColor = productColors.Where(current => current.fk_ColorID == selectedColorId).FirstOrDefault(); List <ProductColorSizes> productColorSizes = db.ProductColorSizes .Where(current => current.fk_ProductColorID == selectedProductColor.ProductColorID).ToList(); ddlSize.Items.Clear(); ddlSize.Items.Add(new ListItem("سایز ", "-1")); foreach (var i in productColorSizes) { ddlSize.Items.Add(new ListItem(i.SIzes.SizeTitle, i.SIzes.SizeID.ToString())); } } }
public void Insert() { string new_filename = string.Empty; if (fuImg.PostedFile.ContentLength != 0) { string original_filename = Path.GetFileName(fuImg.PostedFile.FileName); new_filename = Guid.NewGuid().ToString() + Path.GetExtension(original_filename); string new_filepath = Server.MapPath("~/Uploads/Sliders/" + new_filename); fuImg.PostedFile.SaveAs(new_filepath); ViewState["NewImg"] = new_filename; } using (MashadCarpetEntities db = new MashadCarpetEntities()) { Slider s = new Slider(); s.SliderTitle = txtTitle.Text; s.SliderImage = new_filename; db.Slider.Add(s); db.SaveChanges(); } }
public void FillDDLs() { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var y = (from u in db.Colors where u.IsDelete == false select u).ToList(); ddlColors.Items.Clear(); ddlColors.Items.Add(new ListItem("رنگ ", "-1")); foreach (var i in y) { ddlColors.Items.Add(new ListItem(i.ColorTitle, i.ColorID.ToString())); } var t = (from u in db.SIzes where u.IsDelete == false select u).ToList(); ddlSize.Items.Clear(); ddlSize.Items.Add(new ListItem("سایز ", "-1")); foreach (var i in t) { ddlSize.Items.Add(new ListItem(i.SizeTitle, i.SizeID.ToString())); } } }
protected void ddlProvince_SelectedIndexChanged(object sender, EventArgs e) { int ProvinceID = int.Parse(ddlProvince.SelectedValue.ToString()); using (MashadCarpetEntities db = new MashadCarpetEntities()) { var pg = (from u in db.City where u.ProvinceID == ProvinceID select u).ToList(); ddlCity.Items.Clear(); //ddlCity.Items.Add(new ListItem("شهر ", "-1")); ddlCity.Items.Add(new ListItem((IdentifyCulture.cultureName().Contains("fa") ? "شهر" : ((IdentifyCulture.cultureName().Contains("en")) ? "City" : ((IdentifyCulture.cultureName().Contains("ru")) ? "город" : ((IdentifyCulture.cultureName().Contains("zh")) ? "城市" : "شهر")))), "-1")); foreach (var t in pg) { //ddlCity.Items.Add(new ListItem(t.CityName, t.CityID.ToString())); ddlCity.Items.Add(new ListItem((IdentifyCulture.cultureName().Contains("fa") ? t.CityName : ((IdentifyCulture.cultureName().Contains("en")) ? t.EN_CityName : ((IdentifyCulture.cultureName().Contains("ru")) ? t.Rus_CityName : ((IdentifyCulture.cultureName().Contains("zh")) ? t.China_CityName : t.CityName)))), t.CityID.ToString())); } } }
public void LoadForm() { if (HttpContext.Current.User.Identity.IsAuthenticated) { Guid UserID = new Guid(HttpContext.Current.User.Identity.Name); //Guid UserID = new Guid("ee4edaf0-aad0-4140-a9fe-8b9bcaab6bd3"); using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Users where u.UserID == UserID select u).FirstOrDefault(); txtAddress1.Text = n.Address1; txtAddress2.Text = n.Address2; ddlCity.SelectedValue = n.CityID.ToString(); txtEmail.Text = n.Email; txtFamily.Text = n.UserFamily; txtFirstName.Text = n.UserName; txtMobile.Text = n.Mobile; txtpass.Text = n.Password; txtPhone.Text = n.Phone; txtPostalCode.Text = n.PostalCode; ddlProvince.SelectedValue = n.ProvinceID.ToString(); ddlCityBind(); ddlCity.SelectedValue = n.CityID.ToString(); } } }
public void FindMashadText() { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Texts.AsEnumerable() where u.GroupID == 5 && u.IsDelete == false select new { u.TextName, u.TextImage, TextTitle = (IdentifyCulture.cultureName().Contains("fa")) ? u.TextTitle : ((IdentifyCulture.cultureName().Contains("en")) ? u.EN_TextTitle : ((IdentifyCulture.cultureName().Contains("ru")) ? u.Rus_TextTitle : ((IdentifyCulture.cultureName().Contains("zh")) ? u.China_TextTitle : u.TextTitle))), TextDescription = (IdentifyCulture.cultureName().Contains("fa")) ? u.TextDescription : ((IdentifyCulture.cultureName().Contains("en")) ? u.EN_TextDescription : ((IdentifyCulture.cultureName().Contains("ru")) ? u.Rus_TextDescription : ((IdentifyCulture.cultureName().Contains("zh")) ? u.China_TextDescription : u.TextDescription))), }).FirstOrDefault(); // // lblMashadDesc.Text = n.TextDescription; // lblMashadTitle.Text = n.TextTitle; } }
protected void btnSave_Click(object sender, EventArgs e) { Guid UserID = new Guid(HttpContext.Current.User.Identity.Name); //Guid UserID = new Guid("ee4edaf0-aad0-4140-a9fe-8b9bcaab6bd3"); using (MashadCarpetEntities db = new MashadCarpetEntities()) { var u = (from n in db.Users where n.UserID == UserID select n).FirstOrDefault(); u.UserName = txtFirstName.Text; u.Email = txtEmail.Text; u.Phone = txtPhone.Text; u.Password = txtpass.Text; u.Address1 = txtAddress1.Text; u.Address2 = txtAddress2.Text; u.CityID = int.Parse(ddlCity.SelectedValue); u.ProvinceID = int.Parse(ddlProvince.SelectedValue); u.PostalCode = txtPostalCode.Text; u.Mobile = txtMobile.Text; u.UserFamily = txtFamily.Text; db.SaveChanges(); } LoadForm(); }
protected void btnSend_Click(object sender, EventArgs e) { if (HttpContext.Current.User.Identity.IsAuthenticated) { Guid UserID = new Guid(HttpContext.Current.User.Identity.Name.ToString()); using (MashadCarpetEntities db = new MashadCarpetEntities()) { Tickets t = new Tickets(); t.TicketID = Guid.NewGuid(); t.fk_UserID = UserID; t.TicketSubject = txtTicketSubject.Text; t.TicketMessage = txtTicketMessage.Text; t.TicketDate = DateTime.Now; t.IsDelete = false; t.IsValid = false; t.Status = 1; db.Tickets.Add(t); db.SaveChanges(); txtTicketMessage.Text = string.Empty; txtTicketSubject.Text = string.Empty; } pnlSuccess.Visible = true; } }
public void FillViewEdit(Guid ProductID) { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Products where u.ProductID == ProductID select u).FirstOrDefault(); txtTitle.Text = n.ProductTitle; txtName.Text = n.ProductName; ddlProductGroup.SelectedValue = n.fk_ProductGroupID.ToString(); txtENTitle.Text = n.EN_ProductTitle; txtDesignNO.Text = n.DesignNo.ToString(); txtFrame.Text = n.Frame.ToString(); txtCollection.Text = n.Collection; txtPileType.Text = n.PileType; txtEN_Collection.Text = n.EN_Collection; txtEN_PileType.Text = n.EN_PileType; txtReeds.Text = n.Reeds.ToString(); txtShots.Text = n.Shots.ToString(); txtPoints.Text = n.Points.ToString(); txtKnots.Text = n.Knots.ToString(); cbIsEspecial.Checked = Convert.ToBoolean(n.IsEspecial); chkMostSell.Checked = Convert.ToBoolean(n.IsMostSell); txtRusTitle.Text = n.Rus_ProductTitle; txtRus_Collection.Text = n.Rus_Collection; txtRus_PileType.Text = n.Rus_PileType; txtChinaTitle.Text = n.China_ProductTitle; txtChina_PileType.Text = n.China_PileType; txtChina_Collection.Text = n.China_Collection; mvSetting.SetActiveView(vwEdit); } }
protected void btnLogin_Click(object sender, EventArgs e) { if (Page.IsValid) { if (Request.QueryString["RetUrl"] == null) { FormsAuthentication.SetAuthCookie(ViewState["UserID"].ToString(), false); Guid UserID = new Guid(ViewState["UserID"].ToString()); Insert_Log_LoginAttemp(true); using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from a in db.Users where a.UserID == UserID select a).FirstOrDefault(); Response.Redirect("~/Default.aspx"); } } else { FormsAuthentication.SetAuthCookie(ViewState["UserID"].ToString(), false); Insert_Log_LoginAttemp(true); //Response.Redirect("Default.aspx"); Response.Redirect(Request.QueryString["RetUrl"]); } } }
protected void grdTable_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Details") { Guid ProductID = new Guid(e.CommandArgument.ToString()); ViewState["ProductID"] = ProductID; ViewState["btn"] = "Update"; DropDownBind(); FillViewEdit(ProductID); } else if (e.CommandName == "Restore") { Guid ProductID = new Guid(e.CommandArgument.ToString()); ViewState["ProductID"] = ProductID; using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.Products where u.ProductID == ProductID select u).FirstOrDefault(); n.IsDelete = false; n.DeleteDate = null; db.SaveChanges(); LoadForm(); } } }
protected void btnRegister_Click(object sender, EventArgs e) { using (MashadCarpetEntities db = new MashadCarpetEntities()) { if (HttpContext.Current.User.Identity.IsAuthenticated) { Guid UserID = new Guid(HttpContext.Current.User.Identity.Name); var u = (from i in db.Users where i.UserID == UserID select i).FirstOrDefault(); u.UserName = txtUserName.Text; u.UserFamily = txtFamily.Text; u.Address1 = txtAddress1.Text; u.Address2 = txtAddress2.Text; u.CityID = int.Parse(ddlCity.SelectedValue.ToString()); u.ProvinceID = int.Parse(ddlProvince.SelectedValue.ToString()); u.PostalCode = txtPostalCode.Text; u.Phone = txtPhone.Text; u.Mobile = txtMobile.Text; u.Email = txtEmail.Text; //u.Password = txtPass.Text; db.SaveChanges(); } } }
public void FillViewEdit(Guid ProductGroupID) { using (MashadCarpetEntities db = new MashadCarpetEntities()) { var n = (from u in db.ProductGroup where u.ProductGroupID == ProductGroupID select u).FirstOrDefault(); txtTitle.Text = n.ProductGroupTitle; txtName.Text = n.ProductGroupName; ViewState["GImage"] = n.ProductGroupImage; reDesc.Content = n.ProductGroupDesc; txtEN_Title.Text = n.EN_ProductGroupTitle; reEN_Desc.Content = n.EN_ProductGroupDesc; txtPrio.Text = n.Priority.ToString(); // txtcolor2.Text = n.HomeTitleColor2; // txtTitle2.Text = n.ProductGroupTitle2; // txtEN_Title2.Text = n.EN_ProductGroupTitle2; mvSetting.SetActiveView(vwEdit); imgEditImages.ImageUrl = "~/Uploads/ProductGroup/" + n.ProductGroupImage; imgEditImages_Slider.ImageUrl = "~/Uploads/ProductGroup/" + n.imgSliderImage; ViewState["GImage_Slider"] = n.imgSliderImage; // txtChina_Title2.Text = n.China_ProductGroupTitle2; txtChina_Title.Text = n.China_ProductGroupTitle; reChina_Desc.Content = n.China_ProductGroupDesc; txtRus_Title.Text = n.Rus_ProductGroupTitle; // txtRus_Title2.Text = n.Rus_ProductGroupTitle2; reRus_Desc.Content = n.Rus_ProductGroupDesc; chkAlienPro.Checked = Convert.ToBoolean(n.IsAlienCulture); } }