protected void Page_Load(object sender, EventArgs e) { Page.Title = Page.Request.Params["id"] != null ? PagesTitles.ManagerTitlesEditTitle + BackendHelper.TagToValue("page_title_part") : PagesTitles.ManagerTitlesCreateTitle + BackendHelper.TagToValue("page_title_part"); OtherMethods.ActiveRightMenuStyleChanche("hlTitles", this.Page); OtherMethods.ActiveRightMenuStyleChanche("hlSouls", this.Page); #region Блок доступа к странице var userInSession = (Users)Session["userinsession"]; var rolesList = Application["RolesList"] as List <Roles>; var currentRole = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == userInSession.Role.ToLower()); if (currentRole.PageTitlesEdit != 1) { Response.Redirect("~/Error.aspx?id=1"); } #endregion if (!IsPostBack) { var category = new Category(); var ds = category.GetAllItems("Name", "ASC", null); ddlCategory.DataSource = ds; ddlCategory.DataTextField = "Name"; ddlCategory.DataValueField = "ID"; ddlCategory.DataBind(); ddlCategory.Items.Add(new ListItem("Не назначена", "0")); } btnDelete.Visible = CanDelete(); if (Page.Request.Params["id"] != null) { var title = new Titles() { ID = Convert.ToInt32(Page.Request.Params["id"]) }; title.GetById(); if (!IsPostBack) { tbName.Text = title.Name; tbMarginCoefficient.Text = title.MarginCoefficient.ToString(); tbWeightMin.Text = title.WeightMin.ToString(); tbWeightMax.Text = title.WeightMax.ToString(); tbAdditiveCostWithoutAkciza.Text = title.AdditiveCostWithoutAkciza.ToString(); if (title.Additive == 1) { cbAdditive.Checked = true; } if (title.CanBeWithoutAkciza == 1) { cbCanBeWithoutAkciza.Checked = true; } ddlCategory.SelectedValue = title.CategoryID.ToString(); } } }