public MemoryStream Create(string id) { int ID; if (Int32.TryParse(id, out ID)) { profile = new UsersProfiles { ID = ID }; profile.GetById(); switch (profile.TypeID) { case 1: return(CreateDocFiz()); case 2: return(CreateDocYur()); case 3: return(CreateDocInt()); } } return(null); }
public static String GetProfileContactPhone(string userProfileID) { var userProfile = new UsersProfiles { ID = Convert.ToInt32(userProfileID) }; userProfile.GetById(); var result = userProfile.ContactPhoneNumbers; if (!String.IsNullOrEmpty(result)) { result = result.Replace("+375 ", " "); } else { var user = new Users { ID = Convert.ToInt32(userProfile.UserID) }; user.GetById(); if (!String.IsNullOrEmpty(user.Phone)) { result = user.Phone.Replace("+375 ", " "); } } return(result ?? (result = String.Empty)); }
public static String GetProfileData(string userProfileID) { var userProfile = new UsersProfiles { ID = Convert.ToInt32(userProfileID) }; userProfile.GetById(); var result = userProfile.TypeID == 1 ? (userProfile.FirstName + ' ' + userProfile.LastName) : userProfile.CompanyName; return(result); }
protected void Page_Load(object sender, EventArgs e) { Page.Title = PagesTitles.UserProfileViewTitle + BackendHelper.TagToValue("page_title_part"); OtherMethods.ActiveRightMenuStyleChanche("hlProfile", this.Page); var id = Page.Request.Params["id"]; var profile = new UsersProfiles { ID = Convert.ToInt32(id) }; profile.GetById(); if (!IsPostBack) { lblFirstName.Text = profile.FirstName; lblLastName.Text = profile.LastName; lblThirdName.Text = profile.ThirdName; lblDirectorFIO.Text = String.Format("{0} {1} {2}", profile.FirstName, profile.LastName, profile.ThirdName); lblDirectorPhone.Text = profile.DirectorPhoneNumber; lblContactPersonFIO.Text = profile.ContactPersonFIO; lblContactPersonPhones.Text = profile.ContactPhoneNumbers; lblPassportData.Text = profile.PassportData; lblPassportNumber.Text = profile.PassportNumber; lblAddress.Text = profile.Address; lblCompanuName.Text = profile.CompanyName; lblCompanyAddress.Text = profile.CompanyAddress; lblBankName.Text = profile.BankName; lblBankAddress.Text = profile.BankCode; lblBankCode.Text = profile.BankCode; lblRS.Text = profile.RasShet; lblUNP.Text = profile.UNP; lblStatus.Text = UsersProfilesHelper.UserProfileStatusToText(Convert.ToInt32(profile.StatusID)); if (!String.IsNullOrEmpty(profile.RejectBlockedMessage) && profile.StatusID != 1 && profile.StatusID != 0) { pnlStatusDescription.Visible = true; lblStatusDescription.Text = profile.RejectBlockedMessage; } } if (profile.TypeID == 1) { pnlUr.Visible = false; pnlFiz.Visible = true; } else { pnlUr.Visible = true; pnlFiz.Visible = false; } }
public static String UserProfileIDToTicketEdit(int?userProfileID) { var result = String.Empty; var userProfile = new UsersProfiles { ID = Convert.ToInt32(userProfileID) }; userProfile.GetById(); //если профиль был удален if (userProfile.TypeID != null) { result = userProfile.TypeID.ToString() + userProfile.ID; } return(result); }
public string SaveCheckboxWithoutAkcizaValue(string boolchecked, string goodsid, string appkey, string ticketid, string userid, string userip, string pagename) { if (appkey != Globals.Settings.AppServiceSecureKey) { return("invalid app key"); } var goods = new Goods { ID = Convert.ToInt32(goodsid), WithoutAkciza = Convert.ToInt32(boolchecked) }; goods.Update(Convert.ToInt32(userid), userip, pagename); //1 var ticket = new Tickets { ID = Convert.ToInt32(ticketid) }; ticket.GetById(); //2 var newGoods = new Goods { TicketFullSecureID = ticket.FullSecureID }; var goodsDataSet = newGoods.GetAllItems("ID", "ASC", "TicketFullSecureID"); //3 var goodsList = (from DataRow row in goodsDataSet.Tables[0].Rows select new GoodsFromAPI { Description = row["Description"].ToString(), Number = Convert.ToInt32(row["Number"].ToString()), WithoutAkciza = Convert.ToInt32(row["WithoutAkciza"].ToString()) }).ToList(); var profile = new UsersProfiles { ID = Convert.ToInt32(ticket.UserProfileID) }; profile.GetById(); //4 var agreedAccessedCost = ticket.AgreedCost != 0 ? (ticket.AgreedCost).ToString() : (ticket.AssessedCost).ToString(); var gruzobozCost = Calculator.Calculate(goodsList, Convert.ToInt32(ticket.CityID), Convert.ToInt32(ticket.UserID), Convert.ToInt32(ticket.UserProfileID), profile.TypeID.ToString(), agreedAccessedCost); if (gruzobozCost != "0" && !String.IsNullOrEmpty(gruzobozCost)) { ticket.GruzobozCost = Convert.ToDecimal(gruzobozCost); ticket.Update(Convert.ToInt32(userid), userip, pagename); //5 } return("OK"); }
public static Int32 GetUserIdByUserProfileId(int userProfileId) { var result = 0; var userProfile = new UsersProfiles() { ID = userProfileId }; userProfile.GetById(); try { result = Convert.ToInt32(userProfile.UserID); } catch (Exception) { } return(result); }
public static String UserProfileToPhone(string id) { string result; if (String.IsNullOrEmpty(id)) { result = ""; } else { var userProfile = new UsersProfiles() { ID = Convert.ToInt32(id) }; userProfile.GetById(); result = userProfile.ContactPhoneNumbers; } return(result); }
public static String UserProfileIDToFamilyOrCompanyname(string id) { string result; if (String.IsNullOrEmpty(id)) { result = ""; } else { var userProfile = new UsersProfiles() { ID = Convert.ToInt32(id) }; userProfile.GetById(); result = userProfile.TypeID == 1 ? userProfile.LastName + " " + userProfile.FirstName : userProfile.CompanyName; } return(result); }
public static int?UserProfileIdToType(int id) { int?result; if (String.IsNullOrEmpty(id.ToString())) { result = 0; } else { var userProfile = new UsersProfiles() { ID = Convert.ToInt32(id) }; userProfile.GetById(); result = userProfile.TypeID; } return(result); }
protected void Page_Load(object sender, EventArgs e) { Page.Title = Page.Request.Params["id"] != null ? PagesTitles.UserProfileEditTitle + BackendHelper.TagToValue("page_title_part") : PagesTitles.UserProfileCreateTitle + BackendHelper.TagToValue("page_title_part"); OtherMethods.ActiveRightMenuStyleChanche("hlProfile", this.Page); OtherMethods.ActiveRightMenuStyleChanche("hlProfileCreate", this.Page); var id = Page.Request.Params["id"]; var profile = new UsersProfiles { ID = Convert.ToInt32(id), UserID = UserID }; btnEdit.Text = ButtonText; if (!IsPostBack) { ddlProfileType.DataSource = UsersProfiles.ProfileType; ddlProfileType.DataTextField = "Value"; ddlProfileType.DataValueField = "Key"; ddlProfileType.DataBind(); } if (!String.IsNullOrEmpty(id)) { if (!IsPostBack) { profile.GetById(); ddlProfileType.SelectedValue = profile.TypeID.ToString(); ddlProfileType.Enabled = false; if (ddlProfileType.SelectedValue == "1") { pnlUr.Visible = false; pnlFiz.Visible = true; } else { pnlUr.Visible = true; pnlFiz.Visible = false; } tbFirstName.Text = profile.FirstName; tbLastName.Text = profile.LastName; tbThirdName.Text = profile.ThirdName; tbFirstName2.Text = profile.FirstName; tbLastName2.Text = profile.LastName; tbThirdName2.Text = profile.ThirdName; tbPassportData.Text = profile.PassportData; tbPassportNumber.Text = profile.PassportNumber; tbAddress.Text = profile.Address; tbCompanuName.Text = profile.CompanyName; tbCompanyAddress.Text = profile.CompanyAddress; tbBankName.Text = profile.BankName; tbBankAddress.Text = profile.BankAddress; tbBankCode.Text = profile.BankCode; tbRS.Text = profile.RasShet; tbUNP.Text = profile.UNP; tbDirectorPhoneNumber.Text = profile.DirectorPhoneNumber; tbContactPersonFIO.Text = profile.ContactPersonFIO; tbPostAddress.Text = profile.PostAddress; tbPassportSeria.Text = profile.PassportSeria; tbPassportDate.Text = Convert.ToDateTime(profile.PassportDate).ToString("dd-MM-yyyy"); tbContactPhoneNumbers.Text = profile.ContactPhoneNumbers; tbContactPhoneNumbersFiz.Text = profile.ContactPhoneNumbers; if (!String.IsNullOrEmpty(profile.ContactPhoneNumbers) && profile.ContactPhoneNumbers.Length > 20) { tbContactPhoneNumbers2Fiz.Text = profile.ContactPhoneNumbers.Remove(0, 20); tbContactPhoneNumbers2.Text = profile.ContactPhoneNumbers.Remove(0, 20); } if (!String.IsNullOrEmpty(profile.RejectBlockedMessage) && profile.StatusID != 1 && profile.StatusID != 0) { pnlReject.Visible = true; lblRejectBlockedMessage.Text = profile.RejectBlockedMessage; } lblStatus.Text = UsersProfilesHelper.UserProfileStatusToText(Convert.ToInt32(profile.StatusID)); pnlStatus.Visible = true; } } }
public void bntEdit_Click(Object sender, EventArgs e) { var id = Page.Request.Params["id"]; var profile = new UsersProfiles { ID = Convert.ToInt32(id), UserID = UserID }; if (!String.IsNullOrEmpty(id)) { profile.GetById(); profile.ContactPersonFIO = tbContactPersonFIO.Text; profile.StatusID = 0; if (profile.TypeID == 1) { profile.PassportData = tbPassportData.Text; profile.PassportNumber = tbPassportNumber.Text; profile.FirstName = tbFirstName.Text; profile.LastName = tbLastName.Text; profile.ThirdName = tbThirdName.Text; profile.Address = tbAddress.Text; try { profile.PassportDate = Convert.ToDateTime(tbPassportDate.Text); } catch (Exception) { Page.Response.Redirect("~/usernotification/9"); } profile.PassportSeria = tbPassportSeria.Text; if (!String.IsNullOrEmpty(tbContactPhoneNumbers2Fiz.Text)) { profile.ContactPhoneNumbers = tbContactPhoneNumbersFiz.Text + ";" + tbContactPhoneNumbers2Fiz.Text; } else { profile.ContactPhoneNumbers = tbContactPhoneNumbersFiz.Text; } } else { profile.CompanyName = tbCompanuName.Text; profile.CompanyAddress = tbCompanyAddress.Text; profile.BankName = tbBankName.Text; profile.BankAddress = tbBankAddress.Text; profile.BankCode = tbBankCode.Text; profile.RasShet = tbRS.Text; profile.UNP = tbUNP.Text; profile.DirectorPhoneNumber = tbDirectorPhoneNumber.Text; profile.FirstName = tbFirstName2.Text; profile.LastName = tbLastName2.Text; profile.ThirdName = tbThirdName2.Text; profile.PostAddress = tbPostAddress.Text; if (!String.IsNullOrEmpty(tbContactPhoneNumbers2.Text)) { profile.ContactPhoneNumbers = tbContactPhoneNumbers.Text + ";" + tbContactPhoneNumbers2.Text; } else { profile.ContactPhoneNumbers = tbContactPhoneNumbers.Text; } } profile.Update(); } else { profile.TypeID = Convert.ToInt32(ddlProfileType.SelectedValue); profile.ContactPersonFIO = tbContactPersonFIO.Text; if (profile.TypeID == 1) { profile.PassportData = tbPassportData.Text; profile.PassportNumber = tbPassportNumber.Text; profile.FirstName = tbFirstName.Text; profile.LastName = tbLastName.Text; profile.ThirdName = tbThirdName.Text; profile.Address = tbAddress.Text; try { profile.PassportDate = Convert.ToDateTime(tbPassportDate.Text); } catch (Exception) { Page.Response.Redirect("~/usernotification/9"); } profile.PassportSeria = tbPassportSeria.Text; if (!String.IsNullOrEmpty(tbContactPhoneNumbers2Fiz.Text)) { profile.ContactPhoneNumbers = tbContactPhoneNumbersFiz.Text + ";" + tbContactPhoneNumbers2Fiz.Text; } else { profile.ContactPhoneNumbers = tbContactPhoneNumbersFiz.Text; } } else { profile.CompanyName = tbCompanuName.Text; profile.CompanyAddress = tbCompanyAddress.Text; profile.BankName = tbBankName.Text; profile.BankAddress = tbBankAddress.Text; profile.BankCode = tbBankCode.Text; profile.RasShet = tbRS.Text; profile.UNP = tbUNP.Text; profile.DirectorPhoneNumber = tbDirectorPhoneNumber.Text; profile.FirstName = tbFirstName2.Text; profile.LastName = tbLastName2.Text; profile.ThirdName = tbThirdName2.Text; profile.PostAddress = tbPostAddress.Text; if (!String.IsNullOrEmpty(tbContactPhoneNumbers2.Text)) { profile.ContactPhoneNumbers = tbContactPhoneNumbers.Text + ";" + tbContactPhoneNumbers2.Text; } else { profile.ContactPhoneNumbers = tbContactPhoneNumbers.Text; } } profile.Create(); var currentAppAddress = BackendHelper.TagToValue("current_app_address"); var sendEmailWhenProfileCreateArray = BackendHelper.TagToValue("send_email_when_profile_create"); var recipientEmailsList = sendEmailWhenProfileCreateArray.Split(new[] { ',' }); EmailMethods.MailSendHTML( String.Format("Новый профиль от пользователя #{0}", UserID), String.Format( "Пользователь <b>{0}</b> создал новый профиль. Для его просмотра и редактирования перейдите на <a href=\"http://{1}/ManagerUI/ProfilesView.aspx?uid={2}&stateSave=1\">страницу просмотра профилей</a>", UsersHelper.UserIDToFullName(UserID.ToString()), currentAppAddress, UserID), recipientEmailsList); } Page.Response.Redirect("~/UserUI/ProfilesView.aspx"); }
protected void Page_Load(object sender, EventArgs e) { Page.Title = PagesTitles.ManagerUserTicketEditTitle + BackendHelper.TagToValue("page_title_part"); OtherMethods.ActiveRightMenuStyleChanche("hlTickets", this.Page); Form.DefaultButton = btnCreate.UniqueID; AppKey = Globals.Settings.AppServiceSecureKey; FirstUserApiKey = Globals.Settings.FirstUserApiKey; #region Блок доступа к странице var userInSession = (Users)Session["userinsession"]; var rolesList = Application["RolesList"] as List <Roles>; var currentRole = Role = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == userInSession.Role.ToLower()); if (currentRole.PageUserTicketEdit != 1) { Response.Redirect("~/Error.aspx?id=1"); } #endregion #region Блок доступа к данным на странице IsVisibleUserProfileData = true; IsVisibleUserAccountData = true; if (currentRole.PageUserProfileView == 0) { IsVisibleUserProfileData = false; } if (currentRole.PageClientsView == 0) { IsVisibleUserAccountData = false; } trUserProfileData.Visible = IsVisibleUserProfileData; trUserAccountData.Visible = IsVisibleUserAccountData; #endregion #region едирект на страницу всех заявок если заявки нет if (Page.Request.Params["id"] == null || Page.Request.Params["id"] == String.Empty) { Page.Response.Redirect("~/ManagerUI/Menu/Tickets/UserTicketView.aspx"); } #endregion if (!IsPostBack) { #region Загрузка tickets по SecureID или FullSecureID. Метод на очистку. DAL.DataBaseObjects.Tickets ticket; if (Page.Request.Params["id"].Length > 7) { ticket = new DAL.DataBaseObjects.Tickets { FullSecureID = Page.Request.Params["id"] }; ticket.GetByFullSecureId(); } else { ticket = new DAL.DataBaseObjects.Tickets { SecureID = Page.Request.Params["id"] }; ticket.GetBySecureId(); } #endregion #region Создание форм для груза GoodsCount = GoodsHelper.GoodsCount(ticket.FullSecureID); hfHowManyControls.Value = GoodsCount.ToString(); AddGodsInPanel(GoodsCount); #endregion #region Заполнение созданных формы var goods = new Goods { TicketFullSecureID = ticket.FullSecureID }; var ds = goods.GetAllItems("ID", "ASC", "TicketFullSecureID"); var goodsIterator = 1; foreach (DataRow row in ds.Tables[0].Rows) { var tbGoodsDescription = (TextBox)pnlBooks.FindControl("tbGoodsDescription" + goodsIterator); var tbGoodsModel = (TextBox)pnlBooks.FindControl("tbGoodsModel" + goodsIterator); var tbGoodsNumber = (TextBox)pnlBooks.FindControl("tbGoodsNumber" + goodsIterator); var tbGoodsCost = (TextBox)pnlBooks.FindControl("tbGoodsCost" + goodsIterator); var hfGoodsID = (HiddenField)pnlBooks.FindControl("hfGoodsID" + goodsIterator); var hfWithoutAkciza = (HiddenField)pnlBooks.FindControl("hfWithoutAkciza" + goodsIterator); var hfGoodsNumber = (HiddenField)pnlBooks.FindControl("hfGoodsNumber" + goodsIterator); var hfGoodsCost = (HiddenField)pnlBooks.FindControl("hfGoodsCost" + goodsIterator); var hfGoodsDescription = (HiddenField)pnlBooks.FindControl("hfGoodsDescription" + goodsIterator); var hfGoodsModel = (HiddenField)pnlBooks.FindControl("hfGoodsModel" + goodsIterator); tbGoodsDescription.Text = hfGoodsDescription.Value = row["Description"].ToString(); tbGoodsModel.Text = hfGoodsModel.Value = row["Model"].ToString(); tbGoodsNumber.Text = hfGoodsNumber.Value = row["Number"].ToString(); tbGoodsCost.Text = hfGoodsCost.Value = MoneyMethods.MoneySeparator(row["Cost"].ToString()); hfGoodsID.Value = row["ID"].ToString(); hfWithoutAkciza.Value = row["WithoutAkciza"].ToString(); goodsIterator++; } #endregion #region Вывод старых грузов. Метод на очистку. if (GoodsCount == 0) { lblOldGoods.Visible = true; lblOldGoods.Text = "<b>" + OtherMethods.GoodsStringFromTicketID(ticket.ID.ToString()) + "</b><br/>"; } #endregion #region Инициализация сущностей var user = new Users(); user.ID = Convert.ToInt32(ticket.UserID); user.GetById(); #region Блок конфигурации удаления заявки if (currentRole.ActionUserTicketDelete != 1) { btnDelete.Visible = false; } #endregion var profile = new UsersProfiles(); profile.ID = Convert.ToInt32(ticket.UserProfileID); profile.GetById(); #endregion #region блок общей информации SpecialClient = user.SpecialClient; hfID.Value = ticket.ID.ToString(); hfDriverID.Value = ticket.DriverID.ToString(); hfStatusID.Value = ticket.StatusID.ToString(); hfStatusIDOld.Value = ticket.StatusIDOld.ToString(); hfStatusDescription.Value = ticket.StatusDescription; hfAdmissionDate.Value = ticket.AdmissionDate.ToString(); hfUserID.Value = UserID = ticket.UserID.ToString(); hfUserDiscount.Value = user.Discount.ToString(); hfUserProfileType.Value = profile.TypeID.ToString(); hfFullSecureID.Value = ticket.FullSecureID; lblID.Text = ticket.SecureID; hlUser.Text = user.Family + ' ' + user.Name; hlUser.NavigateUrl = "~/ManagerUI/Menu/Souls/ClientEdit.aspx?id=" + ticket.UserID; hlProfile.Text = profile.TypeID == 1 ? (profile.FirstName + ' ' + profile.LastName) : profile.CompanyName; hlProfile.NavigateUrl = "~/ManagerUI/Menu/Souls/ProfileView.aspx?id=" + ticket.UserProfileID; lblProfileType.Text = UsersProfilesHelper.UserProfileTypeToText(Convert.ToInt32(profile.TypeID)); lblCreateDate.Text = OtherMethods.DateConvert(ticket.CreateDate.ToString()); lblAdmissionDate.Text = OtherMethods.DateConvert(ticket.AdmissionDate.ToString()); lblDeliveryDateStatic.Text = OtherMethods.DateConvert(ticket.DeliveryDate.ToString()); lblIsExchange.Text = ticket.IsExchange == 0 ? "нет" : "да"; cbWithoutMoney.Checked = ticket.WithoutMoney != 0; lblNN.Text = ticket.PrintNaklInMap == 0 ? "нет" : "да"; lblPN.Text = ticket.PrintNakl == 0 ? "нет" : "да"; if (String.IsNullOrEmpty(ticket.Comment)) { tdComment.Visible = false; } else { lblComment.Text = WebUtility.HtmlDecode(ticket.Comment); } var regionText = CityHelper.CityToTrack(Convert.ToInt32(ticket.CityID), ticket.ID.ToString()); if (ticket.TrackIDUser != 0 || regionText == "Не задано") { ddlUserTrack.Visible = true; lblTrack.Visible = false; var region = new Tracks(); ddlUserTrack.DataSource = region.GetAllItems(); ddlUserTrack.DataTextField = "Name"; ddlUserTrack.DataValueField = "ID"; ddlUserTrack.DataBind(); ddlUserTrack.Items.Insert(0, new ListItem("Не задано", "0")); ddlUserTrack.SelectedValue = Convert.ToString(ticket.TrackIDUser); } else { lblTrack.Text = regionText; } if (string.IsNullOrEmpty(lblAdmissionDate.Text)) { lblAdmissionDate.Text = "Груз пока не на складе"; } #endregion #region блок информации, заполняемой пользователем AssessedCost = MoneyMethods.MoneySeparator(ticket.AssessedCost.ToString()); hfAssessedCost.Value = ticket.AssessedCost.ToString(); lblAssessedCost.Text = MoneyMethods.MoneySeparator(ticket.AssessedCost.ToString()); tbDeliveryCost.Text = MoneyMethods.MoneySeparator(ticket.DeliveryCost.ToString()); ddlRecipientStreetPrefix.SelectedValue = ticket.RecipientStreetPrefix; tbRecipientStreet.Text = ticket.RecipientStreet; tbRecipientStreetNumber.Text = ticket.RecipientStreetNumber; tbRecipientKorpus.Text = ticket.RecipientKorpus; tbRecipientKvartira.Text = ticket.RecipientKvartira; tbRecipientPhone.Text = ticket.RecipientPhone; tbRecipientPhone2.Text = ticket.RecipientPhoneTwo; ddlSenderStreetPrefix.SelectedValue = ticket.SenderStreetPrefix; tbSenderStreetName.Text = ticket.SenderStreetName; tbSenderStreetNumber.Text = ticket.SenderStreetNumber; tbSenderHousing.Text = ticket.SenderHousing; tbSenderApartmentNumber.Text = ticket.SenderApartmentNumber; tbNote.Text = ticket.Note; tbBoxesNumber.Text = string.IsNullOrEmpty(ticket.BoxesNumber.ToString()) ? "1" : ticket.BoxesNumber.ToString(); tbDeliveryDate.Text = Convert.ToDateTime(ticket.DeliveryDate).ToString("dd-MM-yyyy"); tbRecipientFirstName.Text = ticket.RecipientFirstName; tbRecipientLastName.Text = ticket.RecipientLastName; tbRecipientThirdName.Text = ticket.RecipientThirdName; tbTtnSeria.Text = ticket.TtnSeria; tbTtnNumber.Text = ticket.TtnNumber; tbOtherDocuments.Text = ticket.OtherDocuments; tbPassportNumber.Text = ticket.PassportNumber; tbPassportSeria.Text = ticket.PassportSeria; if (!String.IsNullOrEmpty(ticket.DeliveryCost.ToString()) && ticket.DeliveryCost != 0) { cbIsDeliveryCost.Checked = true; } //автокомплит наименования var titles = new Titles(); var availableTitles = titles.GetAllItems("Name", "ASC", null).Tables[0].Rows.Cast <DataRow>().Aggregate(String.Empty, (current, items) => current + ("\"" + items["Name"] + "\",")); AvailableTitles = availableTitles.Remove(availableTitles.Length - 1); #endregion #region Заполнение города var allCity = Application["CityList"] as List <City>; if (allCity != null) { tbCity.Text = CityHelper.CityIDToAutocompleteString(allCity.FirstOrDefault(u => u.ID == ticket.CityID)); hfCityID.Value = ticket.CityID.ToString(); var senderCity = allCity.First(u => u.ID == ticket.SenderCityID); tbSenderCity.Text = CityHelper.CityIDToAutocompleteString(senderCity); hfSenderCityID.Value = ticket.SenderCityID.ToString(); } #endregion hfWharehouse.Value = ticket.WharehouseId.ToString(); #region блок информации, заполняемой менеджером ddlStatus.DataSource = DAL.DataBaseObjects.Tickets.TicketStatuses; ddlStatus.DataTextField = "Value"; ddlStatus.DataValueField = "Key"; ddlStatus.DataBind(); ddlStatus.SelectedValue = Convert.ToString(ticket.StatusID); var ddrivers = new Drivers { StatusID = 1 }; var dataSet5 = ddrivers.GetAllActivatedDrivers(); dataSet5.Tables[0].Columns.Add("FIOAndID", typeof(string), "'(' + ID + ') ' + FirstName + ' ' + SUBSTRING(LastName,1,1) + '.' + SUBSTRING(ThirdName,1,1) + '.'"); ddlDrivers.DataSource = dataSet5; ddlDrivers.DataTextField = "FIOAndID"; ddlDrivers.DataValueField = "ID"; ddlDrivers.DataBind(); ddlDrivers.Items.Insert(0, new ListItem("Водитель не назначен", "0")); tbAgreedCost.Text = MoneyMethods.MoneySeparator(ticket.AgreedCost.ToString()); tbGruzobozCost.Text = MoneyMethods.MoneySeparator(ticket.GruzobozCost.ToString()); #region Блок блокировки полей if (currentRole.ActionControlGruzobozCost != 1) { tbGruzobozCost.Enabled = false; } if (currentRole.ActionStatusAdd != 1) { ddlStatus.Enabled = false; tbDeliveryDate.Enabled = false; tbStatusDescription.Enabled = false; } if (currentRole.ActionDriverAdd != 1) { ddlDrivers.Enabled = false; } if (currentRole.ActionAllowChangeMoneyAndCourse != 1) { tbAgreedCost.Enabled = false; tbGruzobozCost.Enabled = false; } #endregion //если id водителя 0 или -1 - водитель не назначен if (ticket.DriverID != 0 && ticket.DriverID != -1) { ddlDrivers.SelectedValue = ticket.DriverID.ToString(); } else { ddlDrivers.SelectedValue = "0"; } //если статусы На складе (перенесен), Отказ (у курьера), Возврат (на складе), Отмена (на складе), Отмена то показываем почему if (ddlStatus.SelectedValue == "7" || ddlStatus.SelectedValue == "8" || ddlStatus.SelectedValue == "4" || ddlStatus.SelectedValue == "9" || ddlStatus.SelectedValue == "10") { lblStatusDescription.Visible = true; tbStatusDescription.Visible = true; tbStatusDescription.Text = ticket.StatusDescription; } #endregion #region Ограничения на правку текстбоксов //если админ или статусы "Не обработана" или "На складе" или "На складе (перенесено)", или "Отмена" или "Отмена (на складе)" - можно изменять все поля пользователя if (currentRole.ActionDisallowEditSomeFieldInTickets != 1 && (ddlStatus.SelectedValue == "1" || ddlStatus.SelectedValue == "2" || ddlStatus.SelectedValue == "4" || ddlStatus.SelectedValue == "9" || ddlStatus.SelectedValue == "10") && currentRole.ActionDisallowTicketChangeWithoutManagerInfo != 1) { tbCity.Enabled = tbRecipientStreetNumber.Enabled = tbRecipientKorpus.Enabled = tbRecipientFirstName.Enabled = tbRecipientLastName.Enabled = tbRecipientThirdName.Enabled = tbRecipientKvartira.Enabled = tbRecipientPhone.Enabled = tbBoxesNumber.Enabled = tbDeliveryDate.Enabled = tbOtherDocuments.Enabled = tbTtnNumber.Enabled = tbTtnSeria.Enabled = tbPassportNumber.Enabled = tbPassportSeria.Enabled = tbRecipientPhone2.Enabled = tbRecipientStreet.Enabled = tbNote.Enabled = true; for (var i = 1; i <= GoodsCount; i++) { var tbGoodsDescription = (TextBox)pnlBooks.FindControl("tbGoodsDescription" + i); var tbGoodsModel = (TextBox)pnlBooks.FindControl("tbGoodsModel" + i); var tbGoodsNumber = (TextBox)pnlBooks.FindControl("tbGoodsNumber" + i); tbGoodsDescription.Enabled = true; tbGoodsModel.Enabled = true; tbGoodsNumber.Enabled = true; } } if (currentRole.ActionDisallowTicketChangeWithoutManagerInfo == 1) { ddlUserTrack.Enabled = false; tbRecipientFirstName.Enabled = false; tbRecipientLastName.Enabled = false; tbRecipientThirdName.Enabled = false; } //только админ может изменять курсы if (currentRole.ActionAllowChangeMoneyAndCourse == 1 && currentRole.ActionDisallowTicketChangeWithoutManagerInfo != 1) { cbIsDeliveryCost.Enabled = tbDeliveryCost.Enabled = true; for (var i = 1; i <= GoodsCount; i++) { var tbGoodsCost = (TextBox)pnlBooks.FindControl("tbGoodsCost" + i); tbGoodsCost.Enabled = true; } } #endregion } if (!String.IsNullOrEmpty(hfCityID.Value)) { var coefficientDeviationCost = Convert.ToDouble(BackendHelper.TagToValue("coefficient_deviation_cost")); var city = new City { ID = Convert.ToInt32(hfCityID.Value) }; city.GetById(); var district = new Districts { ID = Convert.ToInt32(city.DistrictID) }; district.GetById(); lblCityCost.Text = MoneyMethods.MoneySeparatorForCityTableView((city.DistanceFromCity * Convert.ToDecimal(coefficientDeviationCost)).ToString()); lblCityDeliveryDate.Text = DistrictsHelper.DeliveryDateStringToRuss(DistrictsHelper.DeliveryDateString(city.DistrictID)); lblCityDeliveryTerms.Text = DistrictsHelper.DeliveryTermsToRuss(DistrictsHelper.DeliveryTerms(city.DistrictID)); } }
protected void Page_Load(object sender, EventArgs e) { Page.Title = PagesTitles.ManagerProfileEditTitle + BackendHelper.TagToValue("page_title_part"); OtherMethods.ActiveRightMenuStyleChanche("hlSouls", this.Page); OtherMethods.ActiveRightMenuStyleChanche("hlClients", 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.PageUserProfileView != 1) { Response.Redirect("~/Error.aspx?id=1"); } #endregion #region блок всех текстбоксов (запрет редактирования) if (currentRole.PageUserProfileEdit != 1) { DisableControls(Page); } #endregion var id = Page.Request.Params["id"]; var profile = new UsersProfiles { ID = Convert.ToInt32(id) }; profile.GetById(); if (!IsPostBack) { lblProfileType.Text = UsersProfilesHelper.UserProfileTypeToText(Convert.ToInt32(profile.TypeID)); hfProfileType.Value = profile.TypeID.ToString(); lblStatus.Text = UsersProfilesHelper.UserProfileStatusToText(Convert.ToInt32(profile.StatusID)); if (currentRole.ActionUserProfileChangeStatus != 1) { btnActivate.Visible = btnBlock.Visible = btnReject.Visible = false; } switch (profile.StatusID) { case 1: btnActivate.Visible = false; break; case 2: btnReject.Visible = false; break; case 3: btnBlock.Visible = false; break; } } if (!String.IsNullOrEmpty(id)) { if (!IsPostBack) { if (profile.TypeID == 1) { pnlUr.Visible = false; pnlFiz.Visible = true; } else { pnlUr.Visible = true; pnlFiz.Visible = false; } if (profile.TypeID == 2 || profile.TypeID == 3) { trProfileTypeDdl.Visible = true; trProfileTypeLbl.Visible = false; ddlProfileType.DataSource = UsersProfiles.ProfileType; ddlProfileType.DataTextField = "Value"; ddlProfileType.DataValueField = "Key"; ddlProfileType.DataBind(); ddlProfileType.Items.Remove(ddlProfileType.Items.FindByValue("1")); ddlProfileType.SelectedValue = profile.TypeID.ToString(); } tbFirstName.Text = profile.FirstName; tbLastName.Text = profile.LastName; tbThirdName.Text = profile.ThirdName; tbFirstName2.Text = profile.FirstName; tbLastName2.Text = profile.LastName; tbThirdName2.Text = profile.ThirdName; tbPassportData.Text = profile.PassportData; tbPassportNumber.Text = profile.PassportNumber; tbAddress.Text = profile.Address; tbCompanuName.Text = profile.CompanyName; tbCompanyAddress.Text = profile.CompanyAddress; tbBankName.Text = profile.BankName; tbBankAddress.Text = profile.BankAddress; tbBankCode.Text = profile.BankCode; tbRS.Text = profile.RasShet; tbUNP.Text = profile.UNP; tbDirectorPhoneNumber.Text = profile.DirectorPhoneNumber; tbContactPersonFIO.Text = profile.ContactPersonFIO; tbPostAddress.Text = profile.PostAddress; tbPassportSeria.Text = profile.PassportSeria; tbPassportDate.Text = Convert.ToDateTime(profile.PassportDate).ToString("dd-MM-yyyy"); tbAgreementDate.Text = Convert.ToDateTime(profile.AgreementDate).ToString("dd-MM-yyyy"); tbAgreementNumber.Text = profile.AgreementNumber; lblClientId.Text = profile.UserID.ToString(); tbContactPhoneNumbers.Text = profile.ContactPhoneNumbers; tbContactPhoneNumbersFiz.Text = profile.ContactPhoneNumbers; if (!String.IsNullOrEmpty(profile.ContactPhoneNumbers) && profile.ContactPhoneNumbers.Length > 20) { tbContactPhoneNumbers2Fiz.Text = profile.ContactPhoneNumbers.Remove(0, 20); tbContactPhoneNumbers2.Text = profile.ContactPhoneNumbers.Remove(0, 20); } tbRejectBlockedMessage.Text = profile.RejectBlockedMessage; } } if (currentRole.ActionUserProfileDelete != 1) { btnDeleteProfile.Visible = false; } }
public void UpdateProfile(int?profileStatus) { var id = Page.Request.Params["id"]; var userInSession = (Users)Session["userinsession"]; var profile = new UsersProfiles { ID = Convert.ToInt32(id) }; profile.GetById(); profile.ContactPersonFIO = tbContactPersonFIO.Text; profile.RejectBlockedMessage = tbRejectBlockedMessage.Text; if (profile.TypeID == 1) { profile.PassportData = tbPassportData.Text; profile.PassportNumber = tbPassportNumber.Text; profile.FirstName = tbFirstName.Text; profile.LastName = tbLastName.Text; profile.ThirdName = tbThirdName.Text; profile.Address = tbAddress.Text; try { profile.PassportDate = Convert.ToDateTime(tbPassportDate.Text); } catch (Exception) { Page.Response.Redirect("~/usernotification/9"); } profile.PassportSeria = tbPassportSeria.Text; if (!String.IsNullOrEmpty(tbContactPhoneNumbers2Fiz.Text)) { profile.ContactPhoneNumbers = tbContactPhoneNumbersFiz.Text + ";" + tbContactPhoneNumbers2Fiz.Text; } else { profile.ContactPhoneNumbers = tbContactPhoneNumbersFiz.Text; } } else { profile.CompanyName = tbCompanuName.Text.Replace("\"", "''"); profile.CompanyAddress = tbCompanyAddress.Text; profile.BankName = tbBankName.Text; profile.BankAddress = tbBankAddress.Text; profile.BankCode = tbBankCode.Text; profile.RasShet = tbRS.Text; profile.UNP = tbUNP.Text; profile.DirectorPhoneNumber = tbDirectorPhoneNumber.Text; profile.FirstName = tbFirstName2.Text; profile.LastName = tbLastName2.Text; profile.ThirdName = tbThirdName2.Text; profile.PostAddress = tbPostAddress.Text; if (trProfileTypeDdl.Visible) { profile.TypeID = Convert.ToInt32(ddlProfileType.SelectedValue); } if (!String.IsNullOrEmpty(tbContactPhoneNumbers2.Text)) { profile.ContactPhoneNumbers = tbContactPhoneNumbers.Text + ";" + tbContactPhoneNumbers2.Text; } else { profile.ContactPhoneNumbers = tbContactPhoneNumbers.Text; } } if (profileStatus != null) { profile.StatusID = profileStatus; } try { profile.AgreementDate = Convert.ToDateTime(tbAgreementDate.Text); } catch (Exception) { Page.Response.Redirect("~/usernotification/9"); } profile.AgreementNumber = tbAgreementNumber.Text; profile.Update(userInSession.ID, OtherMethods.GetIPAddress(), "ProfileEdit"); Page.Response.Redirect("~/ManagerUI/Menu/Souls/ClientsView.aspx"); }
protected void Page_Load(object sender, EventArgs e) { AppKey = Globals.Settings.AppServiceSecureKey; var controlTicketID = String.Empty; var idListString = Request.QueryString["id"]; if (!String.IsNullOrEmpty(idListString)) { List <string> idList = idListString.Split('-').ToList(); var sqlString = String.Empty; foreach (var id in idList) { sqlString = sqlString + "T.ID = " + id + " OR "; controlTicketID = id; } var dm = new DataManager(); var fullSqlString = "SELECT * FROM `tickets` as T WHERE " + sqlString.Remove(sqlString.Length - 3) + "ORDER BY T.CreateDate ASC"; var ds = dm.QueryWithReturnDataSet(fullSqlString); Iterator = 1; ds.Tables[0].Columns.Add("PNumber", typeof(String)); ds.Tables[0].Columns.Add("Ttn", typeof(String)); ds.Tables[0].Columns.Add("Sender", typeof(String)); ds.Tables[0].Columns.Add("Date", typeof(String)); ds.Tables[0].Columns.Add("SendDate", typeof(String)); ds.Tables[0].Columns.Add("GoodsModel", typeof(String)); int ticketUserID; DataRow rowFirst = ds.Tables[0].Rows[0]; Int32.TryParse(rowFirst["UserProfileID"].ToString(), out ticketUserID); UsersProfiles customer = new UsersProfiles { ID = ticketUserID }; customer.GetById(); #region Сообщение, если выбран не один UID int ticketUserCheckID; Int32.TryParse(rowFirst["UserID"].ToString(), out ticketUserCheckID); UserID = ticketUserCheckID; UserName = string.Concat(new string[] { customer.FirstName, " ", customer.LastName }); /*if (String.IsNullOrEmpty(idListString) || ticketsCount == 0) * { * Page.Visible = false; * if (String.IsNullOrEmpty(idListString)) * { * Response.Write(Resources.PrintResources.PrintNaklEmptyText); * } * else * { * Response.Write(Resources.PrintResources.PrintNaklEmptyText + * String.Format("<br/><center><a href=\"{0}&with_ur=1\">печать с юр. лицами</a><center>", Request.RawUrl)); * } * }*/ int ticketRowUserId; int errorIndex = 0; foreach (DataRow row in ds.Tables[0].Rows) { Int32.TryParse(row["UserID"].ToString(), out ticketRowUserId); if (ticketUserCheckID != ticketRowUserId) { errorIndex = 1; Page.Visible = false; } } if (customer.TypeID != 2 && customer.TypeID != 3) { if (errorIndex == 1) { errorIndex = 3; } else { errorIndex = 2; } Page.Visible = false; } switch (errorIndex) { case 1: Response.Write(Resources.PrintResources.PrintActRequisitesEmptyText + String.Format("<br/><center><a href=\"{0}&with_ur=1\">Введите заявки с одним UID</a><center>", Request.RawUrl)); break; case 2: Response.Write(Resources.PrintResources.PrintActRequisitesEmptyText + String.Format("<br/><center><a href=\"{0}&with_ur=1\">Введите заявки с юр. лицами и интернет магазинами </a><center>", Request.RawUrl)); break; case 3: Response.Write(Resources.PrintResources.PrintActRequisitesEmptyText + String.Format("<br/><center><a href=\"{0}&with_ur=1\">Введите заявки с одним UID юр. лицами и интернет магазинами </a><center>", Request.RawUrl)); break; } #endregion double costSum = 0; double cost = 0; nameExecuter.Text = BackendHelper.TagToValue("official_name"); infoExecuter.Text = BackendHelper.TagToValue("ExecutorInfo"); UNPExecuter.Text = BackendHelper.TagToValue("ttn_sender_unp"); dateAct.Text = InputDateAct.Text = OtherMethods.DateConvert(DateTime.Today.ToString()); numberContract.Text = customer.AgreementNumber; dateContract.Text = OtherMethods.DateConvert(customer.CreateDate.ToString()); customerCompanyName.Text = customer.CompanyName; customerCompanyAddress.Text = customer.CompanyAddress; customerRasShet.Text = customer.RasShet; customerBankName.Text = customer.BankName; customerBankAddress.Text = customer.BankAddress; customerContactPhoneNumbers.Text = customer.ContactPhoneNumbers; customerUNP.Text = customer.UNP; foreach (DataRow row in ds.Tables[0].Rows) { row["PNumber"] = Iterator++; row["Ttn"] = string.Concat(new string[] { row["TtnSeria"].ToString().ToUpper(), row["TtnNumber"].ToString() }); string recipientKorpus = null; if (!String.IsNullOrEmpty(row["RecipientKorpus"].ToString())) { recipientKorpus = string.Concat(new string[] { "/", row["RecipientKorpus"].ToString() }); } row["Sender"] = CityHelper.CityIDToCityName(row["CityID"].ToString()); row["Date"] = OtherMethods.DateConvert(row["CreateDate"].ToString()); row["SendDate"] = OtherMethods.DateConvert(row["DeliveryDate"].ToString()); var goodsQueryString = "SELECT * FROM `goods` WHERE TicketFullSecureId = " + "'" + row["FullSecureId"].ToString() + "'"; var dmGoods = new DataManager(); var dsGoods = dmGoods.QueryWithReturnDataSet(goodsQueryString); foreach (DataRow rowGoods in dsGoods.Tables[0].Rows) { row["GoodsModel"] += rowGoods["Model"].ToString(); } double.TryParse(row["GruzobozCost"].ToString(), out cost); Type c = row["GruzobozCost"].GetType(); costSum += cost; } LabelSum1.Text = costSum.ToString("0.00"); LabelSum2.Text = costSum.ToString("0.00"); lvAllPrint.DataSource = ds; lvAllPrint.DataBind(); /* * List<string> idList = idListString.Split('-').ToList(); * var sqlString = String.Empty; * foreach (var id in idList) * { * sqlString = sqlString + "T.ID = " + id + " OR "; * controlTicketID = id; * } * * bool withoutDriver = false; * * var fullSqlString = "SELECT * FROM `tickets` as T JOIN `city` as C on T.CityID = C.ID WHERE " + sqlString.Remove(sqlString.Length - 3) + "ORDER BY C.Name ASC"; * var dm = new DataManager(); * var dataset = dm.QueryWithReturnDataSet(fullSqlString); * Iterator = 1; * dataset.Tables[0].Columns.Add("PNumber", typeof(String)); * foreach (DataRow row in dataset.Tables[0].Rows) * { * row["PNumber"] = Iterator++; * //row["CreateDate"] = OtherMethods.DateConvert(Eval("CreateDate").ToString()); * var driverID = row["DriverID"].ToString(); * if ((driverID == "0" || driverID == "-1") && withoutDriver == false) * { * withoutDriver = true; * } * } * lvAllPrint.DataSource = dataset; * lvAllPrint.DataBind(); * * var ticket = new Tickets { ID = Convert.ToInt32(controlTicketID) }; * ticket.GetById(); * * if (withoutDriver==false) * { * DriverName = lblDriver.Text = DriversHelper.DriverIDToFioToPrint(ticket.DriverID.ToString()); * } * else * { * DriverName = lblDriver.Text = String.Empty; * } * * lblTrack.Text= lblTrack2.Text = CityHelper.CityToTrack(Convert.ToInt32(ticket.CityID), ticket.ID.ToString()); * lblOperatorName.Text = CityHelper.CityToTrackOperatorName(Convert.ToInt32(ticket.CityID)); * lblOperatorPhone.Text = CityHelper.CityToTrackOperatorPhone(Convert.ToInt32(ticket.CityID)); * Inpdate.Text = * dm.QueryWithReturnDataSet("SELECT `MapDate` FROM `printdata`").Tables[0].Rows[0][0] * .ToString(); */ } if (String.IsNullOrEmpty(idListString) || lvAllPrint.Items.Count == 0) { Page.Visible = false; Response.Write(Resources.PrintResources.PrintMapEmptyText); } }