Exemplo n.º 1
0
        //View MainMenu
        #region ViewMainModules
        public DataTable ViewMainModules(string AdminName)
        {
            DataTable dataTable = new DataTable();
            AdminBSO  adminBSO  = new AdminBSO();
            Admin     admin     = adminBSO.GetAdminById(AdminName);

            RolesBSO rolesBSO   = new RolesBSO();
            IRoles   roles      = rolesBSO.GetRolesById(admin.RolesID);
            string   strModules = roles.RolesModules;

            strModules = strModules.Replace(",", "','");
            ModulesBSO modulesBSO = new ModulesBSO();
            DataTable  table      = modulesBSO.MixModules();

            if (AdminName.Equals("administrator"))
            {
                dataTable = table;
            }
            else
            {
                DataView dataView = new DataView(table);
                dataView.RowFilter = "Slug in ('" + strModules + "')";
                dataView.Sort      = "Modules_ID ASC";
                dataTable          = dataView.ToTable();
            }

            return(dataTable);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.RouteData.Values["dll"] != null)
                NavigationTitle(Page.RouteData.Values["dll"].ToString());

            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
            {
                btn_editpage.Visible = true;
                btn_enable.Visible = true;
                btn_disable.Visible = true;
                btn_delall.Visible = true;

            }
            else
            {
                btn_editpage.Visible = false;
                btn_enable.Visible = false;
                btn_disable.Visible = false;
                btn_delall.Visible = false;
            }

            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
            {
                btn_enable_approval.Visible = true;
                btn_disable_approval.Visible = true;

            }
            else
            {
                btn_enable_approval.Visible = false;
                btn_disable_approval.Visible = false;
            }

            int group = 0;
            if (!String.IsNullOrEmpty(Page.RouteData.Values["group"].ToString()))
                if (!int.TryParse(Page.RouteData.Values["group"].ToString().Replace(",", ""), out group))
                    Response.Redirect("~/Admin/home/Default.aspx");

            if (group == 0)
                Response.Redirect("~/Admin/home/Default.aspx");
            else
            {
                hddGroup.Value = Convert.ToString(group);

                if (!IsPostBack)
                {

                    ViewCompany(group);

                }
            }


        }
Exemplo n.º 3
0
 protected void ViewAdmin()
 {
     AdminBSO adminBSO = new AdminBSO();
     DataTable table = adminBSO.GetAllAdminRoles();
     DataView dataView = new DataView(table);
     //dataView.RowFilter = "Admin_Username <> 'administrator' and Admin_Username <> 'Administrator'";
     dataView.RowFilter = "Admin_Username not in ('administrator','Administrator')";
     dataView.Sort = "Admin_Username ASC";
     DataTable dataTable = dataView.ToTable();
     commonBSO commonBSO = new commonBSO();
     commonBSO.FillToGridView(grvAdmin, dataTable);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.RouteData.Values["dll"] != null)
                NavigationTitle(Page.RouteData.Values["dll"].ToString());

            int group = 0;
            if (!String.IsNullOrEmpty(Page.RouteData.Values["group"].ToString()))
                int.TryParse(Page.RouteData.Values["group"].ToString().Replace(",", ""), out group);
            hddGroup.Value = Convert.ToString(group);

            int Id = -1;
            if (Page.RouteData.Values["Id"] != null)
                int.TryParse(Page.RouteData.Values["Id"].ToString().Replace(",", ""), out Id);

            hddNewsID.Value = Convert.ToString(Id);

            //  ltllistnews.Text = "<asp:HyperLink ID='btn_listnews' runat='server' NavigateUrl='~/Homepage.aspx?dll=" + ((group == 1) ? "listnews" : "listannounce") + "'><img src='Admin_Theme/Icons/icon-danhsach.gif' /></asp:HyperLink>";
            //  ltleditcomment.Text = "<asp:HyperLink ID='btn_editnewscomment' runat='server' NavigateUrl='~/Homepage.aspx?dll=editnewscomment&group=" + Convert.ToString(group) + "' ><img src='Admin_Theme/Icons/icon-taomoi-small.gif' /></asp:HyperLink>";

            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
            {
                btn_editpage.Visible = true;

                btn_delall.Visible = true;

            }
            else
            {
                btn_editpage.Visible = false;

                btn_delall.Visible = false;
            }

            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
            {
                btn_enable.Visible = true;
                btn_disable.Visible = true;

            }
            else
            {
                btn_enable.Visible = false;
                btn_disable.Visible = false;
            }


            if (!IsPostBack)
                NewsCommentView(group);
        }
        private void ViewCateAll()
        {
            AdminBSO adminBSO = new AdminBSO();
            DataTable datatable = adminBSO.GetAllAdmin();
            DataView dataView = new DataView(datatable);

            dataView.RowFilter = "Admin_Username not in ('administrator','Administrator')";
            dataView.Sort = "Admin_UserName Asc";
            DataTable table = dataView.ToTable();

            RadGrid1.DataSource = table;
            RadGrid1.DataBind();

        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.RouteData.Values["dll"] != null)
                NavigationTitle(Page.RouteData.Values["dll"].ToString());
            string group = "";
            if (!String.IsNullOrEmpty(Page.RouteData.Values["group"].ToString()))
                group = Page.RouteData.Values["group"].ToString();

            hddGroup.Value = group;

            int Id = -1;
            if (Page.RouteData.Values["Id"] != null)
                int.TryParse(Page.RouteData.Values["Id"].ToString().Replace(",", ""), out Id);
            hddPageID.Value = Convert.ToString(Id);

            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
            {
                btn_editpage.Visible = true;

                btn_delall.Visible = true;

            }
            else
            {
                btn_editpage.Visible = false;

                btn_delall.Visible = false;
            }

            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
            {
                btn_enable.Visible = true;
                btn_disable.Visible = true;

            }
            else
            {
                btn_enable.Visible = false;
                btn_disable.Visible = false;
            }

            if (!IsPostBack)
                PageCommentView(group);
        }
