Beispiel #1
0
 /// <summary>
 /// 新增/删除/修改 sys_Module
 /// </summary>
 /// <param name="fam">sys_ModuleTable实体类</param>
 /// <returns>返回0操正常</returns>
 public override int sys_ModuleInsertUpdate(sys_ModuleTable fam)
 {
     int rInt = 0;
     using (SqlConnection Conn = GetSqlConnection())
     {
         SqlCommand cmd = new SqlCommand("sys_ModuleInsertUpdateDelete", Conn);
         cmd.CommandType = CommandType.StoredProcedure;
         //设置参数
         cmd.Parameters.Add("@DB_Option_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录
         cmd.Parameters.Add("@ModuleID", SqlDbType.Int).Value = fam.ModuleID;  //功能模块ID号
         cmd.Parameters.Add("@M_ApplicationID", SqlDbType.Int).Value = fam.M_ApplicationID;  //所属应用程序ID
         cmd.Parameters.Add("@M_ParentID", SqlDbType.Int).Value = fam.M_ParentID;  //所属父级模块ID与ModuleID关联,0为顶级	
         cmd.Parameters.Add("@M_PageCode", SqlDbType.VarChar).Value = fam.M_PageCode;  //模块编码Parent为0,则为S00(xx),否则为S00M00(xx)
         cmd.Parameters.Add("@M_CName", SqlDbType.NVarChar).Value = fam.M_CName;  //模块/栏目名称当ParentID为0为模块名称
         cmd.Parameters.Add("@M_Directory", SqlDbType.NVarChar).Value = fam.M_Directory;  //模块/栏目目录名	
         cmd.Parameters.Add("@M_OrderLevel", SqlDbType.VarChar).Value = fam.M_OrderLevel;  //当前所在排序级别支持双层99级菜单
         cmd.Parameters.Add("@M_IsSystem", SqlDbType.Int).Value = fam.M_IsSystem;  //是否为系统模块1:是0:否如为系统则无法修改
         cmd.Parameters.Add("@M_Close", SqlDbType.Int).Value = fam.M_Close;  //是否关闭1:是0:否
         cmd.Parameters.Add("@M_Icon", SqlDbType.NVarChar).Value = fam.M_Icon;  //默认显示图标
         Conn.Open();
         rInt = Convert.ToInt32(cmd.ExecuteScalar());
         cmd.Dispose();
         Conn.Dispose();
         Conn.Close();
     }
     return rInt;
 }
Beispiel #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            sys_ModuleTable smt = new sys_ModuleTable();
            smt = BusinessFacade.sys_ModuleDisp(ModuleID);
            string OldPageCode = smt.M_PageCode;
            smt.M_ApplicationID = S_ID;
            smt.M_Close = (int) Common.sink(this.M_Close.UniqueID,MethodType.Post,255,1,DataType.Int);
            smt.M_CName = (string)Common.sink(this.M_CName.UniqueID, MethodType.Post, 50, 1, DataType.Str);
            smt.M_Directory = (string) Common.sink(this.M_Directory.UniqueID,MethodType.Post,255,0,DataType.Str);
            smt.M_Icon = (string)Common.sink(this.M_Icon.UniqueID, MethodType.Post, 255, 0, DataType.Str);
            //smt.M_IsSystem = (int) Common.sink(this.M_IsSystem.UniqueID,MethodType.Post,255,1,DataType.Int);
            smt.M_PageCode = (string) Common.sink(this.M_PageCode.UniqueID,MethodType.Post,6,1,DataType.CharAndNum);
            if (CMD == "New")
            {
                if (BusinessFacade.sys_Module_CheckPK(smt.M_ApplicationID, smt.M_PageCode,0))
                    EventMessage.MessageBox(1, "数据输入出错", string.Format("存在相同的模块编码({0})", smt.M_PageCode)
                                           , Icon_Type.Error, "history.back()", UrlType.JavaScript);

                QueryParam qp = new QueryParam();
                qp.Orderfld = "M_OrderLevel";
                qp.PageIndex = 1;
                qp.PageSize = 1;
                qp.Where = string.Format("Where M_ParentID={0} and M_Applicationid={1}", ModuleID, S_ID);
                int RecordCount = 0;
                ArrayList lst = BusinessFacade.sys_ModuleList(qp, out RecordCount);
                if (ModuleID == 0)
                {
                    if (RecordCount != 0)
                        RecordCount = Convert.ToInt32(((sys_ModuleTable)lst[0]).M_OrderLevel.Substring(0,2))+1;
                    smt.M_OrderLevel = Common.FillZero(RecordCount.ToString(), 2) + "00";
                }
                else {
                    if (RecordCount !=0)
                        RecordCount = Convert.ToInt32(((sys_ModuleTable)lst[0]).M_OrderLevel.Substring(2, 2));
                    RecordCount++;
                    smt.M_OrderLevel = smt.M_OrderLevel.Substring(0, 2) + Common.FillZero(RecordCount.ToString(), 2);
                }
                smt.M_ParentID = ModuleID;
                smt.DB_Option_Action_ = "Insert";
            }
            else if (CMD == "Edit")
            {
                if (BusinessFacade.sys_Module_CheckPK(smt.M_ApplicationID, smt.M_PageCode,ModuleID))
                    EventMessage.MessageBox(1, "数据输入出错", string.Format("存在相同的模块编码({0})", smt.M_PageCode)
                                           , Icon_Type.Error, "history.back()", UrlType.JavaScript);
                smt.DB_Option_Action_ = "Update";
            }
            smt.ModuleID = ModuleID;
            if (smt.M_IsSystem!=1)
                BusinessFacade.sys_ModuleInsertUpdate(smt);
            if (!string.IsNullOrEmpty(OldPageCode) && OldPageCode != smt.M_PageCode)
            { 
                //清除旧有PageCode所在用户的权限.
                BusinessFacade.sys_RolePermission_DeleteForm(smt.M_ApplicationID, OldPageCode);
            }
            EventMessage.MessageBox(1, "操作成功", string.Format("增加/修改模块ID({0})成功!", ModuleID), Icon_Type.OK, Common.GetHomeBaseUrl(string.Format("ModuleList.aspx?S_ID={0}&AppName={1}", S_ID, S_ID_Name)));


        }
