示例#1
0
        public void lbDefault_Click(Object sender, EventArgs e)
        {
            var lb = (LinkButton)sender;
            var profileOldDefault = new UsersProfiles
            {
                UserID    = UserID,
                IsDefault = 1
            };

            profileOldDefault.GetByUserIDAndDefault();
            profileOldDefault.IsDefault = 0;
            profileOldDefault.Update();
            var profile = new UsersProfiles {
                IsDefault = 1, ID = Convert.ToInt32(lb.CommandArgument)
            };

            profile.Update();
            Page.Response.Redirect("~/UserUI/ProfilesView.aspx");
        }
示例#2
0
        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");
        }
示例#3
0
        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");
        }