Exemplo n.º 7
0
        protected void btn_sumit1_Click(object sender, ImageClickEventArgs e)
        {
            if (!Convert.ToBoolean(rdbCheck.SelectedValue))
            {
                if (CheckUserName() == true)
                {
                    AdminBSO adminBSO = new AdminBSO();
                    ETO.Admin admin = adminBSO.GetAdminById(txtAdminUser.Text.Trim());


                    if (CheckLogin() == true)
                    {

                        Session["Admin_Username"] = txtAdminUser.Text.Trim();


                        HttpCookie cookie = Request.Cookies["UserInfor_ES"];
                        if (cookie == null)
                        {
                            cookie = new HttpCookie("UserInfor_ES");
                            cookie["UserName"] = txtAdminUser.Text.Trim();
                            //cookie["Password"]= MD5.Create(txtAdminPass.Text);
                            cookie.Expires = DateTime.Now.AddDays(1);
                            Response.Cookies.Add(cookie);
                            adminBSO.UpdateAdminLog(cookie["UserName"].ToString(), DateTime.Now);
                            Response.Redirect("~/Admin/home/default.aspx");
                        }
                        else
                        {

                            adminBSO.UpdateAdminLog(cookie["UserName"].ToString(), DateTime.Now);
                            Response.Redirect("~/Admin/home/default.aspx");
                        }
                    }
                    else
                    {
                        Tool.Message(this.Page, "Lỗi: Tài khoản hoặc mật khẩu không đúng! Xin vui lòng nhập lại");
                        return;
                    }
                }
                else
                {
                    Tool.Message(this.Page, "Lỗi: Tài khoản không tồn tại! Xin vui lòng nhập lại");
                    return;

                }
            }
        }
        protected void grvNewsComment_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();

            int Id = Convert.ToInt32(e.CommandArgument.ToString());
            string cName = e.CommandName.ToLower();
            switch (cName)
            {
                case "_view":
                    break;
                case "_edit":
                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        Response.Redirect("~/Admin/editnewsgroupcomment/" + Id + "/Default.aspx");

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnews");
                    }


                    break;
                case "_delete":
                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        NewsCommentBSO newsCommentBSO = new NewsCommentBSO();
                        newsCommentBSO.DeleteNewsComment(Id);
                        NewsCommentView(Convert.ToInt32(hddGroup.Value));

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnews");
                    }

                    break;


            }
        }
Exemplo n.º 9
0
        private void ViewCateNews()
        {
            int group = 1;
            //lay thong tin cua user login
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());
            lbFullName.Text = admin.AdminFullName.ToString();
            lbEmail.Text = admin.AdminEmail.ToString();


            ddlCateNews.Items.Clear();
            CateNewsBSO catenewsBSO = new CateNewsBSO();
            DataTable table = catenewsBSO.GetCateParentGroupAll(0, Language.language, group);

            commonBSO commonBSO = new commonBSO();
            commonBSO.FillToDropDown(ddlCateNews, table, "", "", "CateNewsName", "CateNewsID", "");
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.RouteData.Values["dll"] != null)
                NavigationTitle(Page.RouteData.Values["dll"].ToString());
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
            {
                btn_editpage.Visible = true;
                btn_enable.Visible = true;
                btn_disable.Visible = true;
                btn_delall.Visible = true;

            }
            else
            {
                btn_editpage.Visible = false;
                btn_enable.Visible = false;
                btn_disable.Visible = false;
                btn_delall.Visible = false;
            }

            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
            {
                btn_enable_approval.Visible = true;
                btn_disable_approval.Visible = true;

            }
            else
            {
                btn_enable_approval.Visible = false;
                btn_disable_approval.Visible = false;
            }


            if (!IsPostBack)
            {
                string group = "1";
                PagesView(group);
                hddGroup.Value = group;
            }
        }
