コード例 #1
0
        public string SaveDeliveredForCity(string appkey, string ticketidlist, string userid, string userip, string pagename)
        {
            if (appkey != Globals.Settings.AppServiceSecureKey)
            {
                return("invalid app key");
            }
            var user = new Users {
                ID = Convert.ToInt32(userid)
            };

            user.GetById();
            var rolesList   = Application["RolesList"] as List <Roles>;
            var currentRole = rolesList.SingleOrDefault(u => u.Name.ToLower() == user.Role.ToLower());
            var idList      = ticketidlist.Split('-').ToList();

            foreach (var ticketid in idList)
            {
                var currentTicket = new Tickets {
                    ID = Convert.ToInt32(ticketid)
                };
                currentTicket.GetById();
                var updateTickket = new Tickets {
                    ID = Convert.ToInt32(ticketid)
                };
                TicketsFilter.StatusChangeFilter(ref updateTickket, currentTicket.DriverID.ToString(), currentTicket.StatusID.ToString(), currentTicket.StatusDescription, currentTicket.AdmissionDate.ToString(), null, "12", null, currentRole);
                updateTickket.Update(Convert.ToInt32(userid), userip, pagename);
            }

            return("OK");
        }
コード例 #2
0
        public string SaveMoneyStatuses(string statusid, string appkey, string ticketid, string userid, string userip, string pagename)
        {
            if (appkey != Globals.Settings.AppServiceSecureKey)
            {
                return("invalid app key");
            }

            var user = new Users {
                ID = Convert.ToInt32(userid)
            };

            user.GetById();
            var rolesList     = Application["RolesList"] as List <Roles>;
            var currentRole   = rolesList.SingleOrDefault(u => u.Name.ToLower() == user.Role.ToLower());
            var currentTicket = new Tickets {
                ID = Convert.ToInt32(ticketid)
            };

            currentTicket.GetById();
            var updateTickket = new Tickets {
                ID = Convert.ToInt32(ticketid)
            };

            var statusError = TicketsFilter.StatusChangeFilter(ref updateTickket, currentTicket.DriverID.ToString(), currentTicket.StatusID.ToString(), currentTicket.StatusDescription, currentTicket.AdmissionDate.ToString(), null, statusid, null, currentRole);

            if (statusError != null)
            {
                return(statusError);
            }

            updateTickket.Update(Convert.ToInt32(userid), userip, pagename);

            return("OK");
        }
コード例 #3
0
        protected void bCloseList_Click(object sender, EventArgs e)
        {
            var user        = (Users)Session["userinsession"];
            var rolesList   = Application["RolesList"] as List <Roles>;
            var currentRole = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == user.Role.ToLower());

            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, "", "6", "", currentRole);
                    if (errorText == null) //если ошибок после фильтрации нет - сохраняем заявку
                    {
                        ticket.Update(user.ID, OtherMethods.GetIPAddress(), "UserTicketView");
                    }
                    else //выводим все ошибки, если они есть
                    {
                        lblNotif.Text += String.Format("{0}<br/>", errorText);
                    }
                }
            }

            Response.Redirect(Request.ServerVariables["URL"]);
        }
コード例 #4
0
        public string SaveUSD(string money, string course, string appkey, string ticketid, string userid, string userip, string pagename)
        {
            if (appkey != Globals.Settings.AppServiceSecureKey)
            {
                return("invalid app key");
            }

            string statusError = null;
            var    user        = new Users {
                ID = Convert.ToInt32(userid)
            };

            user.GetById();
            var rolesList     = Application["RolesList"] as List <Roles>;
            var currentRole   = rolesList.SingleOrDefault(u => u.Name.ToLower() == user.Role.ToLower());
            var currentTicket = new Tickets {
                ID = Convert.ToInt32(ticketid)
            };

            currentTicket.GetById();
            var updateTickket = new Tickets {
                ID = Convert.ToInt32(ticketid)
            };

            if (currentTicket.ReceivedEUR == 0 && currentTicket.ReceivedBLR == 0 && currentTicket.ReceivedRUR == 0 && money == "0")
            {
                statusError = TicketsFilter.StatusChangeFilter(ref updateTickket, currentTicket.DriverID.ToString(), currentTicket.StatusID.ToString(), currentTicket.StatusDescription, currentTicket.AdmissionDate.ToString(), null, "3", null, currentRole);
            }
            else
            {
                if (currentTicket.StatusID != 5)
                {
                    var autoChangeProcessedStatus = BackendHelper.TagToValue("auto_change_processed_status");
                    if (autoChangeProcessedStatus == "true")
                    {
                        statusError = TicketsFilter.StatusChangeFilter(ref updateTickket, currentTicket.DriverID.ToString(), currentTicket.StatusID.ToString(), currentTicket.StatusDescription, currentTicket.AdmissionDate.ToString(), null, "5", null, currentRole);
                    }
                }
            }
            if (statusError != null)
            {
                return(statusError);
            }

            updateTickket.CourseUSD   = Convert.ToInt32(course) == 0 ? 1 : Convert.ToInt32(course);
            updateTickket.ReceivedUSD = Convert.ToInt32(money);
            updateTickket.Update(Convert.ToInt32(userid), userip, pagename);

            return("OK");
        }
コード例 #5
0
        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);
        }
コード例 #6
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();
        }
コード例 #7
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(), "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();
        }