public static string ProcessIT(string value,string newval,string delval) { ACLRoleBL aclRoleBL = new ACLRoleBL(); string result = "Welcome Mr. " + value; string sroleid = Convert.ToString(HttpContext.Current.Session["EditRoleID"]); int qroleid = Convert.ToInt32(HttpContext.Current.Session["EditRoleID"]); string test = ""; string access = "0"; //string s = "123"; //int byParsing = int.Parse(s); //int re; //int.TryParse(s, out re); // *********** Insert ACL Action and Role // string[] roles = { "" }; roles = value.Split(':'); string rolename = ""; string description = ""; int roleid = 0; rolename = roles[0]; description = roles[1]; if(rolename != "") { if (qroleid == 0 ) { roleid = aclRoleBL.InsertRole(rolename,description); aclRoleBL.InsertACLAction(roleid,0); qroleid = roleid; } //************Edit Role ***********************// else if (qroleid > 0) { aclRoleBL.EditRole(rolename, description, qroleid); } // *********** Edit ACL Action True ************* // string aid = newval.TrimEnd('#'); string[] mid = { "" }; mid = aid.Split('#'); int moduleId = 0; int functionId = 0; Int64 re = 0; if (newval != string.Empty) { for (int x = 0; x < mid.Length; x++) { string[] fid = { "" }; fid = mid[x].Split(':'); moduleId = int.Parse(fid[0]); functionId = int.Parse(fid[1]); access = "1"; //test += fid[0] + fid[1] + "#"; re = aclRoleBL.EditACLAction(moduleId, functionId, access, qroleid); } } //********* Edit ACL Action False ********************// string did = delval.TrimEnd('#'); string[] tid = { "" }; tid = did.Split('#'); int delmodule = 0; int delfunction = 0; Int64 rep = 0; //string tested = ""; if(delval != string.Empty) { for (int x = 0; x < tid.Length; x++) { string[] gid = { "" }; gid = tid[x].Split(':'); delmodule = int.Parse(gid[0]); delfunction = int.Parse(gid[1]); access = "0"; // tested += gid[0] + gid[1] + "#"; rep = aclRoleBL.EditACLAction(delmodule, delfunction, access, qroleid); } } test += "value" + value + " delval" + delval + " newval" + newval + "roleid" + qroleid + "re" + re + "rep"+ rep + "roles" + roleid ; } test = "RoleName Field can not be Empty!!"; HttpContext.Current.Session["EditRoleID"] = 0; return test; }
protected void Page_Load(object sender, EventArgs e) { //Int32 companyid = Convert.ToInt32(HttpContext.Current.Session["CompanyID"]); C3Entities context = new C3Entities(); ACLRoleBL aclRoleBL = new ACLRoleBL(); int roleid = aclRoleBL.InsertRole("csd", "csd"); Response.Write("roleid is " + roleid); //int moduleid = 0; //int functionid = 0; //int[] menus = { 0 }; //int[] functions = { 0 }; //int i = 0; //int j = 0; //var query = from t in context.CompanyModules // where (t.CompanyID == companyid) // orderby t.ModuleID ascending // select t.ModuleID; //if (query.Count() > 0) //{ // menus = new int[query.Count()]; // foreach (var q in query) // { // moduleid = q; // // Response.Write("module id is: " + q + "<hr>"); // menus[i] = q; // i++; // } //} //var query1 = from t in context.ACLFunctions // orderby t.FunctionOrder ascending // select t.FunctionID; //if (query1.Count() > 0) //{ // functions = new int[query1.Count()]; // foreach (var q1 in query1) // { // functionid = q1; // // Response.Write("function id is: " + q1 + "<hr>"); // functions[j] = q1; // j++; // } //} //foreach (int x in menus) //{ // foreach (int y in functions) // { // Response.Write("menu id are: " + x + "function id" + y + "<hr>"); // var aclaction = new ACLAction { ModuleID = x, FunctionID = y, Access = true, RoleID=4, CreatedTime = DateTime.Now }; // context.ACLActions.Add(aclaction); // context.SaveChanges(); // } //} }