Exemplo n.º 11
0
        protected void initControl()
        {
            string adminName = Session["Admin_Username"].ToString();
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = adminBSO.GetAdminById(adminName);
            if (admin.AdminLoginType)
            {
                News_Pass.ReadOnly = false;
                Re_Pass.ReadOnly = false;
            }
            else
            {
                News_Pass.ReadOnly = true;
                Re_Pass.ReadOnly = true;
                CompareValidator1.Visible = false;
                CompareValidator2.Visible = false;
                RequiredFieldValidator1.Visible = false;
                RequiredFieldValidator2.Visible = false;
            }
            hddAdminLoginType.Value = Convert.ToString(admin.AdminLoginType);

            txtAdminUser.Text = adminName;
            txtAdminEmail.Text = admin.AdminEmail;
            hddRoles_ID.Value = admin.RolesID.ToString();
            hddActied.Value = admin.AdminActive.ToString();
            txtFullName.Text = admin.AdminFullName;
            hdd_Created.Value = admin.AdminCreated.ToString();
            hdd_log.Value = admin.AdminLog.ToString();
            hddPermission.Value = admin.AdminPermission;

            hddAddress.Value = admin.AdminAddress;
            hddBirth.Value = admin.AdminBirth.ToString();
            hddSex.Value = admin.AdminSex.ToString();
            hddNickYahoo.Value = admin.AdminNickYahoo;
            hddNickSkype.Value = admin.AdminNickSkype;
            hddPhone.Value = admin.AdminPhone;
            hddImageThumb.Value = admin.AdminAvatar;



        }
Exemplo n.º 12
0
        protected void btn_GetPass_Click(object sender, EventArgs e)
        {
            string email = txtEmail.Text.Trim();

            AdminBSO adminBSO = new AdminBSO();
            DataTable table = adminBSO.GetAllAdmin();

            DataView dataView = new DataView(table);
            dataView.RowFilter = "Admin_Email = '" + email + "'";
            if (dataView.Count > 0)
            {
                SecurityBSO securityBSO = new SecurityBSO();
                DataTable dataTable = dataView.ToTable();
                string oldpass = dataTable.Rows[0]["Admin_Password"].ToString();
                string newpass = securityBSO.DecPwd(oldpass);

                ConfigBSO configBSO = new ConfigBSO();
                Config config = configBSO.GetAllConfig(Language.language);

                MailBSO mailBSO = new MailBSO();
                mailBSO.EmailFrom = config.Email_from;

                string subject = "Web Support EVNIT - Phục hồi lại mật khẩu đăng nhập hệ thống";
                string body = "Chào bạn :  " + dataTable.Rows[0]["Admin_FullName"].ToString() + "<br>";
                body += "Tài khoản Email đăng nhập của bạn :  " + dataTable.Rows[0]["Admin_Email"].ToString() + "<br>";
                body += "Mật khẩu đăng nhập hệ thống của bạn :  " + newpass;

                if (mailBSO.SendMail(email, subject, body) == true)
                    labMassege.Text = "Mật khẩu đăng nhập đã được gửi tới Email của bạn !";
                else
                    labMassege.Text = "Hệ thống không thể gửi Email";
            }
            else
            {
                labMassege.Text = "Xin lỗi! Chúng tôi không tìm thấy tài khoản của bạn trong hệ thống.";
            }
        }
Exemplo n.º 13
0
 private void initControl(int Id)
 {
     AdminBSO adminBSO = new AdminBSO();
     ETO.Admin admin = new ETO.Admin();
     if (Id > 0)
     {
         //if (!Session["Admin_UserName"].ToString().Equals("administrator"))
         //{
         //    ddlCateNews.Enabled = false;
         //}
         ListQuestion listQuestion = new ListQuestion();
         ListQuestionBSO listQuestionBSO = new ListQuestionBSO();
         listQuestion = listQuestionBSO.GetListQuestionByID(Id);
         txtTitle.Text = listQuestion.Question_Title;
         HiddenField_FileAttach.Value = listQuestion.Question_FileAttach;
         HiddenField_ImageAttach.Value = listQuestion.Question_Image;
         HiddenField_QuestionID.Value = Id.ToString();
         HiddenField_QuestionStatus.Value = listQuestion.QuestionStatus.ToString();
         HiddenField_CreateUserName.Value = listQuestion.CreateUserName;
         HiddenField_CreateDate.Value = listQuestion.CreateDate.ToString();
         txtRadShort.Html = listQuestion.Question_Content;
         ddlCateNews.SelectedValue = Convert.ToString(listQuestion.CateNewsID);
     }
 }
