Ejemplo n.º 1
0
        public static void MailSend(String mailTitle, String mailSubject, String emailTo, bool async = false)
        {
            var message = new MailMessage
            {
                From = new MailAddress(MainEmail, NotOfficialName)
            };

            message.ReplyToList.Add(new MailAddress(MainEmail, NotOfficialName));
            if (!String.IsNullOrEmpty(emailTo))
            {
                message.To.Add(new MailAddress(emailTo));
            }
            if (message.To.Count == 0)
            {
                return;
            }
            message.Subject = "[" + BackendHelper.TagToValue("server_name") + "] " + mailTitle;
            message.Body    = mailSubject;
            if (!async)
            {
                client.Send(message);
            }
            else
            {
                client.SendAsync(message, null);
            }
        }
Ejemplo n.º 2
0
        public static void MailSend(Int32 mailId, String emailTo, String replaceThis, String replaceWithThat)
        {
            var message = new MailMessage
            {
                From = new MailAddress(MainEmail, NotOfficialName)
            };

            message.ReplyToList.Add(new MailAddress(MainEmail, NotOfficialName));
            message.To.Add(new MailAddress(emailTo));
            var mail = new EmailNotifications()
            {
                ID = mailId
            };

            mail.GetById();
            if (!String.IsNullOrEmpty(replaceThis) && !String.IsNullOrEmpty(replaceWithThat))
            {
                message.Subject = mail.Title.Replace(replaceThis, replaceWithThat);
                message.Body    = mail.Description.Replace(replaceThis, replaceWithThat);
            }
            else
            {
                message.Subject = "[" + BackendHelper.TagToValue("server_name") + "] " + mail.Title;
                message.Body    = mail.Description;
            }

            client.Send(message);
        }
Ejemplo n.º 3
0
        public static void MailSendHTML(String mailTitle, String mailSubject, String emailTo, String filePath, bool async = false)
        {
            var message = new MailMessage
            {
                From = new MailAddress(MainEmail, NotOfficialName)
            };

            message.ReplyToList.Add(new MailAddress(MainEmail, NotOfficialName));
            if (!String.IsNullOrEmpty(emailTo))
            {
                message.To.Add(new MailAddress(emailTo));
            }
            if (message.To.Count == 0)
            {
                return;
            }
            message.Subject = "[" + BackendHelper.TagToValue("server_name") + "] " + mailTitle;
            message.Body    = String.Format("<html><body>{0}</body></html>", mailSubject);
            message.Attachments.Add(new System.Net.Mail.Attachment(filePath));
            message.IsBodyHtml = true;

            // Тот SSL без которого не может Google Mail

            if (!async)
            {
                client.Send(message);
            }
            else
            {
                client.SendAsync(message, null);
            }
        }
