Esempio n. 1
0
        public static string GetModuleForRoles()
        {
            try
            {
                MenuHelper    objMenu    = new MenuHelper();
                DataTable     dtMenu     = objMenu.GetAllModulesForRole(0, 1, 0);
                StringBuilder objSBFirst = new StringBuilder();
                if (dtMenu != null && dtMenu.Rows.Count > 0)
                {
                    for (int first = 0; first < dtMenu.Rows.Count; first++)
                    {
                        objSBFirst.Append("<tr>");

                        objSBFirst.Append("<td class='FieldCaptionTD'>");
                        objSBFirst.Append("<input type='checkbox' id='" + "chkHm_" + first.ToString() + "' onclick=\"CheckAllCheckBoxes('rptMenu',this.checked,this.id)\" style=\"margin-right:10px; margin-bottom:10px;\" />");
                        objSBFirst.Append("" + dtMenu.Rows[first]["menuName"].ToString() + "");
                        objSBFirst.Append("</td>");


                        objSBFirst.Append("<td class='FieldCaptionTD' style='display: none' align='left'>");
                        objSBFirst.Append("<input type='checkbox' id='" + "chk1_" + first.ToString() + "' />");
                        objSBFirst.Append("</td>");

                        objSBFirst.Append("<td class='FieldCaptionTD' style='display: none' align='left'>");
                        objSBFirst.Append("<input type='checkbox' id='" + "chk2_" + first.ToString() + "' />");
                        objSBFirst.Append("</td>");

                        objSBFirst.Append("<td class='FieldCaptionTD'>");
                        objSBFirst.Append("<input type='hidden' id='" + "hModuleId" + first.ToString() + "'  value='" + dtMenu.Rows[first]["moduleId"].ToString() + "' />");
                        objSBFirst.Append("</td>");

                        objSBFirst.Append("</tr>");

                        DataTable dtSubMenu = objMenu.GetAllModulesForRole(Convert.ToInt32(dtMenu.Rows[first]["moduleId"].ToString()), 2, 0);

                        if (dtSubMenu != null && dtSubMenu.Rows.Count > 0)
                        {
                            for (int second = 0; second < dtSubMenu.Rows.Count; second++)
                            {
                                objSBFirst.Append("<tr>");

                                objSBFirst.Append("<td class='FieldCaptionTD'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                                objSBFirst.Append("<input type='checkbox' id='" + "chkHm_" + first.ToString() + "_" + second.ToString() + "' onclick=\"CheckAllCheckBoxes('rptSubMenu',this.checked,this.id)\" style=\"margin-right:10px; margin-bottom:10px;\" />");
                                objSBFirst.Append("" + dtSubMenu.Rows[second]["menuName"].ToString() + "");
                                objSBFirst.Append("</td>");


                                objSBFirst.Append("<td class='FieldCaptionTD' style='display: none' align='left'>");
                                objSBFirst.Append("<input type='checkbox' id='" + "chkF" + first.ToString() + "_" + second.ToString() + "' />");
                                objSBFirst.Append("</td>");

                                objSBFirst.Append("<td class='FieldCaptionTD' style='display: none' align='left'>");
                                objSBFirst.Append("<input type='checkbox' id='" + "chkS" + first.ToString() + "_" + second.ToString() + "' />");
                                objSBFirst.Append("</td>");

                                objSBFirst.Append("<td class='FieldCaptionTD'>");
                                objSBFirst.Append("<input type='hidden' id='" + "hSubModuleId" + second.ToString() + "'  value='" + dtSubMenu.Rows[second]["moduleId"].ToString() + "' />");
                                objSBFirst.Append("</td>");

                                objSBFirst.Append("</tr>");


                                DataTable dtSubSubMenu = objMenu.GetAllModulesForRole(Convert.ToInt32(dtSubMenu.Rows[second]["moduleId"].ToString()), 3, 0);

                                if (dtSubSubMenu != null && dtSubSubMenu.Rows.Count > 0)
                                {
                                    for (int third = 0; third < dtSubSubMenu.Rows.Count; third++)
                                    {
                                        objSBFirst.Append("<tr>");

                                        objSBFirst.Append("<td class='FieldCaptionTD'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                                        objSBFirst.Append("<input type='checkbox' id='" + "chkHm_" + first.ToString() + "_" + second.ToString() + "_" + third.ToString() + "' onclick=\"CheckAllCheckBoxes('rptSubSubMenu',this.checked,this.id)\" style=\"margin-right:10px; margin-bottom:10px;\" />");
                                        objSBFirst.Append("" + dtSubSubMenu.Rows[third]["menuName"].ToString() + "");
                                        objSBFirst.Append("</td>");


                                        objSBFirst.Append("<td class='FieldCaptionTD' style='display: none' align='left'>");
                                        objSBFirst.Append("<input type='checkbox' id='" + "chkF" + first.ToString() + "_" + second.ToString() + "_" + third.ToString() + "' />");
                                        objSBFirst.Append("</td>");

                                        objSBFirst.Append("<td class='FieldCaptionTD' style='display: none' align='left'>");
                                        objSBFirst.Append("<input type='checkbox' id='" + "chkS" + first.ToString() + "_" + second.ToString() + "_" + third.ToString() + "' />");
                                        objSBFirst.Append("</td>");

                                        objSBFirst.Append("<td class='FieldCaptionTD'>");
                                        objSBFirst.Append("<input type='hidden' id='" + "hSubSubModuleId_" + first.ToString() + "_" + second.ToString() + "_" + third.ToString() + "'  value='" + dtSubSubMenu.Rows[third]["moduleId"].ToString() + "' />");
                                        objSBFirst.Append("</td>");

                                        objSBFirst.Append("</tr>");
                                    }
                                }
                            }
                        }
                    }
                }
                return(objSBFirst.ToString());
            }
            catch
            {
                throw;
            }
        }