Exemplo n.º 14
0
        protected void initControl(int Id)
        {
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            if (Id > 0)
            {
                btn_add.Visible = false;
                btn_edit.Visible = true;
                hddCommentID.Value = Convert.ToString(Id);
                try
                {
                    NewsCommentBSO newsCommentBSO = new NewsCommentBSO();
                    NewsComment newsComment = newsCommentBSO.GetNewsCommentById(Id);
                    txtTitle.Text = newsComment.Title;
                    txtFullName.Text = newsComment.FullName;
                    hddNewsID.Value = Convert.ToString(newsComment.NewsID);
                    txtContent.Html = newsComment.Content;
                    txtDateCreated.SelectedDate = newsComment.DateCreated;
                    txtEmail.Text = newsComment.Email;
                    //       rdbActive.SelectedValue = newsComment.Actived.ToString();
                    hddGroup.Value = newsComment.GroupCate.ToString();

                    hddApprovalUserName.Value = newsComment.ApprovalUserName;
                    hddApprovalDate.Value = Convert.ToString(newsComment.ApprovalDate);

                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                    {
                        rdbActive.SelectedValue = Convert.ToString(newsComment.Actived);
                        rdbActive.Enabled = true;
                    }
                    else
                    {
                        rdbActive.SelectedValue = Convert.ToString(newsComment.Actived);
                        rdbActive.Enabled = false;
                    }

                }
                catch (Exception ex)
                {
                    clientview.Text = ex.Message.ToString();
                }
            }
            else
            {
                btn_add.Visible = true;
                btn_edit.Visible = false;
                //     hddNewsID = 0;

                if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                {

                    rdbActive.Enabled = true;
                }
                else
                {

                    rdbActive.Enabled = false;
                }
            }
        }
Exemplo n.º 15
0
        protected void grvCompany_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int Id = Convert.ToInt32(e.CommandArgument.ToString());
            string cName = e.CommandName.ToLower();
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            switch (cName)
            {
                case "_view":
                    break;

                case "_edit":
                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        Response.Redirect("~/Admin/editcompany/" + Id + "/Default.aspx");

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnews");
                    }

                    break;
                case "_delete":
                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        CompanyBSO companyBSO = new CompanyBSO();
                        companyBSO.DeleteCompany(Id);
                        ViewCompany();

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnews");
                    }

                    break;
                case "_default":
                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        CompanyBSO companyBSO = new CompanyBSO();
                        companyBSO.UpdateSetDefault(Id);
                        companyBSO.UpdateSetNotDefault(Id);
                        ViewCompany();

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnews");
                    }

                    break;
            }
        }
Exemplo n.º 16
0
 protected void btn_edit_Click(object sender, EventArgs e)
 {
     ETO.Admin admin = ReceiveHtml();
     try
     {
         if (CheckedList().Equals(""))
         {
             error.Text = "Loi : Xin hay lua chon it nhat 1 quyen";
         }
         else
         {
             AdminBSO adminBSO = new AdminBSO();
             adminBSO.UpdateAdmin(admin);
             error.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "quản trị", admin.AdminName);
         }
     }
     catch (Exception ex)
     {
         error.Text = ex.Message.ToString();
     }
 }
Exemplo n.º 17
0
        private void sendMailToUser(ListQuestion lstQuestion)
        {
            /* ------------- Gui email den nguoi gui cau hoi --*/
            string strObj = "Yeu cau cua ban da duoc gui thanh cong den trang Support EVNIT. Ngay gui: " + DateTime.Now.ToString("dd/MM/yyyy");
            string strBody = "Câu hỏi đã được gửi thành công tới người Quản lý sản phẩm";
            strBody += "<br><i>Tiêu đề : </i><strong>" + lstQuestion.Question_Title + "</strong><br/>";
            strBody += "<span><i>Nội dung:</i><br /></span>";
            strBody += "<div style='margin-left: 20px; font-size: 11pt; border-left: 3px solid green; padding: 5px;'>";
            strBody += lstQuestion.Question_Content;
            strBody += "</div><p style='font-size: 10pt;'><b>Để xem danh sách các câu hỏi đã gửi và câu trả lời xin thực hiện theo các bước:</b>";
            strBody += "<br>Đăng nhập vào trang http://support.evn.com.vn -> truy cập mục Quản trị.";
            strBody += "</p>";
            strBody += "<div style='border-bottom: 1px dashed red; width: 500px; height: 20px;'/>";
            strBody += "<p>Trang hỗ trợ sản phẩm dịch vụ EVNIT <strong>http://support.evn.com.vn</strong></p>";

            ETO.Admin adminUser = new ETO.Admin();
            AdminBSO adminBSO = new AdminBSO();
            adminUser = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

            MailBSO mailBSO = new MailBSO();
            ConfigBSO configBSO = new ConfigBSO();
            Config config = configBSO.GetAllConfig(Language.language);
            mailBSO.EmailFrom = config.Email_from;
            mailBSO.SendMail(adminUser.AdminEmail, strObj, strBody);
        }
