コード例 #1
0
        //public DataTable GetAllPageByRoleName(string roleName)
        //{
        //    dataAccess = new PageControlsDataAccess();
        //    return dataAccess.GetAllbyRoleCode(roleName);
        //}

        //public object GetAllPageForUpdate(string roleName)
        //{
        //    dataAccess = new PageControlsDataAccess();
        //    var aTable = dataAccess.GetAllbyRoleCode(roleName);
        //    var newTable = new DataTable();

        //    newTable.Columns.Add("MenuID");
        //    newTable.Columns.Add("Caption");
        //    newTable.Columns.Add("CanSelect");
        //    //newTable.Columns.Add("CanInsert");
        //    //newTable.Columns.Add("CanUpdate");
        //    //newTable.Columns.Add("CanDelete");
        //    //newTable.Columns.Add("CanPreview");
        //    //newTable.Columns.Add("CanPrint");
        //    dataAccess = new PageControlsDataAccess();
        //    var aTable = dataAccess.GetAllbyRoleCode(roleName);
        //    var newTable = new DataTable();

        //    foreach (DataRow aRow in aTable.Rows)
        //    {
        //         var row = newTable.NewRow();
        //        row["MenuID"] = aRow[1].ToString();
        //        row["Caption"] = aRow[1].ToString();
        //        row["CanSelect"] = aRow[3];
        //        //row["CanInsert"] = aRow[4];
        //        //row["CanUpdate"] = aRow[5];
        //        //row["CanDelete"] = aRow[6];
        //        //row["CanPreview"] = aRow[7];
        //        //row["CanPrint"] = aRow[8];
        //        newTable.Rows.Add(row);
        //    }
        //    return newTable;
        //}
        public DataTable CreateDataSource(string roleCode)
        {
            DataTable  dataTable = new DataTable("Users");
            DataColumn Caption   = new DataColumn("Caption", Type.GetType("System.String"));
            DataColumn select    = new DataColumn("Select", Type.GetType("System.Boolean"));
            DataColumn add       = new DataColumn("Add", Type.GetType("System.Boolean"));
            DataColumn edit      = new DataColumn("Edit", Type.GetType("System.Boolean"));
            DataColumn delate    = new DataColumn("Delate", Type.GetType("System.Boolean"));
            DataColumn preview   = new DataColumn("Preview", Type.GetType("System.Boolean"));
            DataColumn receive   = new DataColumn("Receive", Type.GetType("System.Boolean"));
            //Create a column All to store the all permission access
            DataColumn all = new DataColumn("All", Type.GetType("System.Boolean"));

            //Add the columns to the table
            dataTable.Columns.Add(Caption);
            dataTable.Columns.Add(select);
            dataTable.Columns.Add(add);
            dataTable.Columns.Add(edit);
            dataTable.Columns.Add(delate);
            dataTable.Columns.Add(preview);
            dataTable.Columns.Add(receive);
            dataTable.Columns.Add(all);

            dataAccess = new PageControlsDataAccess();
            var aTable = dataAccess.GetAllbyRoleCode(roleCode);

            //var newTable = new DataTable();

            foreach (DataRow aRow in aTable.Rows)
            {
                var row = dataTable.NewRow();
                row["Caption"] = aRow[11].ToString();
                row["Select"]  = aRow[3];
                row["Add"]     = aRow[4];
                row["Edit"]    = aRow[5];
                row["Delate"]  = aRow[6];
                row["Preview"] = aRow[7];
                row["Receive"] = aRow[8];
                dataTable.Rows.Add(row);
            }
            return(dataTable);
        }
コード例 #2
0
        //public string GetMenuId(string caption)
        //{
        //    if (caption != string.Empty)
        //    {
        //        dataAccess = new PageControlsDataAccess();
        //        return dataAccess.GetAMenuId(caption);
        //    }
        //    return null;
        //}
        //public string GetRoleCode(string text)
        //{
        //    if (text != string.Empty)
        //    {
        //        dataAccess = new PageControlsDataAccess();
        //        return dataAccess.GetARoleCode(text);
        //    }
        //    return null;
        //}

        public DataTable GetAllbyRoleCode(string rolecode)
        {
            dataAccess = new PageControlsDataAccess();
            return(dataAccess.GetAllbyRoleCode(rolecode));
        }
コード例 #3
0
 public bool UpdatePageControls(List <PageControlsProvider> aList, string text)
 {
     dataAccess = new PageControlsDataAccess();
     return(dataAccess.UpdatePageControls(aList, text));
 }
コード例 #4
0
 public DataTable GetAllPageControls()
 {
     dataAccess = new PageControlsDataAccess();
     return(dataAccess.GetAllPageControls());
 }