Exemple #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);
        }
 private void NavigationTitle(string url)
 {
     ModulesBSO modulesBSO = new ModulesBSO();
     Modules modules = modulesBSO.GetModulesByUrl(url);
     imgIcon.ImageUrl = "~/Upload/Admin_Theme/Icons/" + modules.ModulesIcon;
     litModules.Text = modules.ModulesName;
 }
        protected void initControl(int ID)
        {
            if (ID > 0)
            {
                txtModulesID.Value = Convert.ToString(ID);
                btn_add.Visible = false;
                btn_edit.Visible = true;
                try
                {
                    ModulesBSO modulesBSO = new ModulesBSO();

                    Modules modulesRows = modulesBSO.GetModulesById(ID);
                    ddlModules.SelectedValue = modulesRows.ModulesParent.ToString();
                    txtModulesName.Text = modulesRows.ModulesName;
                    txtModulesUrl.Text = modulesRows.ModulesUrl;
                    txtRadHelp.Html = modulesRows.ModulesHelp;
                    hddIcon.Value = modulesRows.ModulesIcon;
                    uploadPreview.Src = ResolveUrl("~/Upload/Admin_Theme/Icons/") + modulesRows.ModulesIcon;
                }
                catch (Exception ex)
                {
                    error.Text = ex.Message.ToString();
                }
            }
            else
            {
                txtModulesID.Value = "";
                ddlModules.SelectedIndex = 0;
                btn_add.Visible = true;
                btn_edit.Visible = false;
            }
        }
 protected void BindDropDownList()
 {
     ModulesBSO modulesBSO = new ModulesBSO();
     DataTable table = modulesBSO.MixModules();
     commonBSO commonBSO = new commonBSO();
     ddlModules.Items.Clear();
     commonBSO.FillToDropDown(ddlModules, table, "~ Cấp độ modules ~", "0", "Modules_Name", "Modules_ID", "");
 }
        public void ViewModules()
        {
            ModulesBSO modulesBSO = new ModulesBSO();
            DataTable table = modulesBSO.MixModules();
            commonBSO commonBSO = new commonBSO();
            commonBSO.FillToGridView(GridView1, table);


        }
        public void ViewModules()
        {
            ModulesBSO modulesBSO = new ModulesBSO();
            DataTable table = modulesBSO.MixModules();
            DataView dataView = new DataView(table);
            // dataView.RowFilter = "Modules_Url <> 'listmodules' and Modules_Url <> 'editmodules' ";
            dataView.RowFilter = "Modules_Url not in ('listmodules','editmodules')";
            DataTable dataTable = dataView.ToTable();
            commonBSO commonBSO = new commonBSO();
            commonBSO.FillToCheckBoxList(chklist, dataTable, "Modules_Name", "Modules_Url");


        }
Exemple #7
0
 private void BindMenuAdminCate(int cId)
 {
     if (Session["Admin_Username"] != null)
     {
         ModulesBSO modulesBSO = new ModulesBSO();
         DataTable table = modulesBSO.ViewMainModulesRoles(Session["Admin_Username"].ToString());
         DataView dataView = new DataView(table);
         dataView.RowFilter = "Modules_Parent = " + cId;
         DataList1.DataSource = dataView;
         DataList1.DataBind();
     }
     else
         Response.Redirect("~/Default.aspx");
 }
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     int mID = Convert.ToInt32(e.CommandArgument.ToString().Trim());
     string cName = e.CommandName.ToLower().Trim();
     switch (cName)
     {
         case "edit":
             Response.Redirect("~/Admin/editmodules/" + mID + "/Default.aspx");
             break;
         case "delete":
             ModulesBSO modulesBSO = new ModulesBSO();
             modulesBSO.DeleteModules(mID);
             ViewModules();
             break;
     }
 }
