public void LoadForm() { int datasourceCounter = 0; using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.ContactUsForm join a in db.EmailRecieverRoles on u.fk_RecieverID equals a.EmailRecieverRoleID where u.IsDelete == false orderby u.CommentDate select new { u.fk_RecieverID, u.CommentDate, u.contactid, u.Email, a.Title, u.Mobile, u.Name, }).ToList(); grdTable.DataSource = n; grdTable.DataBind(); datasourceCounter = n.Count(); } CheckEmptyData(datasourceCounter); mvSetting.SetActiveView(vwList); }
protected void btnSearch_OnClick(object sender, EventArgs e) { using (VaranegarEntities db = new VaranegarEntities()) { if (txtSearch.Text != null) { int datasourceCounter = 0; var n = (from u in db.Customers join a in db.CustomerGroups on u.fk_CustomerGroupID equals a.CustomerGroupID where u.CustomerTitle.Contains(txtSearch.Text) && u.IsDelete == false orderby u.Priority select new { u.CustomerTitle, u.CustomerName, u.CustomersID, a.CustomerGroupTitle, u.ImgLogo, u.Priority, u.IsInHome }).ToList(); grdTable.DataSource = n; grdTable.DataBind(); datasourceCounter = n.Count(); CheckEmptyData(datasourceCounter); } } }
protected void cvName_ServerValidate(object source, ServerValidateEventArgs args) { using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.Services where u.ServiceName == txtName.Text && u.IsDelete == false select u).FirstOrDefault(); if (ViewState["btn"].ToString() == "Insert") { args.IsValid = n == null; } else if (ViewState["btn"].ToString() == "Update") { Guid ServiceStepID = new Guid(ViewState["ServiceStepID"].ToString()); var m = (from u in db.ServiceSteps where u.ServiceStepID == ServiceStepID select u).FirstOrDefault(); if (m.ServiceStepName == txtName.Text) { args.IsValid = true; } else { args.IsValid = n == null; } } } }
protected void cvEmail_ServerValidate(object source, ServerValidateEventArgs args) { using (VaranegarEntities db = new VaranegarEntities()) { 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") { int UserID = Convert.ToInt32(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; } } } }
protected void grdProductGroup_RowCommand(object sender, GridViewCommandEventArgs e) { Guid SolutionGroupID = new Guid(e.CommandArgument.ToString()); ViewState["SolutionGroupID"] = SolutionGroupID; switch (e.CommandName) { case "DoEdit": { mvSetting.SetActiveView(vwEdit); ViewState["btn"] = "Update"; FillViewEdit(SolutionGroupID); break; } case "DoDelete": { using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.SolutionGroups where u.SolutionGroupID == SolutionGroupID select u).FirstOrDefault(); lblDelete.Text = n.SolutionGroupTitle; mvSetting.SetActiveView(vwDelete); } break; } } }
//public void LoadPhoneSection(string ServiceStepName) //{ // if (ServiceStepName == "call-center-support-services") // { // lt_gp1_P1.Text = ReturnTextTitle(12); // lt_gp1_P2.Text = ReturnTextTitle(13); // lt_gp1_P3.Text = ReturnTextTitle(14); // string Email1 = ReturnTextTitle(15); // hl_gp1_P4.Text = Email1; // hl_gp1_P4.NavigateUrl = "mailto:" + Email1; // /////////////////////////////////////// // lt_gp2_P1.Text = ReturnTextTitle(16); // lt_gp2_P2.Text = ReturnTextTitle(17); // lt_gp2_P3.Text = ReturnTextTitle(18); // string Email2 = ReturnTextTitle(19); // hl_gp2_P4.Text = Email2; // hl_gp2_P4.NavigateUrl = "mailto:" + Email2; // ////////////////////////////////////////// // lt_gp3_P1.Text = ReturnTextTitle(20); // lt_gp3_P2.Text = ReturnTextTitle(21); // lt_gp3_P3.Text = ReturnTextTitle(22); // string Email3 = ReturnTextTitle(23); // hl_gp3_P4.Text = Email3; // hl_gp3_P4.NavigateUrl = "mailto:" + Email3; // /////////////////////////////////////// // lt_gp4_P1.Text = ReturnTextTitle(24); // lt_gp4_P2.Text = ReturnTextTitle(25); // lt_gp4_P3.Text = ReturnTextTitle(26); // string Email4 = ReturnTextTitle(27); // hl_gp4_P4.Text = Email4; // hl_gp4_P4.NavigateUrl = "mailto:" + Email4; // pnlPhone.Visible = true; // } // else // pnlPhone.Visible = false; //} public string ReturnTextTitle(int TextId) { using (VaranegarEntities db = new VaranegarEntities()) { return(db.Texts.Where(a => a.TextID == TextId).Select(a => a.TextTitle).FirstOrDefault()); } }
protected void rptProductGroups_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { HiddenField hfProductGroupId = (HiddenField)e.Item.FindControl("hfProductGroupId"); Repeater rptProducts = (Repeater)e.Item.FindControl("rptProducts"); Guid ProductGroupID = new Guid(hfProductGroupId.Value); using (VaranegarEntities db = new VaranegarEntities()) { var n = (from aa in db.Products join a in db.ProductGroups on aa.fk_ProductGroupID equals a.ProductGroupID where aa.fk_ProductGroupID == ProductGroupID && aa.IsDelete == false && aa.IsActive == true orderby aa.Priority select new { aa.ProductName, aa.ProductTitle, a.ProductGroupName }).ToList(); rptProducts.DataSource = n; rptProducts.DataBind(); } } }
//protected void btnSubmit_Click(object sender, EventArgs e) //{ // if (Page.IsValid) // { // if (Page.RouteData.Values["BlogName"] != null) // { // string BlogName = Page.RouteData.Values["BlogName"].ToString(); // using (VaranegarEntities db = new VaranegarEntities()) // { // var n = (from a in db.Blogs // where a.BlogName == BlogName && a.IsDelete == false // select a).FirstOrDefault(); // BlogComments bc = new BlogComments(); // bc.CommentID = Guid.NewGuid(); // bc.CommentBody = txtcomment.Text; // bc.CommentDate = DateTime.Now; // bc.CommentIP = Request.UserHostAddress; // bc.Email = txtemail.Text; // bc.fk_BlogID = n.BlogID; // bc.IsDelete = false; // bc.Name = txtname.Text; // bc.IsValid = false; // db.BlogComments.Add(bc); // db.SaveChanges(); // pnlSuccess.Visible = true; // } // } // } //} //public void LoadComments() //{ // if (Page.RouteData.Values["BlogName"] != null) // { // string BlogName = Page.RouteData.Values["BlogName"].ToString(); // using (VaranegarEntities db = new VaranegarEntities()) // { // var n = (from a in db.Blogs // where a.BlogName == BlogName && a.IsDelete == false // select a).FirstOrDefault(); // var m = (from a in db.BlogComments // where a.fk_BlogID == n.BlogID // && a.IsDelete == false && a.IsValid == true // select a).ToList(); // rptComments.DataSource = m; // rptComments.DataBind(); // } // } //} #endregion public void LoadblogGroups() { using (VaranegarEntities db = new VaranegarEntities()) { var n = (from a in db.BlogGroups where a.IsDelete == false orderby a.Priority select a).ToList(); rptCategory.DataSource = n; rptCategory.DataBind(); var n2 = (from a in db.Blogs join aa in db.BlogGroups on a.fk_BlogGroupID equals aa.BlogGroupID where a.IsDelete == false orderby a.Visit descending select new { aa.BlogGroupName, a.BlogTitle, a.BlogName, a.BlogImage, a.summeryText, a.Visit, a.SubmitDate }).Take(5).ToList(); rptmostvisitBlogs.DataSource = n2; rptmostvisitBlogs.DataBind(); } }
public void UpdateForm() { Guid ServiceID = new Guid(ViewState["ServiceID"].ToString()); string new_filename = string.Empty; if (fuImage.PostedFile.ContentLength != 0) { string original_filename = Path.GetFileName(fuImage.PostedFile.FileName); new_filename = Guid.NewGuid().ToString() + Path.GetExtension(original_filename); string new_filepath = Server.MapPath("~/Uploads/Service/" + new_filename); fuImage.PostedFile.SaveAs(new_filepath); ViewState["GImage"] = new_filename; } using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.Services where u.ServiceID == ServiceID select u).FirstOrDefault(); n.ServiceTitle = txtTitle.Text; n.En_ServiceTitle = txtEN_Title.Text; n.ServiceName = txtName.Text; n.SmallDesc = txtHeader.Text; n.En_SmallDesc = txtHeaderEn.Text; n.ServiceDesc = reDesc.Text; n.En_ServiceDesc = reEN_Desc.Text; n.Priority = Convert.ToInt32(txtPrio.Text); n.LastUpdateDate = DateTime.Now; n.HeaderImg = ViewState["GImage"].ToString(); db.SaveChanges(); } }
public void FillViewEdit(Guid ProductGroupID) { using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.ProductGroups where u.ProductGroupID == ProductGroupID select u).FirstOrDefault(); txtTitle.Text = n.ProductGroupTitle; txtName.Text = n.ProductGroupName; txtEN_Title.Text = n.En_ProductGroupTitle; ViewState["GImage"] = n.ProductGroupImage; txtPrio.Text = n.Priority.ToString(); txtSummery.Text = n.ProductGroupSummery; txtSummery_En.Text = n.En_ProductGroupSummery; txtName.Enabled = false; imgEditImages.ImageUrl = "~/Uploads/ProductGroup/" + n.ProductGroupImage; if (n.IsDraft == true) { reDesc.Text = n.ProductGroupDesc_Draft; reEN_Desc.Text = n.En_ProductGroupDesc_Draft; } else { reDesc.Text = n.ProductGroupDesc; reEN_Desc.Text = n.En_ProductGroupDesc; } chkActive.Checked = Convert.ToBoolean(n.IsActive); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { using (VaranegarEntities db = new VaranegarEntities()) { var m = (from a in db.Blogs.AsEnumerable() join aa in db.BlogGroups on a.fk_BlogGroupID equals aa.BlogGroupID where a.IsDelete == false orderby a.SubmitDate descending select new { aa.BlogGroupName, a.BlogTitle, a.BlogName, a.BlogImage, a.summeryText, a.Visit, a.SubmitDate }).ToList(); rptFooterBlog.DataSource = m.Take(3); rptFooterBlog.DataBind(); } } }
public List <SearchResultModel> CreateProductGroupResults(String SearchQuery) { using (VaranegarEntities db = new VaranegarEntities()) { List <SearchResultModel> LocalSearchResultList = new List <SearchResultModel>(); var n = (from a in db.ProductGroups where a.IsDelete == false && (a.ProductGroupTitle.Contains(SearchQuery) || a.ProductGroupSummery.Contains(SearchQuery) || a.ProductGroupDesc.Contains(SearchQuery)) select new { a.ProductGroupID, a.ProductGroupTitle, a.ProductGroupSummery, a.ProductGroupName }).ToList(); foreach (var item in n) { if (!IdList.Contains(item.ProductGroupID)) { IdList.Add(item.ProductGroupID); LocalSearchResultList.Add(new SearchResultModel(item.ProductGroupTitle, item.ProductGroupSummery, "/Product/" + item.ProductGroupName)); } } return(LocalSearchResultList); } }
public void Log_ErrorInsert(string searchQuery) { using (VaranegarEntities db = new VaranegarEntities()) { Log_SearchQueries leIn = new Log_SearchQueries(); leIn.SearchQuery = searchQuery; leIn.SearchDate = DateTime.Now; leIn.SearchIp = Request.UserHostAddress; leIn.OS = FindUserInfo.UserOS(); if (Request.UrlReferrer != null) { leIn.RefrallPage = Request.UrlReferrer.ToString(); } else { leIn.RefrallPage = "ورود مستقیم"; } System.Web.HttpBrowserCapabilities browser = Request.Browser; leIn.browser = browser.Type; db.Log_SearchQueries.Add(leIn); db.SaveChanges(); } }
public List <SearchResultModel> CreateNewsResults(String SearchQuery) { using (VaranegarEntities db = new VaranegarEntities()) { List <SearchResultModel> LocalSearchResultList = new List <SearchResultModel>(); var n = (from a in db.Blogs join aa in db.BlogGroups on a.fk_BlogGroupID equals aa.BlogGroupID where a.IsDelete == false && (a.BlogTitle.Contains(SearchQuery) || a.summeryText.Contains(SearchQuery) || a.BlogBody.Contains(SearchQuery)) select new { a.BlogID, a.BlogName, a.summeryText, a.BlogTitle, aa.BlogGroupName }).ToList(); foreach (var item in n) { if (!IdList.Contains(item.BlogID)) { IdList.Add(item.BlogID); LocalSearchResultList.Add(new SearchResultModel(item.BlogTitle, item.summeryText, "/Blog/" + item.BlogGroupName + "/" + item.BlogName)); } } return(LocalSearchResultList); } }
protected void btnAgree_Click(object sender, EventArgs e) { Guid Id = new Guid(ViewState["Id"].ToString()); using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.GalleryGroups where u.Id == Id select u).FirstOrDefault(); n.IsDelete = true; n.DeleteDate = DateTime.Now; var m = (from a in db.GalleryImages where a.fk_GalleryId == Id && a.IsDelete == false select a).ToList(); foreach (var item in m) { item.IsDelete = true; item.DeleteDate = DateTime.Now; } db.SaveChanges(); mvSetting.SetActiveView(vwList); LoadForm(); pnlSuccess.Visible = true; } }
protected void btnAgree_Click(object sender, EventArgs e) { Guid ServiceID = new Guid(ViewState["ServiceID"].ToString()); using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.Services where u.ServiceID == ServiceID select u).FirstOrDefault(); n.IsDelete = true; n.DeleteDate = DateTime.Now; db.SaveChanges(); var m = (from a in db.ServiceSteps where a.fk_ServiceID == ServiceID && a.IsDelete == false select a).ToList(); foreach (var item in m) { item.IsDelete = true; item.DeleteDate = DateTime.Now; db.SaveChanges(); } LoadForm(); pnlSuccess.Visible = true; mvSetting.SetActiveView(vwList); } }
public void LoadInfo() { if (Page.RouteData.Values["ServiceStepName"] != null) { string ServiceStepName = Page.RouteData.Values["ServiceStepName"].ToString(); //LoadPhoneSection(ServiceStepName); using (VaranegarEntities db = new VaranegarEntities()) { var n = (from a in db.ServiceSteps where a.ServiceStepName == ServiceStepName && a.IsDelete == false select a).FirstOrDefault(); ltTitle.Text = n.ServiceStepTitle; ltText.Text = n.SmallDesc; ltTitleHeader.Text = n.ServiceStepTitle; ltServiceDesc.Text = n.ServiceStepDesc; ScriptManager.RegisterStartupScript(this, GetType(), "PageScript121", "$('#imageSectionDiv').css('background', 'url(/Uploads/Service/" + n.ServiceStepImage + ") no-repeat center center / cover');", true); var m = (from a in db.Services where a.ServiceID == n.fk_ServiceID && a.IsDelete == false select a).FirstOrDefault(); hlService.NavigateUrl = "~/services/" + m.ServiceName; ltlhlServiceTitle.Text = m.ServiceTitle; Page.Title = n.ServiceStepTitle + " | ورانگر پیشرو"; Page.MetaDescription = n.ServiceStepTitle + " | ورانگر پیشرو اولین و بزرگترین ارائه دهنده نرم افزارهای تخصصی و یکپارچه فروش و پخش مویرگی، نرم افزار فروشگاه و داشبورد هوش تجاری می باشد"; } } }
public void InsertForm() { string new_filename = string.Empty; if (fuImage.PostedFile.ContentLength != 0) { string original_filename = Path.GetFileName(fuImage.PostedFile.FileName); new_filename = Guid.NewGuid().ToString() + Path.GetExtension(original_filename); string new_filepath = Server.MapPath("~/Uploads/Slider/" + new_filename); fuImage.PostedFile.SaveAs(new_filepath); ViewState["GImage"] = new_filename; } using (VaranegarEntities db = new VaranegarEntities()) { Sliders p = new Sliders(); p.SliderTitle = txtTitle.Text; p.Priority = Convert.ToInt32(txtPrio.Text); p.BigText = txtBigText.Text; p.IsActive = chbActiveSlider.Checked; p.LinkAddress = txtLinkAddress.Text; p.LinkText = txtLinkTitle.Text; p.SliderImageUrl = new_filename; p.SmallText = txtSmallText.Text; p.IsDelete = false; db.Sliders.Add(p); db.SaveChanges(); } }
protected void grdProductGroup_RowCommand(object sender, GridViewCommandEventArgs e) { Guid CommentID = new Guid(e.CommandArgument.ToString()); ViewState["CommentID"] = CommentID; switch (e.CommandName) { case "DoEdit": { pnlCheck.Visible = true; ViewState["btn"] = "Update"; using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.BlogComments where u.CommentID == CommentID select u).FirstOrDefault(); txtComment.Text = n.CommentBody; } break; } case "DoDelete": { using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.BlogComments where u.CommentID == CommentID select u).FirstOrDefault(); pnlDelete.Visible = true; } break; } } }
public void LoadForm() { using (VaranegarEntities db = new VaranegarEntities()) { if (Request.QueryString["type"] == null) { var n = (from u in db.BlogGroups where u.IsDelete == false orderby u.Priority select u).ToList(); grdTable.DataSource = n; grdTable.DataBind(); CheckEmptyData(n.Count()); } else { if (Request.QueryString["type"] == "Recycle") { var n = (from u in db.BlogGroups where u.IsDelete == true orderby u.Priority select u).ToList(); grdTable.DataSource = n; grdTable.DataBind(); CheckEmptyData(n.Count()); } } } }
//public void LoadSolutions(Repeater rptID, Guid fk_solutionGroupID) //{ // using (VaranegarEntities db = new VaranegarEntities()) // { // var n = (from a in db.Solutions // where a.fk_SolutionGroupID == fk_solutionGroupID && a.IsDelete == false // orderby a.Priority // select a).ToList(); // rptID.DataSource = n; // rptID.DataBind(); // } //} //protected void rptSolutionGroups_ItemDataBound(object sender, RepeaterItemEventArgs e) //{ // if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) // { // Repeater rptSolutions = (Repeater)e.Item.FindControl("rptSolutions"); // HiddenField hfSolutionGroup = (HiddenField)e.Item.FindControl("hfSolutionGroup"); // Guid SolutionGroupID = new Guid(hfSolutionGroup.Value); // LoadSolutions(rptSolutions, SolutionGroupID); // } //} protected void rptServices_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { HiddenField hfServiceId = (HiddenField)e.Item.FindControl("hfServiceId"); Repeater rptServiceSteps = (Repeater)e.Item.FindControl("rptServiceSteps"); Guid ServiceId = new Guid(hfServiceId.Value); using (VaranegarEntities db = new VaranegarEntities()) { var n = (from aa in db.ServiceSteps join a in db.Services on aa.fk_ServiceID equals a.ServiceID where aa.fk_ServiceID == ServiceId && aa.IsDelete == false orderby aa.Priority select new { aa.ServiceStepName, aa.ServiceStepTitle, a.ServiceName }).ToList(); rptServiceSteps.DataSource = n; rptServiceSteps.DataBind(); } } }
protected void grdTable_RowCommand(object sender, GridViewCommandEventArgs e) { int managerId = Convert.ToInt32(e.CommandArgument.ToString()); ViewState["ManagerID"] = managerId; if (e.CommandName == "DoEdit") { int ManagerID = Convert.ToInt32(ViewState["ManagerID"].ToString()); ViewState["ManagerID"] = ManagerID; ViewState["btn"] = "Update"; FillViewEdit(ManagerID); } else if (e.CommandName == "DoDelete") { int ManagerID = Convert.ToInt32(ViewState["ManagerID"].ToString()); ViewState["ManagerID"] = ManagerID; using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.Managers where u.ManagerID == ManagerID select u).FirstOrDefault(); lblDelete.Text = n.ManagerTitle; mvSetting.SetActiveView(vwDelete); } } }
protected void grdProductGroup_RowCommand(object sender, GridViewCommandEventArgs e) { int EmailId = Convert.ToInt32(e.CommandArgument.ToString()); ViewState["EmailId"] = EmailId; switch (e.CommandName) { case "DoEdit": { mvSetting.SetActiveView(vwEdit); ViewState["btn"] = "Update"; FillViewEdit(EmailId); break; } case "DoDelete": { using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.Emails where u.EmailId == EmailId select u).FirstOrDefault(); lblDelete.Text = n.EmailTitle; mvSetting.SetActiveView(vwDelete); } break; } } }
public void LoadForm() { int datasourceCounter = 0; using (VaranegarEntities db = new VaranegarEntities()) { var n = (from u in db.CareerForm where u.IsDelete == false orderby u.RegisterDate descending select new { u.FirstName, u.LastName, u.careerID, u.RegisterDate }).ToList(); grdTable.DataSource = n; grdTable.DataBind(); datasourceCounter = n.Count(); } CheckEmptyData(datasourceCounter); mvSetting.SetActiveView(vwList); }
protected void btnSubmit_Click(object sender, EventArgs e) { string new_filename = string.Empty; if (fuImage.PostedFile.ContentLength != 0) { string original_filename = Path.GetFileName(fuImage.PostedFile.FileName); new_filename = Guid.NewGuid().ToString() + Path.GetExtension(original_filename); string new_filepath = Server.MapPath("~/Uploads/Resume/" + new_filename); fuImage.PostedFile.SaveAs(new_filepath); ViewState["GImage"] = new_filename; } using (VaranegarEntities db = new VaranegarEntities()) { Resumes re = new Resumes(); re.resumeid = Guid.NewGuid(); re.IsDelete = false; re.resumeFile = new_filename; re.SubmitDate = DateTime.Now; re.submitIP = Request.UserHostAddress; db.Resumes.Add(re); db.SaveChanges(); pnlsuccess.Visible = true; } }
public void InsertForm() { using (VaranegarEntities db = new VaranegarEntities()) { string new_filename = string.Empty; if (fuImage.PostedFile.ContentLength != 0) { string original_filename = Path.GetFileName(fuImage.PostedFile.FileName); new_filename = Guid.NewGuid().ToString() + Path.GetExtension(original_filename); string new_filepath = Server.MapPath("~/Uploads/Gallery/" + new_filename); fuImage.PostedFile.SaveAs(new_filepath); ViewState["GImage"] = new_filename; } GalleryGroups pg = new GalleryGroups(); pg.Id = Guid.NewGuid(); pg.ImageUrl = new_filename; pg.Title = txtTitle.Text; pg.Priority = Convert.ToInt32(txtPri.Text); pg.IsDelete = false; db.GalleryGroups.Add(pg); db.SaveChanges(); } }
protected void btnSubmitProvince_OnClick(object sender, EventArgs e) { Guid cusID = new Guid(ViewState["CustomersID"].ToString()); using (VaranegarEntities db = new VaranegarEntities()) { var n = (from a in db.Rel_Customer_Province where a.fk_CustomerID == cusID select a).ToList(); foreach (var item in n) { db.Rel_Customer_Province.Remove(item); } foreach (ListItem chk in cblProvince.Items) { if (chk.Selected) { int ProvinceID = Convert.ToInt32(chk.Value); Rel_Customer_Province RelEnter = new Rel_Customer_Province(); RelEnter.fk_CustomerID = cusID; RelEnter.fk_ProvinceID = ProvinceID; db.Rel_Customer_Province.Add(RelEnter); db.SaveChanges(); } } } mvSetting.SetActiveView(vwList); }
public void UpdateForm() { Guid Id = new Guid(ViewState["Id"].ToString()); using (VaranegarEntities db = new VaranegarEntities()) { string new_filename = string.Empty; if (fuImage.PostedFile.ContentLength != 0) { string original_filename = Path.GetFileName(fuImage.PostedFile.FileName); new_filename = Guid.NewGuid().ToString() + Path.GetExtension(original_filename); string new_filepath = Server.MapPath("~/Uploads/Gallery/" + new_filename); fuImage.PostedFile.SaveAs(new_filepath); ViewState["GImage"] = new_filename; } var n = (from u in db.GalleryGroups where u.Id == Id select u).FirstOrDefault(); n.ImageUrl = ViewState["GImage"].ToString(); n.Title = txtTitle.Text; n.Priority = Convert.ToInt32(txtPri.Text); db.SaveChanges(); } }
protected void grdTable_OnDataBound(object sender, EventArgs e) { foreach (GridViewRow r in grdTable.Rows) { HiddenField hfValue = (HiddenField)r.FindControl("hfValue"); LinkButton lbDelete = (LinkButton)r.FindControl("lbDelete"); LinkButton lbRecycle = (LinkButton)r.FindControl("lbRecycle"); Guid ID = new Guid(hfValue.Value); using (VaranegarEntities db = new VaranegarEntities()) { var n = (from a in db.ServiceSteps where a.ServiceStepID == ID select a).FirstOrDefault(); if (n.IsDelete == false) { lbDelete.Visible = true; lbRecycle.Visible = false; } else { lbDelete.Visible = false; lbRecycle.Visible = true; } } } }
public void LoadSolutionInfo() { if (Page.RouteData.Values["SolutionName"] != null) { string SolutionName = Page.RouteData.Values["SolutionName"].ToString(); using (VaranegarEntities db = new VaranegarEntities()) { var n = (from a in db.Solutions where a.SolutionName == SolutionName && a.IsDelete == false select new { a.BannerText, a.SolutionTitle, a.ProblemDesc, a.ImgBannerFile, a.SolutionID }).FirstOrDefault(); ltSolutionTitle.Text = "راهکار " + n.SolutionTitle; ltSolutionTitleCu.Text = n.SolutionTitle; ltProblemTitle.Text = n.SolutionTitle; ltbannerText.Text = n.BannerText; ltProblem.Text = n.ProblemDesc; ltTitleSolution.Text = n.SolutionTitle; ScriptManager.RegisterStartupScript(this, GetType(), "PageScript", "$('#imageSectionDiv').css('background', 'url(../Uploads/Solution/" + n.ImgBannerFile + ") no-repeat center center / cover');", true); Page.Title = "راهکار " + n.SolutionTitle + " | ورانگر پیشرو"; Page.MetaDescription = "راهکار " + n.SolutionTitle + "، " + n.BannerText; CustomerBind(n.SolutionID); } } }