public static List<LabMS.Model.Module> GetManaModuleByUserID(string strUserID) { List<LabMS.Model.Function> listFunction = new List<LabMS.Model.Function>(); listFunction = GetManaFunctionByUserID(strUserID); List<LabMS.Model.Module> listModule = new List<LabMS.Model.Module>(); LabMS.BLL.Module bModule = new LabMS.BLL.Module(); string strWhere = " 1<>1 "; foreach (LabMS.Model.Function f in listFunction) { strWhere += " or Code = '" + f.MCode.ToString()+"'"; } listModule = bModule.GetModelList(strWhere); return listModule; }
void CreatePrivailyPanel() { lbErr.Visible = false; List<LabMS.Model.Plate> listPPlate = new List<LabMS.Model.Plate>(); List<LabMS.Model.Module> listPModule = new List<LabMS.Model.Module>(); List<LabMS.Model.Function> listPFuntion = new List<LabMS.Model.Function>(); LabMS.BLL.Plate bPlate = new LabMS.BLL.Plate(); LabMS.BLL.Module bModule = new LabMS.BLL.Module(); LabMS.BLL.Function bFuntion = new LabMS.BLL.Function(); try { listPPlate = bPlate.GetModelList(""); } catch (Exception ex) { lbErr.Visible = true; lbErr.Text = ex.Message; return; } PRolePrivaily.Controls.Add(new LiteralControl("<ul class='plate'>")); foreach (LabMS.Model.Plate p in listPPlate) { PRolePrivaily.Controls.Add(new LiteralControl("<li id='"+ p.Code +"'>")); PRolePrivaily.Controls.Add(new LiteralControl(p.Name)); try { listPModule = bModule.GetModelList("PCode = '" + p.Code + "'"); } catch (Exception ex) { lbErr.Visible = true; lbErr.Text = ex.Message; return; } PRolePrivaily.Controls.Add(new LiteralControl("<ul class='module'>")); foreach (LabMS.Model.Module m in listPModule) { PRolePrivaily.Controls.Add(new LiteralControl("<li id='" + m.Code + "'>")); CheckBox check = new CheckBox(); check.ID = "chk" + m.Code.ToString(); check.Text = m.Name.ToString(); check.CssClass = "module"; check.Attributes.Add("onclick", "checkAllChanged('chk" + m.Code.ToString() + "','div" + m.Code + "')"); PRolePrivaily.Controls.Add(check); PRolePrivaily.Controls.Add(new LiteralControl("<div id='div" + m.Code + "'>")); try { listPFuntion = bFuntion.GetModelList("MCode = '" + m.Code + "'"); } catch (Exception ex) { lbErr.Visible = true; lbErr.Text = ex.Message; return; } foreach (LabMS.Model.Function f in listPFuntion) { check = new CheckBox(); check.ID = "check" + f.Code.ToString(); check.Text = f.Name.ToString(); check.CssClass = "function"; check.Attributes.Add("onclick", "checkFunctionChanged('chk" + m.Code.ToString()+"','div" + m.Code + "')"); PRolePrivaily.Controls.Add(check); } PRolePrivaily.Controls.Add(new LiteralControl("</div >")); PRolePrivaily.Controls.Add(new LiteralControl("</li>")); } PRolePrivaily.Controls.Add(new LiteralControl("</ul>")); PRolePrivaily.Controls.Add(new LiteralControl("</li>")); } PRolePrivaily.Controls.Add(new LiteralControl("</ul>")); }