Exemple #9
0
        public DataTable ViewMainModulesByRoles(string AdminName)
        {
            DataTable dataTable = new DataTable();

            AdminRolesBSO adminRolesBSO = new AdminRolesBSO();
            string        strRoles      = adminRolesBSO.GetRoles(AdminName);
            RolesBSO      rolesBSO      = new RolesBSO();
            DataTable     table1        = rolesBSO.GetRolesbyStrRolesID(strRoles);

            string strModules = "";

            if (table1.Rows.Count > 0)
            {
                foreach (DataRow row in table1.Rows)
                {
                    strModules += row["Roles_Modules"].ToString();
                }
            }


            //   string strModules = roles.RolesModules;

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

            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);
        }
Exemple #10
0
        protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            DataList dtl2 = (DataList)e.Item.FindControl("DataList2");

            int cateId;
            int.TryParse(DataBinder.Eval(e.Item.DataItem, "Modules_ID").ToString(), out cateId);


            if (Session["Admin_Username"] != null)
            {
                ModulesBSO modulesBSO = new ModulesBSO();
                DataTable table = modulesBSO.ViewMainModulesRoles(Session["Admin_Username"].ToString());
                DataView dataView = new DataView(table);
                dataView.RowFilter = "Modules_Parent = " + cateId;
                dtl2.DataSource = dataView;
                dtl2.DataBind();
            }
            else
                Response.Redirect("~/Default.aspx");


        }
Exemple #11
0
 public DataTable ViewMainModulesRoles(string AdminName)
 {
     DataTable dataTable = new DataTable();
     string strRoles = new AdminRolesBSO().GetRoles(AdminName);
     DataTable table1 = new RolesBSO().GetRolesbyStrRolesID(strRoles);
     string strModules = "";
     if (table1.Rows.Count > 0)
     {
         foreach (DataRow row in table1.Rows)
         {
             strModules = strModules + row["Roles_Modules"].ToString();
         }
     }
     strModules = strModules.Replace(",", "','");
     DataTable table = new ModulesBSO().MixModulesAdmin();
     if (AdminName.Equals("administrator"))
     {
         return table;
     }
     DataView dataView = new DataView(table) {
         RowFilter = "Modules_Url in ('" + strModules + "')",
         Sort = "Modules_ID ASC"
     };
     return dataView.ToTable();
 }
Exemple #12
0
 public DataTable ViewMainModules(string AdminName)
 {
     DataTable dataTable = new DataTable();
     Admin admin = new AdminBSO().GetAdminById(AdminName);
     RolesBSO rolesBSO = new RolesBSO();
     string strModules = rolesBSO.GetRolesById(admin.RolesID).RolesModules.Replace(",", "','");
     DataTable table = new ModulesBSO().MixModules();
     if (AdminName.Equals("administrator"))
     {
         return table;
     }
     DataView dataView = new DataView(table) {
         RowFilter = "Modules_Url in ('" + strModules + "')",
         Sort = "Modules_ID ASC"
     };
     return dataView.ToTable();
 }
 protected void btn_Order_Click(object sender, ImageClickEventArgs e)
 {
     foreach (GridViewRow row in GridView1.Rows)
     {
         TextBox textOrder = (TextBox)row.FindControl("txtModulesOrder");
         int cOrder = Convert.ToInt32(textOrder.Text);
         int cateID = Convert.ToInt32(row.Cells[0].Text);
         ModulesBSO modulesBSO = new ModulesBSO();
         modulesBSO.ModulesUpOrder(cateID, cOrder);
     }
     ViewModules();
 }
        protected void Add()
        {
            ModulesBSO modulesBSO = new ModulesBSO();
            Modules modules = ReceiveHtml();
            try
            {
                if (modulesBSO.CheckExist(modules.ModulesUrl))
                {
                    error.Text = String.Format(Resources.StringAdmin.CheckExist, modules.ModulesUrl);
                }
                else
                {
                    modulesBSO.AddModules(modules);
                    error.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);
                }
            }
            catch (Exception ex)
            {
                error.Text = ex.Message.ToString();
            }

        }
        protected void Edit()
        {
            ModulesBSO modulesBSO = new ModulesBSO();
            Modules modules = ReceiveHtml();
            try
            {
                modulesBSO.EditModules(modules);
                error.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "Modules", modules.ModulesName);

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