Esempio 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);

                }
            }


        }
        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);
        }
        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);
        }
Esempio n. 5
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;

                }
            }
        }
Esempio n. 6
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", "");
        }
Esempio n. 7
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;
            }
        }
        protected void grvPageComment_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/editpagecomment/" + 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"))
                    {
                        PageCommentBSO pageCommentBSO = new PageCommentBSO();
                        pageCommentBSO.DeletePageComment(Id);
                        PageCommentView(hddGroup.Value);

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

                    break;
            }
        }
Esempio n. 9
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;



        }
Esempio n. 10
0
        protected void grvNewsGroup_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            var id = Convert.ToInt32(e.CommandArgument.ToString());
            var nName = e.CommandName.ToLower();
            var adminBSO = new AdminBSO();
            var admin = new ETO.Admin();
            switch (nName)
            {
                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/editnewsgroup/" + hddGroup.Value + "/" + id + "/Default.aspx");

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


                    break;

                case "_move":

                    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/editnewsgroupmove/" + hddGroup.Value + "/" + id + "/Default.aspx");

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


                    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"))
                    {
                        NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
                        newsGroupBSO.DeleteNewsGroup(id);
                        ViewNewsGroup(Convert.ToInt32(hddGroup.Value));

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

                    break;
            }
        }
        private void bindingContentQuestion(int parentID, string RolesName_)
        {
            ListQuestionBSO listQuestionBSO = new ListQuestionBSO();
            DataTable dt = new DataTable();
            dt = listQuestionBSO.listParentQuestionByID(parentID);

            DataView view1 = new DataView(dt);

            string strCate = GetCateParentIDArrayByID();
            ////-------------------Lay nhom Role
            AdminBSO adminBSO = new AdminBSO();
            if (RolesName_ == "Guest")
            {
                view1.RowFilter = "CreateUserName ='******'";
            }
            else
                if (!string.IsNullOrEmpty(strCate))
                {
                    string restr = strCate.Remove(strCate.LastIndexOf(",")).Replace(",", "','");
                    //view1.RowFilter = "CateNewsID in('" + restr + "')";
                    view1.RowFilter = "CateNewsID in('" + restr + "') or CreateUserName ='******'";
                }

            ETO.Admin userPostQuestion = new ETO.Admin();
            if (adminBSO.CheckExist(view1[0]["CreateUserName"].ToString()))
            {
                userPostQuestion = adminBSO.GetAdminById(view1[0]["CreateUserName"].ToString());
                lbContentQuestion.Text = view1[0]["Question_Content"].ToString();
                lbDatePostQuestion.Text = " gửi ngày: " + view1[0]["CreateDate"].ToString();
                lbQuestionTitle.Text = "Tiêu đề: <b>" + view1[0]["Question_Title"].ToString() + "</b>";
                lbUserPost.Text = "Người gửi: <b>" + userPostQuestion.AdminFullName.ToString() + "</b>, ";
                if (!string.IsNullOrEmpty(view1[0]["Question_Image"].ToString()))
                {
                    string strImgName = view1[0]["Question_Image"].ToString();
                    Literal_images.Text = "<span style='display: block;'>Hình đính kèm:</span>";
                    Literal_images.Text = "<a href='" + ResolveUrl("~/") + "Upload/Question/Images/" + strImgName + "' rel='lightbox' ><img src='" + ResolveUrl("~/") + "Upload/Question/Images/" + strImgName + "' class='image_album' width='120' align='left'  hspace='1' /></a>";
                }
                if (!string.IsNullOrEmpty(view1[0]["Question_fileAttach"].ToString()))
                {
                    string strFileAttch = view1[0]["Question_fileAttach"].ToString();
                    Literal_file.Text = "<span style='display: block;'>Tệp tin đính kèm:</span>";
                    Literal_file.Text += "<a href='" + ResolveUrl("~/") + "Upload/Question/Files/" + strFileAttch + "'  ><img src='" + ResolveUrl("~/") + "Images/icon_file.png' class='icon' width='30' hspace='1' /> Tải tệp tin đính kèm </a>";
                }
            }
            else
            {
                lbContentQuestion.Text = "";
                lbDatePostQuestion.Text = "";
                lbQuestionTitle.Text = "";
                lbUserPost.Text = "Người gửi câu hỏi không tồn tại!";

            }


        }
        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;
                }
            }
        }
        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;
                }
            }
        }
Esempio n. 14
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);
        }
Esempio n. 15
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;
                }

            }
        }
Esempio n. 16
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;
                }

            }
        }
        private void sendMailToUser(ListQuestion lstQuestion)
        {
            /* ------------- Gui email den nguoi gui cau hoi --*/
            string strObj = "Ban nhan duoc cau tra loi tu trang ho tro khach hang cua EVNIT (" + DateTime.Now.ToString("dd/MM/yyyy") + ")";
            string strBody = "";
            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 += "<br/><br/><b>Để việc trao đổi giữa chúng tôi và quý khách được nhanh chóng và chính xác, vui lòng phản hồi theo cách sau:</b>";
            //strBody += "<br>Sử dụng tài khoản đã đăng ký để đăng nhập vào trang http://support.evn.com.vn, truy cập vào mục quản trị và quản lý danh sách các câu hỏi của quý khách ";
            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>";


            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin adminUser = new ETO.Admin();
            adminUser = adminBSO.GetAdminById(HiddenField_CreateUserName.Value.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);
        }
Esempio n. 18
0
        protected void grvListQuestion_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/editquestion/" + Id + "/Default.aspx");
                    }
                    //else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnews");
                    }

                    break;
                case "_lockquestion": //Cap nhat status = 3 => cau hoi da ket thuc
                    {
                        ListQuestionBSO listQuestionBSO = new ListQuestionBSO();
                        string strID = Id.ToString() + ",";
                        listQuestionBSO.UpdateQuestionStatus(strID, 3);
                        loadData();
                        break;
                    }

                case "_unlockquestion": //Cap nhat status = 1 => Dang xu ly
                    {
                        ListQuestionBSO listQuestionBSO = new ListQuestionBSO();
                        string strID = Id.ToString() + ",";
                        listQuestionBSO.UpdateQuestionStatus(strID, 1);
                        loadData();
                        Label1.Text = "unlock";
                        break;
                    }
                case "_delete":
                    {
                        ListQuestionBSO listQuestionBSO = new ListQuestionBSO();
                        listQuestionBSO.deleteQuestionByID(Id);
                        loadData();
                    }
                    break;
            }
        }
Esempio n. 19
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;
            }
        }
        protected void grvListQuestion_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();
            ListQuestionBSO listQuestionBSO = new ListQuestionBSO();

            switch (cName)
            {
                case "_view":
                    break;
                case "_publish":
                    listQuestionBSO.updateStatusPublishQuestion(Id, 1);
                    Response.Redirect("~/Admin/listdetailquestion/" + Id + "/Default.aspx");
                    break;
                case "_unpublish":
                    listQuestionBSO.updateStatusPublishQuestion(Id, 0);
                    Response.Redirect("~/Admin/listdetailquestion/" + Id + "/Default.aspx");

                    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/editquestion/" + Id + "/Default.aspx");
                    }

                    break;
                case "_delete":
                    listQuestionBSO.deleteQuestionByID(Id);
                    Response.Redirect("~/Admin/p/listquestion/0/Default.aspx");
                    break;
            }
        }
Esempio 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();
            }
        }
Esempio n. 22
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 ???');");
                }
            }
        }
        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 ???');");
                }

            }
        }