Beispiel #3
0
        private void OnStart()
        {

            if (CMD == string.Empty)
            {
                TabOptionWebControls1.SelectIndex = 1;
            }

            //填充数据
            sys_ModuleTable SMT = new sys_ModuleTable();
            SMT = BusinessFacade.sys_ModuleDisp(ModuleID);
            this.M_ApplicationID_Txt.Text = S_ID_Name;
            if (ModuleID==0)
                this.M_PageCode.Text = SMT.M_PageCode;
            if (CMD == "New" && ModuleID != 0)
            {
                this.M_ParentID_Txt.Text = SMT.M_CName;
            }
            else
            {
                this.M_ParentID_Txt.Text = SMT.M_ParentID == 0 ? "无" : BusinessFacade.sys_ModuleDisp(SMT.M_ParentID).M_CName;
            }
            this.M_PageCode_Txt.Text = SMT.M_PageCode;
            this.M_CName_Txt.Text = SMT.M_CName;
            this.M_Directory_Txt.Text = SMT.M_Directory;
            this.M_IsSystem_Txt.Text = SMT.M_IsSystem == 0 ? "否" : "是";
            this.M_Close_Txt.Text = SMT.M_Close == 0 ? "否" : "是";
            this.M_Icon_Txt.Text = SMT.M_Icon;

            if (CMD == "Edit")
            {
                this.M_PageCode.Text = SMT.M_PageCode;
                this.M_CName.Text = SMT.M_CName;
                this.M_Directory.Text = SMT.M_Directory;
                this.M_Icon.Text = SMT.M_Icon;
                ListItem ditem1 = this.M_IsSystem.Items.FindByValue(SMT.M_IsSystem.ToString());
                if (ditem1 != null)
                    ditem1.Selected = true;
                ListItem ditem2 = this.M_Close.Items.FindByValue(SMT.M_Close.ToString());
                if (ditem2 != null)
                    ditem2.Selected = true;
            }

            //绑定子模块
            QueryParam qp = new QueryParam();
            qp.Orderfld = " M_Applicationid,M_OrderLevel ";
            qp.OrderType = 0;
            qp.Where = string.Format("Where M_ParentID={0} and M_Applicationid={1}", ModuleID,S_ID);
            int RecordCount = 0;
            ArrayList lst = BusinessFacade.sys_ModuleList(qp, out RecordCount);
            GridView1.DataSource = lst;
            GridView1.DataBind();

            //绑定排序
            OrderByListItems.DataSource = lst;
            OrderByListItems.DataTextField = "M_CName";
            OrderByListItems.DataValueField = "ModuleID";
            OrderByListItems.DataBind();
            if (lst.Count > 0)
                OrderByListItems.Rows = lst.Count;
            
            //判断是否隐藏数据
            if (CMD == "New" || CMD == "Edit")
                HiddenDisp();
            else
            {
                HiddenInput();
                SubmitTr.Visible = false;
            }

            //判断是否生成增加子模块按钮
            if (CMD!="New" && ModuleID !=0 && SMT.M_OrderLevel.Substring(2, 2) == "00")
            {

                HeadMenuButtonItem m2 = new HeadMenuButtonItem();
                m2.ButtonName = "模块";
                m2.ButtonPopedom = PopedomType.New;
                m2.ButtonUrl = string.Format("?CMD=New&ModuleID={0}&S_ID={1}", ModuleID, S_ID);
                HeadMenuWebControls1.ButtonList.Add(m2);
            }
            if (ModuleID !=0 && SMT.M_OrderLevel.Substring(2, 2) != "00")
            {
                TabOptionWebControls1.SelectIndex = 0;
                TabOptionItem2.Visible = false;
                TabOptionItem3.Visible = false;
                TabOptionItem4.Visible = true;
                BindPermissionList();
                if (CMD == "Edit")
                {
                    HeadMenuButtonItem m5 = new HeadMenuButtonItem();
                    m5.ButtonIcon = "back.gif";
                    m5.ButtonName = "返回";
                    m5.ButtonPopedom = PopedomType.List;
                    m5.ButtonUrl = string.Format("?ModuleID={0}&S_ID={1}", ModuleID, S_ID);
                    HeadMenuWebControls1.ButtonList.Add(m5);
                }
            }




            //生成修改按钮
            if (ModuleID != 0 && CMD=="")
            {
                HeadMenuButtonItem m3 = new HeadMenuButtonItem();
                m3.ButtonName = "";
                m3.ButtonPopedom = PopedomType.Edit;
                m3.ButtonUrl = string.Format("?CMD=Edit&ModuleID={0}&S_ID={1}",ModuleID,S_ID);
                HeadMenuWebControls1.ButtonList.Add(m3);
            }

            //生成删除按钮
            if (CMD == "Edit")
            {
                HeadMenuButtonItem m4 = new HeadMenuButtonItem();
                m4.ButtonPopedom = PopedomType.Delete;
                m4.ButtonUrl = string.Format("DelData('?CMD=Delete&S_ID={0}&ModuleID={1}')", S_ID,ModuleID);
                m4.ButtonUrlType = UrlType.JavaScript;
                HeadMenuWebControls1.ButtonList.Add(m4);
            }

            //判断是否执行删除
            if (CMD == "Delete")
            {
                SMT.DB_Option_Action_ = "Delete";
                if (SMT.M_IsSystem != 1)
                {
                    BusinessFacade.sys_ModuleInsertUpdate(SMT);
                    //删除角色权限表
                    BusinessFacade.sys_RolePermission_DeleteForm(SMT.M_ApplicationID, SMT.M_PageCode);
                    if (lst.Count > 0)
                    {
                        foreach (sys_ModuleTable var in lst)
                        {
                            SMT.ModuleID = var.ModuleID;
                            BusinessFacade.sys_ModuleInsertUpdate(SMT);
                            //删除角色权限表
                            BusinessFacade.sys_RolePermission_DeleteForm(var.M_ApplicationID, var.M_PageCode);
                        }
                    }

                }
                EventMessage.MessageBox(1, "操作成功", "删除记录ID:(" + ModuleID + ")成功!", Icon_Type.OK, Common.GetHomeBaseUrl(string.Format("ModuleList.aspx?S_ID={0}&AppName={1}",S_ID,S_ID_Name)));
            }

            //Button1.Attributes.Add("Onclick", "javascript:return checkForm(aspnetForm);");

        }
