Esempio n. 1
0
        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();
                    }
                }
            }
        }
Esempio n. 2
0
        private void ListViewData()
        {
            var dm = new DataManager();
            var ds = dm.QueryWithReturnDataSet(String.Format("SELECT * {0} ORDER BY ID DESC", GetSearchString()));

            lvAllTickets.DataSource = ds;
            lblAllResult.Text       = ds.Tables[0].Rows.Count.ToString();
            lvAllTickets.DataBind();

            #region Ограничения на заполнение привезенных денег
            foreach (ListViewDataItem items in lvAllTickets.Items)
            {
                var id          = (HiddenField)items.FindControl("hfID");
                var receivedBLR = (TextBox)items.FindControl("tbReceivedBLR");
                var receivedUSD = (TextBox)items.FindControl("tbReceivedUSD");
                var receivedEUR = (TextBox)items.FindControl("tbReceivedEUR");
                var receivedRUR = (TextBox)items.FindControl("tbReceivedRUR");
                var ticket      = new DAL.DataBaseObjects.Tickets
                {
                    ID = Convert.ToInt32(id.Value)
                };
                ticket.GetById();
                if (ticket.CourseEUR == 0 || ticket.CourseEUR == 1)
                {
                    receivedEUR.Enabled = false;
                }
                if (ticket.CourseRUR == 0 || ticket.CourseRUR == 1)
                {
                    receivedRUR.Enabled = false;
                }
                if (ticket.CourseUSD == 0 || ticket.CourseUSD == 1)
                {
                    receivedUSD.Enabled = false;
                }

                if (ticket.StatusID == 1 || ticket.StatusID == 2 || ticket.StatusID == 4 || ticket.StatusID == 7 ||
                    ticket.StatusID == 8 || ticket.StatusID == 9 || ticket.StatusID == 10)
                {
                    receivedBLR.Enabled = false;
                    receivedRUR.Enabled = false;
                    receivedUSD.Enabled = false;
                    receivedEUR.Enabled = false;
                }
            }
            #endregion
        }
        protected void btnAction_Click(object sender, EventArgs e)
        {
            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();
                    ticket.IssuanceListID = 0;
                    ticket.Update();
                }
            }
        }
        public void btnDelete_Click(Object sender, EventArgs e)
        {
            var userInSession = (Users)Session["userinsession"];

            #region Блок доступа к методу
            var rolesList   = Application["RolesList"] as List <Roles>;
            var currentRole = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == userInSession.Role.ToLower());
            if (currentRole.ActionUserTicketDelete != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            var ticket = new DAL.DataBaseObjects.Tickets {
                ID = Convert.ToInt32(hfID.Value)
            };
            ticket.GetById();
            ticket.Delete(Convert.ToInt32(hfID.Value), Convert.ToInt32(userInSession.ID), OtherMethods.GetIPAddress(), "UserTicketEdit",
                          ticket.FullSecureID);
            Session["flash:now"] = String.Format("<span style='color: red;'>заявка {0} удалена</span>", hfID.Value);
            FinalyRedirect();
        }
