protected void btnAction_Click(object sender, EventArgs e)
        {
            lblNotif.Text = String.Empty;
            foreach (var items in lvAllTickets.Items)
            {
                var chkBoxRows = (CheckBox)items.FindControl("cbSelect");

                if (chkBoxRows.Checked)
                {
                    var id     = (HiddenField)items.FindControl("hfID");
                    var ticket = new DAL.DataBaseObjects.Tickets {
                        ID = Convert.ToInt32(id.Value)
                    };
                    ticket.GetById();

                    var issuance = new IssuanceLists()
                    {
                        ID = Convert.ToInt32(ddlIssuanceLists.SelectedValue)
                    };
                    issuance.GetById();

                    //присваиваем заявке расчетный лист только если ее юсерАйДИ совпадает с АйДи из расчетного лисна или если убираем расчетный лист с заявки
                    if (ticket.UserID == issuance.UserID || ddlIssuanceLists.SelectedValue == "0")
                    {
                        ticket.IssuanceListID = Convert.ToInt32(ddlIssuanceLists.SelectedValue);
                        ticket.Update();
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerIssuanceListViewTitle.Replace("{0}", Page.Request.Params["id"]) + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlIssuance", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlIssuanceListsView", 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.PageIssuanceListView != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            if (currentRole.ActionIssuanceListDelete != 1)
            {
                btnDelete.Visible = false;
            }

            if (!String.IsNullOrEmpty(Page.Request.Params["id"]))
            {
                var issuanceList = new IssuanceLists()
                {
                    ID = Convert.ToInt32(Page.Request.Params["id"])
                };
                issuanceList.GetById();
                if (issuanceList.IssuanceListsStatusID == 3 || issuanceList.IssuanceListsStatusID == 1)
                {
                    btnReopen.Visible = false;
                    btnClose.Visible  = true;
                }
                else
                {
                    btnReopen.Visible = true;
                    btnClose.Visible  = false;
                }
                var user = UsersHelper.UserIDToFullName(issuanceList.UserID.ToString());
                lblListInfo.Text = String.Format("# {0}, {1}, рассчет: {2}", issuanceList.ID, user,
                                                 OtherMethods.DateConvert(issuanceList.IssuanceDate.ToString()));
            }
            else
            {
                pnlSearschResult.Visible = pnlResultPanel.Visible = btnAction.Visible = false;
                lblPage.Visible          = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Page.Request.Params["id"]))
            {
                Page.Title = PagesTitles.ManagerIssuanceListsEditTitle.Replace("{0}", Page.Request.Params["id"]) + BackendHelper.TagToValue("page_title_part");
            }
            else
            {
                Page.Title = PagesTitles.ManagerIssuanceListsCreateTitle + BackendHelper.TagToValue("page_title_part");
            }
            OtherMethods.ActiveRightMenuStyleChanche("hlIssuance", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlIssuanceListsEdit", 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.PageIssuanceListsEdit != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            if (Page.Request.Params["id"] != null)
            {
                var issuancelists = new IssuanceLists()
                {
                    ID = Convert.ToInt32(Page.Request.Params["id"])
                };
                issuancelists.GetById();
                if (!IsPostBack)
                {
                    tbComment.Text      = issuancelists.Comment;
                    tbIssuanceDate.Text = Convert.ToDateTime(issuancelists.IssuanceDate).ToString("dd-MM-yyyy");
                    tbUID.Text          = issuancelists.UserID.ToString();
                }
                lblIssuanceList.Text = "Редактирование рассчетного листа";
            }
        }
        public static bool CloseIssuanceList(Int32 issuanceListId)
        {
            var isAllTicketsChanged = true;
            var user           = (Users)HttpContext.Current.Session["userinsession"];
            var rolesList      = HttpContext.Current.Application["RolesList"] as List <Roles>;
            var currentRole    = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == user.Role.ToLower());
            var currentTickets = new Tickets {
                IssuanceListID = issuanceListId
            };
            var ds = currentTickets.GetAllItems("ID", "ASC", "IssuanceListID");

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                var currentTicket = new Tickets {
                    ID = Convert.ToInt32(row["ID"])
                };
                currentTicket.GetById();
                var updateTicket = new Tickets {
                    ID = Convert.ToInt32(row["ID"])
                };
                var statusError = TicketsFilter.StatusChangeFilter(ref updateTicket, currentTicket.DriverID.ToString(), currentTicket.StatusID.ToString(), currentTicket.StatusDescription, currentTicket.AdmissionDate.ToString(), null, "6", null, currentRole);
                if (statusError != null && isAllTicketsChanged == true)
                {
                    isAllTicketsChanged = false;
                }
                updateTicket.Update(user.ID, OtherMethods.GetIPAddress(), "IssuanceListsView");
            }
            var issuanceList = new IssuanceLists {
                ID = issuanceListId
            };

            issuanceList.GetById();
            issuanceList.IssuanceListsStatusID = 2;
            issuanceList.Update();
            return(isAllTicketsChanged);
        }