Exemplo n.º 18
0
        private void sendMailToGroup(ListQuestion lstQuestion)
        {
            /* ------------- Gui email den nguoi co trach nhiem tra loi cau hoi --*/
            string strObj = "Ban nhan duoc yeu cau ho tro tu khach hang cua EVNIT. Ngay gui: " + DateTime.Now.ToString("dd/MM/yyyy");
            string strBody = "Khách hàng có gửi cho bạn một yêu cầu hỗ trợ.<br /><br/>";
            strBody += "<i>Tiêu đề : </i><strong>" + lstQuestion.Question_Title + "</strong><br/>";
            strBody += "<span><i>Nội dung:</i><br /></span>";
            strBody += "<div style='margin-left: 20px; font-size: 11pt; border-left: 3px solid green; padding: 5px;'>";
            strBody += lstQuestion.Question_Content;
            strBody += "</div>";
            strBody += "<div style='border-bottom: 1px dashed red; width: 500px; height: 20px;'/>";
            strBody += "<p>Trang hỗ trợ sản phẩm dịch vụ EVNIT <strong>http://support.evn.com.vn</strong></p>";


            MailBSO mailBSO = new MailBSO();
            ConfigBSO configBSO = new ConfigBSO();
            Config config = configBSO.GetAllConfig(Language.language);
            mailBSO.EmailFrom = config.Email_from;

            CateNewsBSO cateNewsBSO = new CateNewsBSO();
            CateNews cateNews = new CateNews();
            cateNews = cateNewsBSO.GetCateNewsById(int.Parse(ddlCateNews.SelectedValue.ToString())); //list user of product           

            //Get list email
            AdminBSO adminBSO = new AdminBSO();
            DataTable dtUser = new DataTable();
            dtUser = adminBSO.GetAllAdmin();
            if (dtUser.Rows.Count > 0)
            {
                DataView view1 = new DataView(dtUser);
                string strUser = cateNews.Roles;
                strUser = strUser.Remove(strUser.LastIndexOf(",")).Replace(",", "','");
                view1.RowFilter = "Admin_UserName in('" + strUser + "')";
                dtUser = view1.ToTable();

                for (int i = 0; i < dtUser.Rows.Count; i++)
                {
                    //clientview.Text += dtUser.Rows[i]["Admin_Email"].ToString();
                    mailBSO.SendMail(dtUser.Rows[i]["Admin_Email"].ToString(), strObj, strBody);
                    //sendMailToGroup(dtUser.Rows[i]["Admin_Email"].ToString().Trim()); //Gui mai den nhom support cua san pham                
                }
            }
            /* ------------- End Gui email den nguoi co trach nhiem tra loi cau hoi --*/
        }
Exemplo n.º 19
0
 public bool CheckUserName()
 {
     AdminBSO adminBSO = new AdminBSO();
     return adminBSO.CheckUserName(txtAdminUser.Text.Trim());
 }
Exemplo n.º 20
0
 protected void grvAdmin_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     string aId = e.CommandArgument.ToString();
     string aName = e.CommandName.ToLower();
     switch (aName)
     {
         case "user":
             Response.Redirect("~/Admins/editadminaddroles/" + aId + "/Default.aspx");
             break;
         case "edit":
             Response.Redirect("~/Admins/editadmin/" + aId + "/Default.aspx");
             break;
         case "delete":
             AdminBSO adminBSO = new AdminBSO();
             adminBSO.DeleteAdmin(aId);
             ViewAdmin();
             break;
     }
 }
Exemplo n.º 21
0
        protected void initControl(string adminName)
        {
            if (adminName != "")
            {
                hddAdmin_Username.Value = adminName;
                btn_add.Visible = false;
                btn_edit.Visible = true;




                try
                {
                    AdminBSO adminBSO = new AdminBSO();
                    ETO.Admin admin = adminBSO.GetAdminById(adminName);

                    txtAdminName.Text = admin.AdminName;
                    txtAdminName.Enabled = false;
                    hddPass.Value = admin.AdminPass;


                    txtFullName.Text = admin.AdminFullName;
                    txtAdminEmail.Text = admin.AdminEmail;

                    rdbList.SelectedValue = admin.AdminActive.ToString();
                    hdd_Created.Value = admin.AdminCreated.ToString();
                    hdd_log.Value = admin.AdminLog.ToString();

                    ViewPermission();
                    string sPermission = admin.AdminPermission;
                    if (!sPermission.Equals(""))
                    {
                        string[] sSlip = sPermission.Split(new char[] { ',' });
                        foreach (string s in sSlip)
                        {
                            foreach (ListItem items in chklist.Items)
                            {
                                if (items.Value == s)
                                    items.Selected = true;
                            }
                        }
                    }

                    txtAddress.Text = admin.AdminAddress;
                    txtBirth.SelectedDate = admin.AdminBirth;
                    rdbSex.SelectedValue = admin.AdminSex.ToString();
                    txtNickYahoo.Text = admin.AdminNickYahoo;
                    txtNickSkype.Text = admin.AdminNickSkype;
                    txtPhone.Text = admin.AdminPhone;

                    rdbLoginType.SelectedValue = admin.AdminLoginType.ToString();
                    rdbLoginType.Enabled = false;


                    hddImageThumb.Value = admin.AdminAvatar;
                    uploadPreview.Src = ResolveUrl("~/Upload/Avatar/") + admin.AdminAvatar;

                }
                catch (Exception ex)
                {
                    error.Text = ex.Message.ToString();
                }
            }
            else if (adminName == "")
            {

                hddAdmin_Username.Value = "";
                hdd_Created.Value = DateTime.Now.ToString();
                hdd_log.Value = DateTime.Now.ToString();
                btn_add.Visible = true;
                btn_edit.Visible = false;

                ViewPermission();
            }
        }