Ejemplo n.º 4
0
        public static void MailSendHTML(String mailTitle, String mailSubject, string[] emailTo)
        {
            var message = new MailMessage
            {
                From = new MailAddress(MainEmail, NotOfficialName)
            };

            message.ReplyToList.Add(new MailAddress(MainEmail, NotOfficialName));
            foreach (var recipientEmail in emailTo)
            {
                if (!String.IsNullOrEmpty(recipientEmail))
                {
                    message.To.Add(new MailAddress(recipientEmail.Trim()));
                }
            }
            if (message.To.Count == 0)
            {
                return;
            }
            message.Subject    = "[" + BackendHelper.TagToValue("server_name") + "] " + mailTitle;
            message.Body       = String.Format("<html><body>{0}</body></html>", mailSubject);
            message.IsBodyHtml = true;

            client.Send(message);
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerSendComProp + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlDocuments", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlSendComProp", 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.PageSendComProp != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            if (Session["flash:now"] != null && Session["flash:now"].ToString() != String.Empty)
            {
                lblStatus.Text       = Session["flash:now"].ToString();
                Session["flash:now"] = String.Empty;
            }

            if (!IsPostBack)
            {
                var dm       = new DataManager();
                var category = dm.QueryWithReturnDataSet("SELECT * FROM `category` ORDER BY `Name` ASC");
                lvAllCategory.DataSource = category;
                lvAllCategory.DataBind();
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerCalculationView + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlMoney", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlCalculation", 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.PageCalculationView != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            if (!IsPostBack)
            {
                stbDeliveryDate1.Text = DateTime.Now.ToString("dd-MM-yyyy");
                if (!string.IsNullOrEmpty(Page.Request.Params["stateSave"]))
                {
                    if (!string.IsNullOrEmpty(Page.Request.Params["deliveryDate1"]))
                    {
                        stbDeliveryDate1.Text = Page.Request.Params["deliveryDate1"];
                    }

                    if (!string.IsNullOrEmpty(Page.Request.Params["deliveryDate2"]))
                    {
                        stbDeliveryDate2.Text = Page.Request.Params["deliveryDate2"];
                    }
                }
            }

            lblPage.Visible = false;
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerReportsExportTitle + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlDocuments", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlReportsExport", 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.PageReportsExport != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            if (currentRole.ActionExportAllUsersInfo == 1)
            {
                pnlActionExportAllUsersInfo.Visible = true;
            }

            if (currentRole.ActionExportAllUsersProfilesInfo == 1)
            {
                pnlActionExportAllUsersProfilesInfo.Visible = true;
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            OtherMethods.ActiveRightMenuStyleChanche("hlErrors", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlContent", this.Page);
            Page.Title = PagesTitles.ManagerErrorsLogEdit + BackendHelper.TagToValue("page_title_part");

            #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.PageErrorsLogEdit != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            var error = new ErrorsLog()
            {
                ID = Convert.ToInt32(Page.Request.Params["id"])
            };
            error.GetById();
            lblDate.Text      = error.Date.ToString();
            lblIP.Text        = error.IP;
            lblType.Text      = error.ErrorType;
            tbStackTrase.Text = error.StackTrase;
        }
Ejemplo n.º 9
0
        public void btnBlock_Click(Object sender, EventArgs e)
        {
            var id            = Page.Request.Params["id"];
            var userInSession = (Users)Session["userinsession"];
            var user          = new Users
            {
                ID     = Convert.ToInt32(id),
                Status = 3
            };

            user.Update(userInSession.ID, OtherMethods.GetIPAddress(), "ClientEdit");
            user.GetById();
            var emailNotification = new EmailNotifications {
                Name = "account_blocked"
            };

            emailNotification.GetByName();
            EmailMethods.MailSendHTML(
                emailNotification.Title,
                string.Format(emailNotification.Body,
                              BackendHelper.TagToValue("current_app_address"),
                              BackendHelper.TagToValue("not_official_name"),
                              BackendHelper.TagToValue("main_phones")),
                user.Email,
                true);
            Page.Response.Redirect(Request.RawUrl);
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerPagesEdit + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlPages", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlContent", 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.PagePagesEdit != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            if (Page.Request.Params["id"] != null)
            {
                var page = new Pages {
                    ID = Convert.ToInt32(Page.Request.Params["id"])
                };
                page.GetById();
                if (!IsPostBack)
                {
                    tbPageTitle.Text = page.PageTitle;
                    tbContent.Text   = page.Content;
                    tbPageName.Text  = page.PageName;
                }
            }
        }
Ejemplo n.º 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     OtherMethods.ActiveRightMenuStyleChanche("hlSouls", this.Page);
     OtherMethods.ActiveRightMenuStyleChanche("hlDistricts", this.Page);
     Page.Title = PagesTitles.ManagerDistrictsView + BackendHelper.TagToValue("page_title_part");
     PageAccess();
 }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerNotificationEdit + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlNotifications", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlContent", 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.PageNotificationsEdit != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            if (Page.Request.Params["id"] != null)
            {
                var note = new Notification {
                    ID = Convert.ToInt32(Page.Request.Params["id"])
                };
                note.GetById();
                if (!IsPostBack)
                {
                    if (string.IsNullOrEmpty(note.Title))
                    {
                        tbTitle.Visible  = false;
                        lblTitle.Visible = false;
                    }
                    tbTitle.Text            = note.Title;
                    tbBody.Text             = note.Description;
                    lblDescriptionMore.Text = note.DescriptionStatic;
                }
            }
        }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AppKey = Globals.Settings.AppServiceSecureKey;
            var userInSession = (Users)Session["userinsession"];

            UserID = userInSession.ID.ToString();
            if (userInSession.Role != Users.Roles.User.ToString())
            {
                hlManagerUI.Visible = true;
                liFeedback.Visible  = false;
            }

            var activatedProfilesCount = UserBasePage.ActivatedProfilesCount;

            if (String.IsNullOrEmpty(activatedProfilesCount) || Convert.ToInt32(activatedProfilesCount) == 0)
            {
                liTickets.Visible   = false;
                liDeveloper.Visible = false;
                liFeedback.Visible  = false;
            }

            if (BackendHelper.TagToValue("want_payment_enabled") != "true")
            {
                liWantPayment.Visible = false;
            }
            var page = new Pages {
                ID = 6
            };

            page.GetById();
            hlFAQ.Text         = page.PageTitle;
            hlSite.NavigateUrl = string.Format("http://{0}", BackendHelper.TagToValue("current_app_address"));
        }