Beispiel #4
0
        /// <summary>
        /// 将记录集转为sys_ModuleTable实体类
        /// </summary>
        /// <param name="dr">记录集</param>
        /// <returns>sys_ModuleTable</returns>
        protected object Populatesys_Module(IDataReader dr)
        {
            sys_ModuleTable nc = new sys_ModuleTable();

            if (!Convert.IsDBNull(dr["ModuleID"])) nc.ModuleID = Convert.ToInt32(dr["ModuleID"]); // 功能模块ID号
            if (!Convert.IsDBNull(dr["M_ApplicationID"])) nc.M_ApplicationID = Convert.ToInt32(dr["M_ApplicationID"]); // 所属应用程序ID
            if (!Convert.IsDBNull(dr["M_ParentID"])) nc.M_ParentID = Convert.ToInt32(dr["M_ParentID"]); // 所属父级模块ID与ModuleID关联,0为顶级
            if (!Convert.IsDBNull(dr["M_PageCode"])) nc.M_PageCode = Convert.ToString(dr["M_PageCode"]).Trim(); // 模块编码Parent为0,则为S00(xx),否则为S00M00(xx)
            if (!Convert.IsDBNull(dr["M_CName"])) nc.M_CName = Convert.ToString(dr["M_CName"]).Trim(); // 模块/栏目名称当ParentID为0为模块名称
            if (!Convert.IsDBNull(dr["M_Directory"])) nc.M_Directory = Convert.ToString(dr["M_Directory"]).Trim(); // 模块/栏目目录名
            if (!Convert.IsDBNull(dr["M_OrderLevel"])) nc.M_OrderLevel = Convert.ToString(dr["M_OrderLevel"]).Trim(); // 当前所在排序级别支持双层99级菜单
            if (!Convert.IsDBNull(dr["M_IsSystem"])) nc.M_IsSystem = Convert.ToInt32(dr["M_IsSystem"]); // 是否为系统模块1:是0:否如为系统则无法修改
            if (!Convert.IsDBNull(dr["M_Close"])) nc.M_Close = Convert.ToInt32(dr["M_Close"]); // 是否关闭1:是0:否
            if (!Convert.IsDBNull(dr["M_Icon"])) nc.M_Icon = dr["M_Icon"].ToString().Trim(); // 模块/栏目名称当ParentID为0为模块名称
            return nc;
        }