Exemplo n.º 22
0
        private void initControl(int Id)
        {
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            if (Id > 0)
            {
                btn_add.Visible = false;
                btn_edit.Visible = true;
                try
                {
                    CompanyBSO companyBSO = new CompanyBSO();
                    Company company = companyBSO.GetCompanyById(Id);
                    hddCompanyID.Value = Convert.ToString(company.CompanyID);
                    ddlCategories.SelectedValue = Convert.ToString(company.Categories);
                    txtTitle.Text = company.Title;
                    txtRadDescription.Html = company.Description;
                    txtAuthor.Text = company.Author;
                    rdbIsNormal.SelectedValue = Convert.ToString(company.IsNormal);
                    rdbIsHot.SelectedValue = Convert.ToString(company.IsHot);

                    hddCommentTotal.Value = Convert.ToString(company.CommentTotal);
                    hddVisitTotal.Value = Convert.ToString(company.VisitTotal);
                    hddCreateUserName.Value = company.CreatedUserName;
                    hddApprovalUserName.Value = company.ApprovalUserName;
                    hddApprovalDate.Value = Convert.ToString(company.ApprovalDate);
                    hddCreatedDate.Value = Convert.ToString(company.CreatedDate);

                    rdbComment.SelectedValue = Convert.ToString(company.IsComment);
                    rdbIsDefault.SelectedValue = Convert.ToString(company.IsDefault);

                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                    {
                        rdbApproval.SelectedValue = Convert.ToString(company.IsApproval);
                        rdbApproval.Enabled = true;
                    }
                    else
                    {
                        rdbApproval.SelectedValue = Convert.ToString(company.IsApproval);
                        rdbApproval.Enabled = false;
                    }

                    hddGroupCate.Value = company.GroupCate.ToString();

                }
                catch (Exception ex)
                {
                    clientview.Text = ex.Message.ToString();
                }

            }
            else
            {
                btn_add.Visible = true;
                btn_edit.Visible = false;

                if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                {

                    rdbApproval.Enabled = true;
                }
                else
                {

                    rdbApproval.Enabled = false;
                }
            }
        }
Exemplo n.º 23
0
 public DataTable ViewMainModules(string AdminName)
 {
     DataTable dataTable = new DataTable();
     Admin admin = new AdminBSO().GetAdminById(AdminName);
     RolesBSO rolesBSO = new RolesBSO();
     string strModules = rolesBSO.GetRolesById(admin.RolesID).RolesModules.Replace(",", "','");
     DataTable table = new ModulesBSO().MixModules();
     if (AdminName.Equals("administrator"))
     {
         return table;
     }
     DataView dataView = new DataView(table) {
         RowFilter = "Modules_Url in ('" + strModules + "')",
         Sort = "Modules_ID ASC"
     };
     return dataView.ToTable();
 }
Exemplo n.º 24
0
 public bool CheckLogin()
 {
     AdminBSO adminBSO = new AdminBSO();
     return adminBSO.CheckLoginAdmin(txtAdminUser.Text.Trim(), txtAdminPass.Text.Trim());
 }
Exemplo n.º 25
0
        protected void grvOfficial_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int Id = Convert.ToInt32(e.CommandArgument.ToString());
            string cName = e.CommandName.ToLower();
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            switch (cName)
            {
                case "_listfiles":
                    Response.Redirect("~/Admin/listofficialfiles/" + Id + "/Default.aspx");
                    break;

                case "_addfiles":
                    Response.Redirect("~/Admin/editofficialfiles/" + Id + "/0/Default.aspx");
                    break;


                case "_view":
                    break;

                case "_edit":
                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        Response.Redirect("~/Admin/editofficial/" + Id + "/Default.aspx");

                    }
                    else
                    {
                        //  Response.Redirect("~/Admin/Default.aspx?dll=listnews");
                    }

                    break;
                case "_delete":
                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        OfficialBSO officialBSO = new OfficialBSO();
                        officialBSO.DeleteOfficial(Id);
                        ViewOfficial(); ;

                    }
                    else
                    {
                        //  Response.Redirect("~/Admin/Default.aspx?dll=listnews");
                    }

                    break;
            }
        }