Ejemplo n.º 14
0
        protected void btnRemember_OnClick(Object sender, EventArgs e)
        {
            var user = new Users {
                Email = tbEmail.Text
            };

            user.GetByEmail();
            if (!string.IsNullOrEmpty(user.Password) && user.Status != 1)
            {
                var    currentAppAddress = BackendHelper.TagToValue("current_admin_app_address");
                byte[] bytEmail          = System.Text.Encoding.UTF8.GetBytes(user.Email);
                var    link = user.Password + Convert.ToBase64String(bytEmail);
                var    text = String.Format("Ваш логин: {0}.<br/> Ссылка на восстановление пароля: <a href=\"http://{2}/changepassword/{1}\">http://{2}/changepassword/{1}</a>", user.Login, link, currentAppAddress);
                EmailMethods.MailSendHTML("Восстановление логина и пароля", text, tbEmail.Text);
                Response.Redirect("~/usernotification/5");
            }
            else
            {
                if (!string.IsNullOrEmpty(user.Password) && user.Status == 1)
                {
                    lblError.Visible = true;
                    lblError.Text    = "Пользователь еще не активирован!";
                }
                else
                {
                    lblError.Visible = true;
                    lblError.Text    = "Пользователь с таким Email не существует!";
                }
            }
        }
Ejemplo n.º 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     OtherMethods.ActiveRightMenuStyleChanche("hlCity", this.Page);
     OtherMethods.ActiveRightMenuStyleChanche("hlSouls", this.Page);
     Page.Title = PagesTitles.ManagerCityView + BackendHelper.TagToValue("page_title_part");
     PageAccess();
     AppKey = Globals.Settings.AppServiceSecureKey;
     if (!IsPostBack)
     {
         sddlDistricts.DataSource = (from t in City.Districts
                                     select new
         {
             Key = t.Key,
             Value = t.Value.Name
         }).OrderBy(u => u.Value);
         sddlDistricts.DataTextField  = "Value";
         sddlDistricts.DataValueField = "Key";
         sddlDistricts.DataBind();
         sddlDistricts.Items.Insert(0, new ListItem("Все", ""));
         if (!String.IsNullOrEmpty(Page.Request.Params["district"]))
         {
             sddlDistricts.SelectedValue = Page.Request.Params["district"].Trim();
         }
     }
 }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //SmsSender.SendSmsBulkIfTicketOnStock("37789");

            Page.Title = PagesTitles.UserDefaultTitle + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlMain", this.Page);
            var userInSession = (Users)Session["userinsession"];
            var user          = new Users
            {
                ID = UserID
            };

            user.GetById();
            lblUID.Text   = user.ID.ToString();
            lblEmail.Text = user.Email;
            lblLogin.Text = user.Login;

            if (user.ManagerID != 0)
            {
                trLogistian.Visible = true;

                var userLogistian = new Users()
                {
                    ID = Convert.ToInt32(user.ManagerID)
                };
                lblLogistian.Text = userLogistian.Name + ", тел. " + userLogistian.PhoneWorkOne;
            }

            if (user.SalesManagerID != 0)
            {
                trManager.Visible = true;

                var userManager = new Users()
                {
                    ID = Convert.ToInt32(user.SalesManagerID)
                };
                lblManager.Text = userManager.Family + " " + userManager.Name + ", тел. " + userManager.PhoneWorkOne;
            }

            if (user.AllowApi == 1)
            {
                trApiKey.Visible = true;
                lblApiKey.Text   = user.ApiKey;
            }
            if (user.Discount == 0)
            {
                tdDiscount.Visible = false;
            }
            else
            {
                lblDiscount.Text = user.Discount + "%";
            }

            DeliveryOnMinskPhones = BackendHelper.TagToValue("delivery_on_minsk_phones");
            DeliveryOnMinskSkype  = BackendHelper.TagToValue("delivery_on_minsk_skype");

            //пересчитываем просмотренные новости
            //обновляем\задаем авторизационную куку с данными пользователя
            AuthenticationMethods.SetUserCookie(userInSession);
        }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerReportsViewTitle + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlDocuments", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlReportsArchive", 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.PageReportsView != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            var pril3ViewAccessArray = BackendHelper.TagToValue("put_3_reports_access");
            pnlPutevoi3.Visible = pril3ViewAccessArray.Split(new[] { ',' }).Any(p => p.Trim().Contains(userInSession.ID.ToString()));

            if (!IsPostBack)
            {
                CbAct.Checked      = cbNaklPlil.Checked = cbPutevoi2.Checked = cbPutevoi1.Checked = cbZP.Checked = cbRasch.Checked = true;
                cbPutevoi3.Checked = pril3ViewAccessArray.Split(new[] { ',' }).Any(p => p.Trim().Contains(userInSession.ID.ToString()));
            }
        }
Ejemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerUsersDiscount + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlUsersDiscount", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlSettings", 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.PageUserDiscountView != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            if (!IsPostBack)
            {
                sddlStatus.DataSource     = Users.UserStatuses;
                sddlStatus.DataTextField  = "Value";
                sddlStatus.DataValueField = "Key";
                sddlStatus.DataBind();
                sddlStatus.Items.Insert(0, new ListItem("Все", string.Empty));

                sddlCourse.Items.Add(new ListItem("Да", "1"));
                sddlCourse.Items.Add(new ListItem("Нет", "0"));
                sddlCourse.Items.Insert(0, new ListItem("Все", string.Empty));

                if (Page.Request.Params["uid"] != null)
                {
                    stbUID.Text = Page.Request.Params["uid"];
                }
            }
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerBackendEdit + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlBackend", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlSettings", 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.PageBackendEdit != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            var backend = new Backend {
                ID = Convert.ToInt32(Page.Request.Params["id"])
            };
            backend.GetById();
            if (!IsPostBack)
            {
                lblTag.Text         = backend.Tag;
                lblDescription.Text = backend.Description;
                tbValue.Text        = backend.Value;
                var changeDate = OtherMethods.DateConvert(backend.ChangeDate.ToString());
                if (!String.IsNullOrEmpty(changeDate))
                {
                    pnlChangeDate.Visible = true;
                    lblChangeDate.Text    = changeDate;
                }
            }
        }
Ejemplo n.º 20
0
        public void btnActivate_Click(Object sender, EventArgs e)
        {
            var id      = Page.Request.Params["id"];
            var regUser = new Users {
                ID = Convert.ToInt32(id)
            };
            var userInSession = (Users)Session["userinsession"];
            //var newPassword = OtherMethods.CreateUniqId(DateTime.Now.ToString("yyMdHms"));
            var user = new Users
            {
                ID            = Convert.ToInt32(id),
                Status        = 2,
                ActivatedDate = DateTime.Now,
                Password      = regUser.Password
            };

            user.Update(userInSession.ID, OtherMethods.GetIPAddress(), "ClientEdit");
            user.GetById();
            var emailNotification = new EmailNotifications {
                Name = "account_activated"
            };

            emailNotification.GetByName();
            EmailMethods.MailSendHTML(
                emailNotification.Title,
                string.Format(emailNotification.Body,
                              user.Login,
                              regUser.Password,
                              BackendHelper.TagToValue("official_name"),
                              BackendHelper.TagToValue("current_app_address"),
                              BackendHelper.TagToValue("not_official_name")),
                user.Email, true);
            Page.Response.Redirect(Request.RawUrl);
        }
Ejemplo n.º 21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Page.Title = PagesTitles.ManagerErrorsLogView + BackendHelper.TagToValue("page_title_part");
     OtherMethods.ActiveRightMenuStyleChanche("hlErrors", this.Page);
     OtherMethods.ActiveRightMenuStyleChanche("hlContent", this.Page);
     PageAccess();
 }
Ejemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            OtherMethods.ActiveRightMenuStyleChanche("hlFeedback", this.Page);
            Page.Title = PagesTitles.UserFeedbackCreate + BackendHelper.TagToValue("page_title_part");
            if (String.IsNullOrEmpty(ActivatedProfilesCount) || Convert.ToInt32(ActivatedProfilesCount) == 0)
            {
                Response.Redirect("~/usernotification/12");
            }

            if (!IsPostBack)
            {
                ddlType.DataSource     = Feedback.Types;
                ddlType.DataTextField  = "Value";
                ddlType.DataValueField = "Key";
                ddlType.DataBind();
                if (Page.Request.Params["type"] != null && Page.Request.Params["type"] == "new_category")
                {
                    ddlType.SelectedValue = "2";
                }

                ddlPriority.DataSource     = Feedback.Priorities;
                ddlPriority.DataTextField  = "Value";
                ddlPriority.DataValueField = "Key";
                ddlPriority.DataBind();
            }
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            OtherMethods.ActiveRightMenuStyleChanche("hlMain", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlAnonymousMessage", this.Page);
            Page.Title = PagesTitles.ManagerAnonymousMessage + BackendHelper.TagToValue("page_title_part");

            lblEmalList.Text = BackendHelper.TagToValue("anonymous_message_email_list");
        }
Ejemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerClientCreateTitle + 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.PageClientsCreate != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            AppKey = Globals.Settings.AppServiceSecureKey;

            if (Session["flash:now"] != null && Session["flash:now"].ToString() != string.Empty)
            {
                lblStatus.Text       = Session["flash:now"].ToString();
                Session["flash:now"] = String.Empty;
            }

            var dm = new DataManager();
            if (!IsPostBack)
            {
                var dataSetForSalesManager = dm.QueryWithReturnDataSet("select * from `users` WHERE (role = 'SalesManager') and Status = 2 ORDER BY Family ASC, Name ASC;");
                dataSetForSalesManager.Tables[0].Columns.Add("FIO", typeof(string), "Family + ' ' + Name");
                ddlSalesManager.DataSource     = dataSetForSalesManager;
                ddlSalesManager.DataTextField  = "FIO";
                ddlSalesManager.DataValueField = "ID";
                ddlSalesManager.DataBind();
                ddlSalesManager.Items.Insert(0, new ListItem("Не назначен", "0"));

                ddlStatusStady.DataSource     = Users.UserStatusesStudy;
                ddlStatusStady.DataTextField  = "Value";
                ddlStatusStady.DataValueField = "Key";
                ddlStatusStady.DataBind();

                ddlProfileType.DataSource     = UsersProfiles.ProfileType;
                ddlProfileType.DataTextField  = "Value";
                ddlProfileType.DataValueField = "Key";
                ddlProfileType.DataBind();
                ddlProfileType.Items.Remove(ddlProfileType.Items.FindByValue("1"));


                ddlCompanyType.DataSource     = UsersProfiles.CompanyType;
                ddlCompanyType.DataTextField  = "Value";
                ddlCompanyType.DataValueField = "Key";
                ddlCompanyType.DataBind();
            }


            var category = dm.QueryWithReturnDataSet("SELECT * FROM `category` ORDER BY `Name` ASC");
            lvAllCategory.DataSource = category;
            lvAllCategory.DataBind();
        }
Ejemplo n.º 25
0
 public string WantPayment(string userid, string appkey)
 {
     if (appkey != Globals.Settings.AppServiceSecureKey)
     {
         return("invalid app key");
     }
     try
     {
         var          emails = BackendHelper.TagToValue("want_payment_address").Split(new[] { ',' });
         const string title  = "Поступил новый запрос на расчет";
         var          user   = new Users {
             ID = Convert.ToInt32(userid)
         };
         user.GetById();
         var body = String.Format("От клиента #{0} ({1} {2}, {3})", user.ID, user.Name, user.Family, user.Phone);
         EmailMethods.MailSend(title, body, emails); //отправка емейла кассирам
         var issuancelist = new IssuanceLists()
         {
             UserID = user.ID,
             IssuanceListsStatusID = 1,
             Comment = String.Format("Для клиента #{0} ({1} {2}, {3})", user.ID, user.Name, user.Family, user.Phone)
         };
         string result;
         if (DateTime.Now.Hour < 13)
         {
             issuancelist.IssuanceDate = DateTime.Now;
             result = "ok-now";
         }
         else
         {
             issuancelist.IssuanceDate = DateTime.Now.AddDays(1);
             result = "ok-tommorow";
         }
         issuancelist.Create();
         const string titleForUser = "******";
         var          titleForBody = "Для улучшения качества обслуживания по своевременному расчету по Вашим заявкам, " +
                                     "ввиду: погодных условий, несвоевременной явки клиентов и создания очередей, с 14.01 по 31.01.2016 года" +
                                     " внесены изменения в графике работы бухгалтерии: <br/>" +
                                     "• Заявки, оформленные до 13.00 – расчет на завтра;<br/>" +
                                     "• Заявки, оформленные после 13.00 – расчет на послезавтра;<br/>" +
                                     "В связи с этими изменениями ваша заявка на расчет будет обработана";
         if (result == "ok-tommorow")
         {
             titleForBody += " послезавтра, либо в ближайший рабочий день";
         }
         else
         {
             titleForBody += " завтра, либо в ближайший рабочий день";
         }
         EmailMethods.MailSendHTML(titleForUser, titleForBody, user.Email); //отправка емейла пользователю
         return(result);
     }
     catch (Exception)
     {
         return("invalid data");
     }
 }
