Beispiel #1
0
 public void CreateAdmin(Admin admin)
 {
     using (SqlConnection connection = base.GetConnection())
     {
         SqlCommand command = new SqlCommand("_AdminUpdate", connection) {
             CommandType = CommandType.StoredProcedure
         };
         command.Parameters.AddWithValue("@Type", 0);
         command.Parameters.AddWithValue("@Admin_ID", 1);
         command.Parameters.AddWithValue("@Admin_Username", admin.AdminName);
         command.Parameters.AddWithValue("@Admin_FullName", admin.AdminFullName);
         command.Parameters.AddWithValue("@Admin_Email", admin.AdminEmail);
         command.Parameters.AddWithValue("@Admin_Password", admin.AdminPass);
         command.Parameters.AddWithValue("@Roles_ID", admin.RolesID);
         command.Parameters.AddWithValue("@Admin_Actived", admin.AdminActive);
         command.Parameters.AddWithValue("@Admin_Permission", admin.AdminPermission);
         command.Parameters.AddWithValue("@Admin_Created", admin.AdminCreated);
         command.Parameters.AddWithValue("@Admin_Log", admin.AdminLog);
         command.Parameters.AddWithValue("@Admin_Phone", admin.AdminPhone);
         command.Parameters.AddWithValue("@Admin_Address", admin.AdminAddress);
         command.Parameters.AddWithValue("@Admin_Birth", admin.AdminBirth);
         command.Parameters.AddWithValue("@Admin_Sex", admin.AdminSex);
         command.Parameters.AddWithValue("@Admin_NickYahoo", admin.AdminNickYahoo);
         command.Parameters.AddWithValue("@Admin_NickSkype", admin.AdminNickSkype);
         command.Parameters.AddWithValue("@Admin_Avatar", admin.AdminAvatar);
         command.Parameters.AddWithValue("@Admin_LoginType", admin.AdminLoginType);
         connection.Open();
         if (command.ExecuteNonQuery() <= 0)
         {
             throw new DataAccessException("Lỗi kh\x00f4ng thể tao moi");
         }
         command.Dispose();
     }
 }
        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);

                }
            }


        }
Beispiel #3
0
 public bool CheckPermission(string name, string permission)
 {
     bool check = false;
     Admin admin = new Admin();
     if (this.GetAdminById(name).AdminPermission.Replace(",", "','").IndexOf(permission) != -1)
     {
         check = true;
     }
     return check;
 }
        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);
        }
        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;


            }
        }
        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", "");
        }
Beispiel #8
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 ETO.Admin ReceiveHtml()
        {
            SecurityBSO securityBSO = new SecurityBSO();
            ETO.Admin admin = new ETO.Admin();
            admin.AdminName = txtAdminUser.Text;
            admin.AdminEmail = txtAdminEmail.Text;
            admin.AdminLoginType = Convert.ToBoolean(hddAdminLoginType.Value);
            if (admin.AdminLoginType)
            {
                admin.AdminPass = securityBSO.EncPwd(News_Pass.Text.Trim());
            }
            else
            {
                admin.AdminPass = "";
            }
            admin.AdminPass = securityBSO.EncPwd(News_Pass.Text.Trim());
            admin.RolesID = Convert.ToInt32(hddRoles_ID.Value);
            admin.AdminActive = Convert.ToBoolean(hddActied.Value);

            admin.AdminFullName = (txtFullName.Text != "") ? txtFullName.Text.Trim() : "";

            admin.AdminCreated = Convert.ToDateTime(hdd_Created.Value);
            admin.AdminLog = Convert.ToDateTime(hdd_log.Value);
            admin.AdminPermission = (hddPermission.Value != "") ? hddPermission.Value : "";

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



            return admin;
        }
 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);
     }
 }
        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;
            }
        }
        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);
        }
        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!";

            }


        }
Beispiel #14
0
 public void UpdateAdmin(Admin admin)
 {
     new AdminDAO().UpdateAdmin(admin);
 }
        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;
                }
            }
        }