Exemplo n.º 26
0
        protected void initControl(int Id)
        {
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            if (Id > 0)
            {
                btn_add.Visible = false;
                btn_edit.Visible = true;
                hddPageID.Value = Convert.ToString(Id);
                try
                {
                    PagesBSO pagesBSO = new PagesBSO();
                    Pages pages = pagesBSO.GetPagesById(Id);
                    ddlPage.SelectedValue = pages.PageName;
                    txtPageName.Text = pages.PageName;
                    rdbGroup.SelectedValue = pages.Icon;
                    txtTitle.Text = pages.PageTitle;
                    rdbType1.SelectedValue = pages.PageType.ToString();
                    rdbType1.Enabled = false;
                    txtRadshort.Html = pages.Describe;
                    hddImage.Value = pages.Imagethumb;
                    txtRad_full.Html = pages.PageContent;
                    txtRadDate.SelectedDate = pages.PostDate;
                    txtAuthor.Text = pages.Author;
                    rdbActive.SelectedValue = pages.Status.ToString();
                    rdbIsView.SelectedValue = pages.IsView.ToString();
                    rdbComment.SelectedValue = pages.IsComment.ToString();

                    hddCommentTotal.Value = Convert.ToString(pages.CommentTotal);
                    hddVisitTotal.Value = Convert.ToString(pages.VisitTotal);
                    hddCreateUserName.Value = pages.CreatedUserName;
                    hddApprovalUserName.Value = pages.ApprovalUserName;
                    hddApprovalDate.Value = Convert.ToString(pages.ApprovalDate);



                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                    {
                        rdbApproval.SelectedValue = Convert.ToString(pages.IsApproval);
                        rdbApproval.Enabled = true;
                    }
                    else
                    {
                        rdbApproval.SelectedValue = Convert.ToString(pages.IsApproval);
                        rdbApproval.Enabled = false;
                    }

                    if (pages.PageType == true)
                    {
                        divFull.Visible = true;
                        divTitle1.Visible = true;
                    }
                    else
                    {
                        divFull.Visible = false;
                        divTitle1.Visible = false;
                    }

                }
                catch (Exception ex)
                {
                    clientview.Text = ex.Message.ToString();
                }
            }
            else
            {
                txtRadDate.SelectedDate = DateTime.Now;
                btn_add.Visible = true;
                btn_edit.Visible = false;

                if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                {

                    rdbApproval.Enabled = true;
                }
                else
                {

                    rdbApproval.Enabled = false;
                }

            }
        }
        protected void grvNewsGroup_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            var id = Convert.ToInt32(e.CommandArgument.ToString());
            var nName = e.CommandName.ToLower();
            var adminBSO = new AdminBSO();
            switch (nName)
            {
                case "_view":
                    break;
                case "_edit":
                    
                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        Response.Redirect("~/Admin/editnewsgroup/" + hddGroup.Value + "/" + id + "/Default.aspx");

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnewsGroup");
                    }


                    break;

                case "_move":
                    
                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        Response.Redirect("~/Admin/editnewsgroupmove/" + hddGroup.Value + "/" + id + "/Default.aspx");

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnewsGroup");
                    }


                    break;
                case "_delete":
                    
                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
                        newsGroupBSO.DeleteNewsGroup(id);
                        ViewNewsGroup(Convert.ToInt32(hddGroup.Value));

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnewsGroup");
                    }

                    break;
                case "_default":

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        var newsGroupBSO = new NewsGroupBSO();
                        newsGroupBSO.UpdateSetDefault(id, Convert.ToInt32(hddGroup.Value));
                        newsGroupBSO.UpdateSetNotDefault(id, Convert.ToInt32(hddGroup.Value));
                        ViewNewsGroup(Convert.ToInt32(hddGroup.Value));

                    }
                    break;
            }
        }