Ejemplo n.º 26
0
        public void bntCreate_Click(Object sender, EventArgs e)
        {
            var      userInSession = (Users)Session["userinsession"];
            var      id            = Page.Request.Params["id"];
            Feedback feedback;

            try
            {
                feedback = new Feedback {
                    ID = Convert.ToInt32(id)
                };
                feedback.GetById();
            }
            catch (Exception)
            {
                feedback = new Feedback {
                    SecureID = id
                };
                feedback.GetBySecureID();
            }

            if (feedback.ID == 0)
            {
                feedback = new Feedback {
                    SecureID = id
                };
                feedback.GetBySecureID();
            }

            var feedbackcomment = new FeedbackComments()
            {
                Comment    = BbCode.BBcodeToHtml(tbComment.Text),
                FeedbackID = feedback.ID,
                UserID     = userInSession.ID,
                IsViewed   = 0
            };

            feedbackcomment.Create();
            feedback.ChangeDate = DateTime.Now;
            feedback.Update();
            var userToMail = new Users {
                ID = Convert.ToInt32(feedback.UserID)
            };

            userToMail.GetById();
            var messageBody = String.Format("<table class='table'>" +
                                            "<tr><td colspan='2' style='padding-bottom: 15px; vertical-align: top'>Поступил новый комментарий к вашему обращению <a href='http://{2}/UserUI/FeedbackView.aspx?id={3}' target='_new'><i>{0}</i></a></td></tr>" +
                                            "<tr><td style='vertical-align: top'>Содержание комментария:</td><td>{1}</td></tr>" +
                                            "<tr><td colspan='2' style='padding-top: 15px; vertical-align: top'>Перейдите по <a href='http://{2}/UserUI/FeedbackView.aspx?id={3}' target='new'>этой</a> ссылке для ответа на комментарий.</td></tr></table>",
                                            feedback.Title,
                                            feedbackcomment.Comment,
                                            BackendHelper.TagToValue("current_app_address"),
                                            feedback.ID);

            EmailMethods.MailSendHTML("Новый комментарий к вашему обращению", messageBody, userToMail.Email);
            Page.Response.Redirect("~/ManagerUI/Menu/Souls/FeedbackView.aspx?id=" + id);
        }
Ejemplo n.º 27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerCarView + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlCars", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlSouls", 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.PageCarView != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            if (Page.Request.Params["id"] != null)
            {
                if (!IsPostBack)
                {
                    var id  = Convert.ToInt32(Page.Request.Params["id"]);
                    var car = new Cars {
                        ID = id
                    };
                    car.GetById();
                    lblID.Text = car.ID.ToString();
                    var dm = new DataManager();
                    var driversForCarTable = dm.QueryWithReturnDataSet(String.Format("SELECT ID, FirstName, LastName, ThirdName FROM drivers WHERE CarID = {0}", id));
                    foreach (DataRow driver in driversForCarTable.Tables[0].Rows)
                    {
                        lblDrivers.Text += String.Format("<a href='DriversEdit.aspx?id={3}'>{0} {1}.{2}.</a>&nbsp; &nbsp;",
                                                         driver["FirstName"],
                                                         driver["LastName"].ToString().Remove(1, driver["LastName"].ToString().Length - 1),
                                                         driver["ThirdName"].ToString().Remove(1, driver["ThirdName"].ToString().Length - 1),
                                                         driver["ID"]);
                    }

                    lblType.Text   = CarsHelper.CarTypeToFullString(Convert.ToInt32(car.TypeID));
                    hfTypeID.Value = car.TypeID.ToString();
                    lblModel.Text  = car.Model;
                    lblNumber.Text = car.Number;

                    lblCompanyName.Text = car.CompanyName;

                    lblFirstName.Text           = car.FirstName;
                    lblLastName.Text            = car.LastName;
                    lblThirdName.Text           = car.ThirdName;
                    lblPassport.Text            = car.PassportSeria + car.PassportNumber;
                    lblPersonalNumber.Text      = car.PersonalNumber;
                    lblROVD.Text                = car.ROVD;
                    lblRegistrationAddress.Text = car.RegistrationAddress;
                    lblValidity.Text            = Convert.ToDateTime(car.Validity).ToString("dd-MM-yyyy");
                    lblBirthDay.Text            = Convert.ToDateTime(car.BirthDay).ToString("dd-MM-yyyy");
                    lblDateOfIssue.Text         = Convert.ToDateTime(car.DateOfIssue).ToString("dd-MM-yyyy");
                }
            }
        }
