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"); }
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"); }
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"]); }
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"); }
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); }
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(); }
public void bntCreate_Click(Object sender, EventArgs e) { #region Инициализация объектов var user = (Users)Session["userinsession"]; var rolesList = Application["RolesList"] as List <Roles>; var currentRole = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == user.Role.ToLower()); var withoutMoney = Convert.ToInt32(cbWithoutMoney.Checked); var tbAgreedCostValue = 0.00; double.TryParse(tbAgreedCost.Text, out tbAgreedCostValue); var tbGruzobozCostValue = 0.00; double.TryParse(tbGruzobozCost.Text, out tbGruzobozCostValue); var tbDeliveryCostValue = 0.00; double.TryParse(tbDeliveryCost.Text, out tbDeliveryCostValue); var ticket = new DAL.DataBaseObjects.Tickets { ID = Convert.ToInt32(hfID.Value), ChangeDate = DateTime.Now, DeliveryDate = Convert.ToDateTime(tbDeliveryDate.Text), AgreedCost = Convert.ToDecimal(tbAgreedCostValue), Note = tbNote.Text, RecipientStreetPrefix = ddlRecipientStreetPrefix.SelectedValue, RecipientStreet = TicketsHelper.RecipientStreetCleaner(tbRecipientStreet.Text), RecipientStreetNumber = tbRecipientStreetNumber.Text, RecipientKorpus = tbRecipientKorpus.Text, RecipientKvartira = tbRecipientKvartira.Text, BoxesNumber = Convert.ToInt32(tbBoxesNumber.Text), RecipientFirstName = tbRecipientFirstName.Text, RecipientLastName = tbRecipientLastName.Text, RecipientThirdName = tbRecipientThirdName.Text, TtnNumber = tbTtnNumber.Text, TtnSeria = tbTtnSeria.Text, OtherDocuments = tbOtherDocuments.Text, RecipientPhone = tbRecipientPhone.Text, RecipientPhoneTwo = tbRecipientPhone2.Text, PassportNumber = tbPassportNumber.Text, PassportSeria = tbPassportSeria.Text, DeliveryCost = cbIsDeliveryCost.Checked ? Convert.ToDecimal(tbDeliveryCostValue) : 0, CityID = Convert.ToInt32(hfCityID.Value), SenderCityID = Convert.ToInt32(hfSenderCityID.Value), SenderStreetName = tbSenderStreetName.Text, SenderStreetNumber = tbSenderStreetNumber.Text, SenderStreetPrefix = ddlSenderStreetPrefix.SelectedValue, SenderHousing = tbSenderHousing.Text, SenderApartmentNumber = tbSenderApartmentNumber.Text, WithoutMoney = withoutMoney, NoteChanged = !string.IsNullOrEmpty(Page.Request.Params["id"]) ? 1 : 0 }; Delivery.DAL.DataBaseObjects.Tickets checkTicket = new Delivery.DAL.DataBaseObjects.Tickets(); checkTicket.ID = ticket.ID; checkTicket.GetById(); if (new UserCost().GetCostByUserID(checkTicket.UserID) == null || Convert.ToDecimal(tbGruzobozCostValue) == 0) { ticket.GruzobozCost = Convert.ToDecimal(tbGruzobozCostValue); } //метод на удаление (переход со старой системы заявок) if (!lblOldGoods.Visible) { ticket.AssessedCost = GetAssessedCost(); } #endregion if (ddlUserTrack.Visible) { ticket.TrackIDUser = Convert.ToInt32(ddlUserTrack.SelectedValue); } #region Обнуление соглассованной стоимости и за доставку при соответствующих условиях if (cbAgreedCostIsNull.Checked) { ticket.AgreedCost = 0; } if (cbDeliveryCostIsNull.Checked) { ticket.DeliveryCost = 0; } #endregion #region Запись города ticket.CityID = Convert.ToInt32(hfCityID.Value); #endregion #region Проверки на валидность, фильтрация статуса и курьера if (lblAdmissionDate.Text == String.Empty) { AddGodsInPanel(Convert.ToInt32(hfHowManyControls.Value)); lblError.Text = "Введите дату!"; return; } if (String.IsNullOrEmpty(hfCityID.Value)) { AddGodsInPanel(Convert.ToInt32(hfHowManyControls.Value)); lblError.Text = "Выберите населенный пункт!"; return; } var errorText = TicketsFilter.OverChangeFilter(ref ticket, hfDriverID.Value, hfStatusID.Value, hfStatusDescription.Value, hfAdmissionDate.Value, tbStatusDescription.Text, ddlStatus.SelectedValue, tbDeliveryDate.Text, ddlDrivers.SelectedValue, hfStatusIDOld.Value, currentRole); if (errorText != null) { AddGodsInPanel(Convert.ToInt32(hfHowManyControls.Value)); lblError.Text = errorText; return; } #endregion if (hfWharehouse.Value != "") { int whVal = 0; if (Int32.TryParse(hfWharehouse.Value, out whVal)) { ticket.WharehouseId = whVal; } } ticket.Update(user.ID, OtherMethods.GetIPAddress(), "UserTicketEdit"); GoodsCount = GoodsHelper.GoodsCount(hfFullSecureID.Value); UpdateGoods(GoodsCount, user.ID); FinalyRedirect(); }
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(); }