Exemplo n.º 28
0
        protected void btn_search_Click(object sender, EventArgs e)
        {

            int cId = Convert.ToInt32(ddlRoles.SelectedValue);
            AdminBSO adminBSO = new AdminBSO();
            //DataTable table = adminBSO.AdminGetAllRolesByID(cId);

            DataTable dataTable = new DataTable();
            commonBSO commonBSO = new commonBSO();
            DataTable table = adminBSO.GetAllAdminRoles();
            DataView dataView = new DataView(table);
            //dataView.RowFilter = "Admin_Username <> 'administrator' and Admin_Username <> 'Administrator'";

            if (cId == 0)
            {
                dataView.RowFilter = "Admin_Username not in ('administrator','Administrator')";
                dataTable = dataView.ToTable();
                commonBSO.FillToGridView(grvAdmin, dataTable);
            }
            else
            {
                AdminRolesBSO adminRolesBSO = new AdminRolesBSO();
                string strUser = adminRolesBSO.GetAdminUserName1(cId);
                if (strUser != "")
                {
                    DataTable table1 = adminBSO.GetAdminBystrName(strUser);
                    commonBSO.FillToGridView(grvAdmin, table1);
                }

            }



        }
        protected void grvNewsComment_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ImageButton image_del = (ImageButton)e.Row.FindControl("btn_delete");
                //   image_del.Attributes.Add("onclick", "return confirm('Bạn có chắc chắn muốn xóa?');");
                ImageButton image_edit = (ImageButton)e.Row.FindControl("btn_edit");

                AdminBSO adminBSO = new AdminBSO();
                ETO.Admin admin = new ETO.Admin();
                admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                {
                    image_del.Attributes.Add("onclick", "javascript:return confirm('Bạn có muốn chắc chắn xóa ???');");
                }
                else
                {
                    image_edit.Attributes.Add("onclick", "javascript:return confirm('Bạn không có đủ quyền ???');");
                    image_del.Attributes.Add("onclick", "javascript:return confirm('Bạn không có đủ quyền ???');");
                }

            }
        }
Exemplo n.º 30
0
        protected void grvOfficial_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ImageButton image_del = (ImageButton)e.Row.FindControl("btn_delete");
                //    image_del.Attributes.Add("onclick", "return confirm('Bạn có chắc chắn muốn xóa?');");

                ImageButton image_view = (ImageButton)e.Row.FindControl("btn_view");
                image_view.Attributes.Add("onclick", "javascript:window.open('~/Client/Admin/ViewOfficial.aspx?Id=" + DataBinder.Eval(e.Row.DataItem, "OfficialID") + "','_blank','width=800,height=600');");

                ImageButton image_edit = (ImageButton)e.Row.FindControl("btn_edit");

                AdminBSO adminBSO = new AdminBSO();
                ETO.Admin admin = new ETO.Admin();
                admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                {
                    image_del.Attributes.Add("onclick", "javascript:return confirm('Bạn có muốn chắc chắn xóa ???');");
                }
                else
                {
                    image_edit.Attributes.Add("onclick", "javascript:return confirm('Bạn không có đủ quyền ???');");
                    image_del.Attributes.Add("onclick", "javascript:return confirm('Bạn không có đủ quyền ???');");
                }
            }
        }
Exemplo n.º 31
0
        private void initControl(int Id)
        {
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            if (Id > 0)
            {
                btn_add.Visible = false;
                btn_edit.Visible = true;
                try
                {
                    News news = new News();
                    NewsBSO newsBSO = new NewsBSO();
                    news = newsBSO.GetNewsById(Id);
                    hddNewsID.Value = Convert.ToString(news.NewsID);
                    ddlCateNews.SelectedValue = Convert.ToString(news.CateNewsID);
                    hddParentNewsID.Value = Convert.ToString(news.ParentNewsID);
                    txtTitle.Text = news.Title;
                    txtRadShort.Html = news.ShortDescribe;
                    txtRadFull.Html = news.FullDescribe;
                    hddImageThumb.Value = news.ImageThumb;
                    hddImageLarge.Value = news.ImageLarge;
                    txtAuthor.Text = news.Author;
                    txtRadDate.SelectedDate = news.PostDate;
                    hddRelationTotal.Value = Convert.ToString(news.RelationTotal);
                    rdbStatus.SelectedValue = Convert.ToString(news.Status);
                    rdbIshot.SelectedValue = Convert.ToString(news.Ishot);
                    rdbIshome.SelectedValue = Convert.ToString(news.Ishome);


                    hddCommentTotal.Value = Convert.ToString(news.CommentTotal);
                    hddIsView.Value = Convert.ToString(news.Isview);
                    hddCreateUserName.Value = news.CreatedUserName;
                    hddApprovalUserName.Value = news.ApprovalUserName;
                    hddApprovalDate.Value = Convert.ToString(news.ApprovalDate);


                    rdbComment.SelectedValue = Convert.ToString(news.IsComment);

                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                    {
                        rdbApproval.SelectedValue = Convert.ToString(news.IsApproval);
                        rdbApproval.Enabled = true;
                    }
                    else
                    {
                        rdbApproval.SelectedValue = Convert.ToString(news.IsApproval);
                        rdbApproval.Enabled = false;
                    }

                }
                catch (Exception ex)
                {
                    clientview.Text = ex.Message.ToString();
                }
            }
            else
            {
                txtRadDate.SelectedDate = DateTime.Now;
                btn_add.Visible = true;
                btn_edit.Visible = false;
                if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                {

                    rdbApproval.Enabled = true;
                }
                else
                {

                    rdbApproval.Enabled = false;
                }

            }
        }