Ejemplo n.º 28
0
        public static bool IsApiAuthRequest()
        {
            var userIdString = HttpContext.Current.Request.Headers["userid"];
            var apiKey       = HttpContext.Current.Request.Headers["apikey"];

            //если в бекенде включен доступ к апи без ключа - пропускаем авторизацию
            if (BackendHelper.TagToValue("allow_unauth_api_request") == "true")
            {
                return(true);
            }
            if (String.IsNullOrEmpty(userIdString))
            {
                return(false);
            }
            if (String.IsNullOrEmpty(apiKey))
            {
                return(false);
            }

            int userId;

            if (!Int32.TryParse(userIdString, out userId))
            {
                return(false);
            }

            Users userById = new Users()
            {
                ID = userId
            };

            userById.GetById();

            if (userById.ApiKey != apiKey)
            {
                return(false);
            }

            var user = new Users {
                ID = userId
            };

            user.GetById();
            //если клиенту закрыт доступ к апи - выставляем false
            if (user.AllowApi == 0)
            {
                return(false);
            }
            //если клиент заблокирован - выставляем false
            if (user.Status == 1 || user.Status == 3)
            {
                return(false);
            }
            return(user.ApiKey == apiKey);
        }
Ejemplo n.º 29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerNewIssuanceViewTitle + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlIssuance", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlNewIssuanceView", this.Page);
            if (Session["flash:now"] != null && Session["flash:now"].ToString() != String.Empty)
            {
                lblStatus.Text       = Session["flash:now"].ToString();
                Session["flash:now"] = String.Empty;
            }

            #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.PageNewIssuanceView != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            var dm = new DataManager();

            var dataSet4 = dm.QueryWithReturnDataSet(String.Format("SELECT DISTINCT T.UserID FROM tickets T WHERE " + avaibleStatusesQuery + " ORDER BY T.UserID ASC"));
            sddlUID.DataSource     = dataSet4;
            sddlUID.DataTextField  = "UserID";
            sddlUID.DataValueField = "UserID";
            sddlUID.DataBind();
            sddlUID.Items.Insert(0, new ListItem("Все", string.Empty));

            var userIdExist = false;
            foreach (ListItem item in sddlUID.Items)
            {
                if (item.Value == Page.Request["ctl00$MainContent$sddlUID"] && userIdExist == false)
                {
                    userIdExist = true;
                }
            }
            if (userIdExist)
            {
                sddlUID.SelectedValue = Page.Request["ctl00$MainContent$sddlUID"];
            }
            //формируем форму поиска по водителю КОНЕЦ

            if (!IsPostBack)
            {
                sddlProfileType.DataSource     = DAL.DataBaseObjects.Tickets.ProfileType;
                sddlProfileType.DataTextField  = "Value";
                sddlProfileType.DataValueField = "Key";
                sddlProfileType.DataBind();
            }

            lblPage.Visible          = false;
            pnlSearschResult.Visible = false; //pnlActions.Visible =
        }
Ejemplo n.º 30
0
        public static String AgreedAccessedCostOver100BazVelich(string gruzobozCost)
        {
            var result       = string.Empty;
            var bazVelichina = Convert.ToDecimal(BackendHelper.TagToValue("baz_velichina_rb"));

            if (Convert.ToDecimal(gruzobozCost) >= bazVelichina * 100)
            {
                result = "tdAgreedAccessedCostOver100BazVelich";
            }
            return(result);
        }