Esempio n. 2
0
        public static string GetNewEditModuleForRoles(int RoleId)
        {
            try
            {
                MenuHelper    objMenu    = new MenuHelper();
                DataTable     dtMenu     = objMenu.GetAllModulesForRole(0, 4, RoleId);
                StringBuilder objSBFirst = new StringBuilder();
                if (dtMenu != null && dtMenu.Rows.Count > 0)
                {
                    for (int first = 0; first < dtMenu.Rows.Count; first++)
                    {
                        //objSBFirst.Append("<tr>");

                        objSBFirst.Append("<li class='FieldCaptionTD'>");
                        if (dtMenu.Rows[first]["IsChecked"].ToString() == "1")
                        {
                            objSBFirst.Append("<input type='checkbox' checked='checked' id='" + "chkHm_" + first.ToString() + "' onclick=\"CheckAllCheckBoxes('rptMenu',this.checked,this.id)\" />");
                        }
                        else
                        {
                            objSBFirst.Append("<input type='checkbox' id='" + "chkHm_" + first.ToString() + "' onclick=\"CheckAllCheckBoxes('rptMenu',this.checked,this.id)\" />");
                        }
                        objSBFirst.Append("<span>" + dtMenu.Rows[first]["menuName"].ToString() + "</span>");
                        objSBFirst.Append("</li>");


                        objSBFirst.Append("<li class='FieldCaptionTD' style='display: none' align='left'>");
                        objSBFirst.Append("<input type='checkbox' id='" + "chk1_" + first.ToString() + "' />");
                        objSBFirst.Append("</li>");

                        objSBFirst.Append("<li class='FieldCaptionTD' style='display: none' align='left'>");
                        objSBFirst.Append("<input type='checkbox' id='" + "chk2_" + first.ToString() + "' />");
                        objSBFirst.Append("</li>");

                        objSBFirst.Append("<li class='FieldCaptionTD'>");
                        objSBFirst.Append("<input type='hidden' id='" + "hModuleId" + first.ToString() + "'  value='" + dtMenu.Rows[first]["moduleId"].ToString() + "' />");
                        objSBFirst.Append("</li>");

                        //objSBFirst.Append("</tr>");

                        DataTable dtSubMenu = objMenu.GetAllModulesForRole(Convert.ToInt32(dtMenu.Rows[first]["moduleId"].ToString()), 5, RoleId);

                        if (dtSubMenu != null && dtSubMenu.Rows.Count > 0)
                        {
                            for (int second = 0; second < dtSubMenu.Rows.Count; second++)
                            {
                                objSBFirst.Append("<ul class='subMenu'>");

                                objSBFirst.Append("<li class='FieldCaptionTD'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                                if (dtSubMenu.Rows[second]["IsChecked"].ToString() == "1")
                                {
                                    objSBFirst.Append("<input type='checkbox' checked='checked' id='" + "chkHm_" + first.ToString() + "_" + second.ToString() + "' onclick=\"CheckAllCheckBoxes('rptSubMenu',this.checked,this.id)\" />");
                                }
                                else
                                {
                                    objSBFirst.Append("<input type='checkbox' id='" + "chkHm_" + first.ToString() + "_" + second.ToString() + "' onclick=\"CheckAllCheckBoxes('rptSubMenu',this.checked,this.id)\" />");
                                }
                                objSBFirst.Append("<span>" + dtSubMenu.Rows[second]["menuName"].ToString() + "</span>");
                                objSBFirst.Append("</li>");


                                objSBFirst.Append("<li class='FieldCaptionTD' style='display: none' align='left'>");
                                objSBFirst.Append("<input type='checkbox' id='" + "chkF" + first.ToString() + "_" + second.ToString() + "' />");
                                objSBFirst.Append("</li>");

                                objSBFirst.Append("<li class='FieldCaptionTD' style='display: none' align='left'>");
                                objSBFirst.Append("<input type='checkbox' id='" + "chkS" + first.ToString() + "_" + second.ToString() + "' />");
                                objSBFirst.Append("</li>");

                                objSBFirst.Append("<li class='FieldCaptionTD'>");
                                objSBFirst.Append("<input type='hidden' id='" + "hSubModuleId" + second.ToString() + "'  value='" + dtSubMenu.Rows[second]["moduleId"].ToString() + "' />");
                                objSBFirst.Append("</li>");

                                objSBFirst.Append("</ul>");


                                DataTable dtSubSubMenu = objMenu.GetAllModulesForRole(Convert.ToInt32(dtSubMenu.Rows[second]["moduleId"].ToString()), 6, RoleId);

                                if (dtSubSubMenu != null && dtSubSubMenu.Rows.Count > 0)
                                {
                                    for (int third = 0; third < dtSubSubMenu.Rows.Count; third++)
                                    {
                                        objSBFirst.Append("<ul>");

                                        objSBFirst.Append("<li class='FieldCaptionTD'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");

                                        if (dtSubSubMenu.Rows[third]["IsChecked"].ToString() == "1")
                                        {
                                            objSBFirst.Append("<input type='checkbox' checked='checked' id='" + "chkHm_" + first.ToString() + "_" + second.ToString() + "_" + third.ToString() + "' onclick=\"CheckAllCheckBoxes('rptSubSubMenu',this.checked,this.id)\" />");
                                        }
                                        else
                                        {
                                            objSBFirst.Append("<input type='checkbox' id='" + "chkHm_" + first.ToString() + "_" + second.ToString() + "_" + third.ToString() + "' onclick=\"CheckAllCheckBoxes('rptSubSubMenu',this.checked,this.id)\" />");
                                        }



                                        objSBFirst.Append("<span>" + dtSubSubMenu.Rows[third]["menuName"].ToString() + "</span>");
                                        objSBFirst.Append("</li>");


                                        objSBFirst.Append("<li class='FieldCaptionTD' style='display: none' align='left'>");
                                        objSBFirst.Append("<input type='checkbox' id='" + "chkF" + first.ToString() + "_" + second.ToString() + "_" + third.ToString() + "' />");
                                        objSBFirst.Append("</li>");

                                        objSBFirst.Append("<li class='FieldCaptionTD' style='display: none' align='left'>");
                                        objSBFirst.Append("<input type='checkbox' id='" + "chkS" + first.ToString() + "_" + second.ToString() + "_" + third.ToString() + "' />");
                                        objSBFirst.Append("</li>");

                                        objSBFirst.Append("<li class='FieldCaptionTD'>");
                                        objSBFirst.Append("<input type='hidden' id='" + "hSubSubModuleId_" + first.ToString() + "_" + second.ToString() + "_" + third.ToString() + "'  value='" + dtSubSubMenu.Rows[third]["moduleId"].ToString() + "' />");
                                        objSBFirst.Append("</li>");

                                        objSBFirst.Append("</ul>");
                                    }
                                }
                            }
                        }
                    }
                }
                return(objSBFirst.ToString());
            }
            catch
            {
                throw;
            }
        }