Beispiel #5
0
 /// <summary>
 /// 新增/删除/修改 sys_Module
 /// </summary>
 /// <param name="fam">sys_ModuleTable实体类</param>
 /// <returns>返回0操正常</returns>
 public abstract int sys_ModuleInsertUpdate(sys_ModuleTable fam);
Beispiel #6
0
 /// <summary>
 /// 根据M_ApplicationID和M_PageCode返回 sys_ModuleTable实体类 单笔资料
 /// </summary>
 /// <param name="M_ApplicationID">功能模块ID号</param>
 /// <param name="M_PageCode">M_PageCode</param>
 /// <returns>返回sys_ModuleTable实体类 ModuleID为0则无记录</returns>
 public static sys_ModuleTable sys_ModuleDisp(int M_ApplicationID, string M_PageCode)
 {
     sys_ModuleTable fam = new sys_ModuleTable();
     QueryParam qp = new QueryParam();
     qp.PageIndex = 1;
     qp.PageSize = 1;
     qp.Where = string.Format(" Where sys_Module.M_ApplicationID = {0} and M_PageCode = '{1}'", M_ApplicationID, Common.inSQL(M_PageCode));
     int RecordCount = 0;
     ArrayList lst = sys_ModuleList(qp, out RecordCount);
     if (RecordCount > 0)
     {
         fam = (sys_ModuleTable)lst[0];
     }
     return fam;
 }
Beispiel #7
0
 /// <summary>
 /// 根据ID返回 sys_ModuleTable实体类 单笔资料
 /// </summary>
 /// <param name="ModuleID">功能模块ID号</param>
 /// <returns>返回sys_ModuleTable实体类 ModuleID为0则无记录</returns>
 public static sys_ModuleTable sys_ModuleDisp(int ModuleID)
 {
     sys_ModuleTable fam = new sys_ModuleTable();
     QueryParam qp = new QueryParam();
     qp.PageIndex = 1;
     qp.PageSize = 1;
     qp.Where = " Where sys_Module.ModuleID = " + ModuleID;
     int RecordCount = 0;
     ArrayList lst = sys_ModuleList(qp, out RecordCount);
     if (RecordCount > 0)
     {
         fam = (sys_ModuleTable)lst[0];
     }
     return fam;
 }
Beispiel #8
0
 /// <summary>
 /// 新增/删除/修改 sys_Module
 /// </summary>
 /// <param name="fam">sys_ModuleTable实体类</param>
 /// <returns>返回0操正常</returns>
 public static int sys_ModuleInsertUpdate(sys_ModuleTable fam)
 {
     return DataProvider.Instance().sys_ModuleInsertUpdate(fam);
 }