コード例 #1
0
ファイル: Privilege.cs プロジェクト: dalinhuang/labms
        public static List<LabMS.Model.Plate> GetManaPlateByUserID(string strUserID)
        {
            List<LabMS.Model.Module> listModule = GetManaModuleByUserID(strUserID); ;
            LabMS.BLL.Plate bPlate = new LabMS.BLL.Plate();
            List<LabMS.Model.Plate> listPlate = new List<LabMS.Model.Plate>();
            string strWhere = " 1<>1 ";
             foreach (LabMS.Model.Module m in listModule)
            {
                strWhere += " or Code = '" + m.PCode.ToString()+"'";
            }
            listPlate = bPlate.GetModelList(strWhere);

            return listPlate;
        }
コード例 #2
0
ファイル: Add.aspx.cs プロジェクト: dalinhuang/labms
        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>"));
        }