Beispiel #16
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 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;
            }
        }
        private void listQuestionStatus(int opt, string RolesName_)
        {
            ListQuestionBSO listQuestionBSO = new ListQuestionBSO();
            DataTable dt = new DataTable();
            dt = listQuestionBSO.GetListQuestionStausID(int.Parse(strParam));

            DataView view1 = new DataView(dt);
            string strCate = GetCateParentIDArrayByID();

            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();

            if (RolesName_ == "Guest")
            {
                view1.RowFilter = "CreateUserName ='******'";
                grvListQuestion.Columns[6].Visible = false;
                iconForUser();
            }
            else
                if (!string.IsNullOrEmpty(strCate))
                {
                    string restr = strCate.Remove(strCate.LastIndexOf(",")).Replace(",", "','");

                    if (RolesName_ != "Guest") //
                    {
                        //view1.RowFilter = "CateNewsID in('" + restr + "')";
                        view1.RowFilter = "CateNewsID in('" + restr + "') or CreateUserName ='******'";
                        //grvListQuestion.Columns[6].Visible = false;
                        //iconForUser();
                    }

                }
            //else
            //{
            //    if (RolesName_ == "Guest")
            //    {
            //        view1.RowFilter = "CreateUserName ='******'";
            //        grvListQuestion.Columns[6].Visible = false;
            //        iconForUser();
            //    }
            //}
            grvListQuestion.DataSource = view1;
            grvListQuestion.DataBind();
        }
        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;
            }
        }
        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 ???');");
                }

            }
        }
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int Id = Convert.ToInt32(e.CommandArgument.ToString()); //subID question
            string cName = e.CommandName.ToLower();
            //------------- Lay ParentID

            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            ListQuestionBSO listQuestionBSO = new ListQuestionBSO();
            DataTable dt = new DataTable();
            string strParentID = "";
            dt = listQuestionBSO.GetQuestionByID(Id);
            if (dt.Rows.Count > 0)
                strParentID = dt.Rows[0]["Question_ParentID"].ToString();

            switch (cName)
            {
                case "_view_sub":
                    break;
                case "_publish":
                    listQuestionBSO.updateStatusPublishQuestion(Id, 1);
                    Response.Redirect("~/Admin/listdetailquestion&Id=" + strParentID + "/Default.aspx");
                    break;
                case "_unpublish":
                    listQuestionBSO.updateStatusPublishQuestion(Id, 0);
                    Response.Redirect("~/Admin/listdetailquestion&Id=" + strParentID + "/Default.aspx");
                    break;
                case "_edit_sub":
                    {
                        Response.Redirect("~/Admin/s/listdetailquestion/" + strParentID + "/" + Id + "/Default.aspx");
                        break;
                    }
                case "_delete_sub":
                    {
                        listQuestionBSO.deleteQuestionByID(Id);
                        Response.Redirect("~/Admin/p/listquestion/0/Default.aspx");
                        break;
                    }
            }
        }
Beispiel #22
0
        public ETO.Admin ReceiveHtml()
        {
            ConfigBSO configBSO = new ConfigBSO();
            ETO.Config config = configBSO.GetAllConfig(Language.language);
            int icon_w = Convert.ToInt32(config.New_icon_w);
            int icon_h = Convert.ToInt32(config.New_icon_h);



            SecurityBSO securityBSO = new SecurityBSO();
            ETO.Admin admin = new ETO.Admin();

            string path = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Upload/Avatar/";
            commonBSO commonBSO = new commonBSO();
            string image_thumb = commonBSO.UploadImage(txtAvatar, path, icon_w, icon_h);

            admin.AdminLoginType = Convert.ToBoolean(rdbLoginType.SelectedItem.Value);



            //if (rdbLoginType.SelectedItem.Value.Equals("True"))
            //{
            admin.AdminPass = (txtAdminPass.Text != "") ? securityBSO.EncPwd(txtAdminPass.Text.Trim()) : hddPass.Value;
            admin.AdminName = (txtAdminName.Text != "") ? txtAdminName.Text.Trim() : hddAdmin_Username.Value;
            admin.AdminEmail = (txtAdminEmail.Text != "") ? txtAdminEmail.Text.Trim() : "";

            //}


            // admin.RolesID = (ddlRoles.SelectedValue != "") ? Convert.ToInt32(ddlRoles.SelectedValue) : 0;
            admin.RolesID = 1;
            admin.AdminActive = Convert.ToBoolean(rdbList.SelectedItem.Value);
            admin.AdminFullName = (txtFullName.Text != "") ? txtFullName.Text.Trim() : "";

            admin.AdminCreated = Convert.ToDateTime(hdd_Created.Value);
            admin.AdminLog = Convert.ToDateTime(hdd_log.Value);
            //admin.AdminPermission = "";
            admin.AdminPermission = (CheckedList() != "") ? CheckedList() : "";

            admin.AdminAddress = (txtAddress.Text != "") ? txtAddress.Text.Trim() : "";
            admin.AdminPhone = (txtPhone.Text != "") ? txtPhone.Text.Trim() : "";
            admin.AdminNickYahoo = (txtNickYahoo.Text != "") ? txtNickYahoo.Text.Trim() : "";
            admin.AdminNickSkype = (txtNickSkype.Text != "") ? txtNickSkype.Text.Trim() : "";
            admin.AdminAvatar = (image_thumb != "") ? image_thumb : hddImageThumb.Value;
            admin.AdminSex = Convert.ToBoolean(rdbSex.SelectedItem.Value);
            admin.AdminBirth = txtBirth.SelectedDate.Value;


            return admin;
        }
        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 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);
        }
        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;
            }
        }
Beispiel #26
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;
                }

            }
        }
        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 ???');");
                }
            }
        }
Beispiel #28
0
 public void CreateAdmin(Admin admin)
 {
     new AdminDAO().CreateAdmin(admin);
 }