Esempio n. 5
0
        protected void btnAction_Click(object sender, EventArgs e)
        {
            lblNotif.Text = String.Empty;
            var user        = (Users)Session["userinsession"];
            var rolesList   = Application["RolesList"] as List <Roles>;
            var currentRole = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == user.Role.ToLower());

            if (ddlAction.SelectedValue == "Удалить")
            {
                DeleteAccess();
                foreach (ListViewDataItem items in lvAllTickets.Items)
                {
                    var chkBoxRows = (CheckBox)items.FindControl("cbSelect");

                    if (chkBoxRows.Checked)
                    {
                        var id        = (HiddenField)items.FindControl("hfID");
                        var ticketOld = new DAL.DataBaseObjects.Tickets
                        {
                            ID = Convert.ToInt32(id.Value)
                        };
                        ticketOld.GetById();
                        if (ticketOld.StatusID == 1 || user.Role == Users.Roles.Admin.ToString())
                        {
                            var ticket = new DAL.DataBaseObjects.Tickets();
                            ticket.Delete(Convert.ToInt32(id.Value), user.ID, OtherMethods.GetIPAddress(), "UserTicketViewMy", ticketOld.FullSecureID);
                        }
                        else
                        {
                            lblNotif.Text      = "Были удалены заявки со статусом 'Не обработана'. Заявки с другими статусами удалить не возможно!";
                            lblNotif.ForeColor = Color.Red;
                        }
                    }
                }
            }


            if (ddlAction.SelectedValue == "Добавить водителя")
            {
                foreach (ListViewDataItem items in lvAllTickets.Items)
                {
                    var chkBoxRows = (CheckBox)items.FindControl("cbSelect");

                    if (chkBoxRows.Checked)
                    {
                        var ticketId        = (HiddenField)items.FindControl("hfID");
                        var currentDriverId = (HiddenField)items.FindControl("hfDriverID");
                        var currentStatusId = (HiddenField)items.FindControl("hfStatusID");
                        var oldStatusId     = (HiddenField)items.FindControl("hfStatusIDOld");
                        var ticket          = new DAL.DataBaseObjects.Tickets {
                            ID = Convert.ToInt32(ticketId.Value)
                        };
                        var errorText = TicketsFilter.DriverChangeFilter(ref ticket, currentDriverId.Value, currentStatusId.Value, oldStatusId.Value, ddlDrivers.SelectedValue);
                        if (errorText == null) //если ошибок после фильтрации нет - сохраняем заявку
                        {
                            ticket.Update(user.ID, OtherMethods.GetIPAddress(), "UserTicketView");
                        }
                        else //выводим все ошибки, если они есть
                        {
                            lblNotif.Text += String.Format("{0}<br/>", errorText);
                        }
                    }
                }
            }

            if (ddlAction.SelectedValue == "Изменить статус")
            {
                foreach (ListViewDataItem items in lvAllTickets.Items)
                {
                    var chkBoxRows = (CheckBox)items.FindControl("cbSelect");

                    if (chkBoxRows.Checked)
                    {
                        var ticketId                 = (HiddenField)items.FindControl("hfID");
                        var currentDriverId          = (HiddenField)items.FindControl("hfDriverID");
                        var currentStatusDescription = (HiddenField)items.FindControl("hfStatusDescription");
                        var currentAdmissionDate     = (HiddenField)items.FindControl("hfAdmissionDate");
                        var currentStatusId          = (HiddenField)items.FindControl("hfStatusID");
                        var ticket = new DAL.DataBaseObjects.Tickets {
                            ID = Convert.ToInt32(ticketId.Value)
                        };
                        var errorText = TicketsFilter.StatusChangeFilter(ref ticket, currentDriverId.Value, currentStatusId.Value, currentStatusDescription.Value, currentAdmissionDate.Value, tbStatusDescription.Text, ddlStatus.SelectedValue, tbDeliveryDate.Text, currentRole);
                        if (errorText == null) //если ошибок после фильтрации нет - сохраняем заявку
                        {
                            ticket.Update(user.ID, OtherMethods.GetIPAddress(), "UserTicketView");
                        }
                        else //выводим все ошибки, если они есть
                        {
                            lblNotif.Text += String.Format("{0}<br/>", errorText);
                        }
                    }
                }
            }

            if (ddlAction.SelectedValue == "Печать карты (кур.)" ||
                ddlAction.SelectedValue == "Печать карты (мен.)" ||
                ddlAction.SelectedValue == "Печать карты (кас.)" ||
                ddlAction.SelectedValue == "Печать заявок" ||
                ddlAction.SelectedValue == "Печать чеков" ||
                ddlAction.SelectedValue == "Печать наклеек" ||
                ddlAction.SelectedValue == "Печать заказ-поручений" ||
                ddlAction.SelectedValue == "Печать накладной" ||
                ddlAction.SelectedValue == "Печать приложения" ||
                ddlAction.SelectedValue == "Печать приложения 2" ||
                ddlAction.SelectedValue == "Печать путевого листа 1" ||
                ddlAction.SelectedValue == "Печать путевого листа 2")
            {
                var idList = String.Empty;
                foreach (ListViewDataItem items in lvAllTickets.Items)
                {
                    var chkBoxRows = (CheckBox)items.FindControl("cbSelect");

                    if (chkBoxRows.Checked)
                    {
                        var id = (HiddenField)items.FindControl("hfID");
                        idList += id.Value + "-";
                    }
                }
                idList = idList.Remove(idList.Length - 1);

                if (ddlAction.SelectedValue == "Печать карты (кур.)")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintMap.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать карты (мен.)")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintMapForManager.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать карты (кас.)")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintMapForCashier.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать заявок")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintTickets.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать чеков")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintCheck.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать наклеек")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintVinil.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать заказ-поручений")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintZP.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать накладной")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintNakl.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать приложения")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintNaklPril.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать приложения 2")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintNaklPril2.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать путевого листа 1")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintPut1.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать путевого листа 2")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintPut2.aspx?id={0}", idList));
                }
            }

            AddRowstoIDList();
        }
        protected void btnAction_Click(object sender, EventArgs e)
        {
            lblNotif.Text = String.Empty;
            var user        = (Users)Session["userinsession"];
            var rolesList   = Application["RolesList"] as List <Roles>;
            var currentRole = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == user.Role.ToLower());

            if (ddlAction.SelectedValue == "Удалить")
            {
                DeleteAccess();
                foreach (ListViewDataItem items in lvAllTickets.Items)
                {
                    var chkBoxRows = (CheckBox)items.FindControl("cbSelect");

                    if (chkBoxRows.Checked)
                    {
                        var id        = (HiddenField)items.FindControl("hfID");
                        var ticketOld = new DAL.DataBaseObjects.Tickets
                        {
                            ID = Convert.ToInt32(id.Value)
                        };
                        ticketOld.GetById();
                        if (ticketOld.StatusID == 1 || user.Role == Users.Roles.Admin.ToString())
                        {
                            var ticket = new DAL.DataBaseObjects.Tickets();
                            ticket.Delete(Convert.ToInt32(id.Value), user.ID, OtherMethods.GetIPAddress(), "UserTicketNotProcessedView", ticketOld.FullSecureID);
                        }
                        else
                        {
                            lblNotif.Text      = "Были удалены заявки со статусом 'Не обработана'. Заявки с другими статусами удалить не возможно!";
                            lblNotif.ForeColor = Color.Red;
                        }
                    }
                }
            }



            if (ddlAction.SelectedValue == "Изменить статус")
            {
                foreach (ListViewDataItem items in lvAllTickets.Items)
                {
                    var chkBoxRows = (CheckBox)items.FindControl("cbSelect");

                    if (chkBoxRows.Checked)
                    {
                        var ticketId                 = (HiddenField)items.FindControl("hfID");
                        var currentDriverId          = (HiddenField)items.FindControl("hfDriverID");
                        var currentStatusDescription = (HiddenField)items.FindControl("hfStatusDescription");
                        var currentAdmissionDate     = (HiddenField)items.FindControl("hfAdmissionDate");
                        var currentStatusId          = (HiddenField)items.FindControl("hfStatusID");
                        var ticket = new DAL.DataBaseObjects.Tickets {
                            ID = Convert.ToInt32(ticketId.Value)
                        };
                        var errorText = TicketsFilter.StatusChangeFilter(ref ticket, currentDriverId.Value, currentStatusId.Value, currentStatusDescription.Value, currentAdmissionDate.Value, tbStatusDescription.Text, ddlStatus.SelectedValue, tbDeliveryDate.Text, currentRole);
                        if (errorText == null) //если ошибок после фильтрации нет - сохраняем заявку
                        {
                            ticket.Update(user.ID, OtherMethods.GetIPAddress(), "UserTicketView");
                        }
                        else //выводим все ошибки, если они есть
                        {
                            lblNotif.Text += String.Format("{0}<br/>", errorText);
                        }
                    }
                }
            }

            if (ddlAction.SelectedValue == "Печать чеков" ||
                ddlAction.SelectedValue == "Печать наклеек" ||
                ddlAction.SelectedValue == "Печать акта приема-передачи")
            {
                var idList = String.Empty;
                foreach (ListViewDataItem items in lvAllTickets.Items)
                {
                    var chkBoxRows = (CheckBox)items.FindControl("cbSelect");

                    if (chkBoxRows.Checked)
                    {
                        var id = (HiddenField)items.FindControl("hfID");
                        idList += id.Value + "-";
                    }
                }
                idList = idList.Remove(idList.Length - 1);
                if (ddlAction.SelectedValue == "Печать чеков")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintCheck.aspx?id={0}&page=userticketsnotprocessed&{1}", idList, OtherMethods.LinkBuilder(stbID.Text,
                                                                                                                                                                stbUID.Text, stbRecipientPhone.Text, shfCityID.Value, String.Empty, String.Empty, stbDeliveryDate1.Text, stbDeliveryDate2.Text,
                                                                                                                                                                sddlTracks.SelectedValue)));
                }

                if (ddlAction.SelectedValue == "Печать наклеек")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintVinil.aspx?id={0}", idList));
                }

                if (ddlAction.SelectedValue == "Печать акта приема-передачи")
                {
                    Response.Redirect(String.Format("~/PrintServices/PrintAORT.aspx?id={0}", idList));
                }
            }

            AddRowstoIDList();
        }