Esempio n. 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.sys_Module DataRowToModel(DataRow row)
 {
     Maticsoft.Model.sys_Module model = new Maticsoft.Model.sys_Module();
     if (row != null)
     {
         if (row["ModuleID"] != null && row["ModuleID"].ToString() != "")
         {
             model.ModuleID = int.Parse(row["ModuleID"].ToString());
         }
         if (row["M_ApplicationID"] != null && row["M_ApplicationID"].ToString() != "")
         {
             model.M_ApplicationID = int.Parse(row["M_ApplicationID"].ToString());
         }
         if (row["M_ParentID"] != null && row["M_ParentID"].ToString() != "")
         {
             model.M_ParentID = int.Parse(row["M_ParentID"].ToString());
         }
         if (row["M_PageCode"] != null)
         {
             model.M_PageCode = row["M_PageCode"].ToString();
         }
         if (row["M_CName"] != null)
         {
             model.M_CName = row["M_CName"].ToString();
         }
         if (row["M_Directory"] != null)
         {
             model.M_Directory = row["M_Directory"].ToString();
         }
         if (row["M_OrderLevel"] != null)
         {
             model.M_OrderLevel = row["M_OrderLevel"].ToString();
         }
         if (row["M_IsSystem"] != null && row["M_IsSystem"].ToString() != "")
         {
             model.M_IsSystem = int.Parse(row["M_IsSystem"].ToString());
         }
         if (row["M_Close"] != null && row["M_Close"].ToString() != "")
         {
             model.M_Close = int.Parse(row["M_Close"].ToString());
         }
         if (row["M_Icon"] != null)
         {
             model.M_Icon = row["M_Icon"].ToString();
         }
         if (row["M_Info"] != null)
         {
             model.M_Info = row["M_Info"].ToString();
         }
     }
     return(model);
 }
Esempio n. 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.sys_Module DataRowToModel(DataRow row)
 {
     Maticsoft.Model.sys_Module model=new Maticsoft.Model.sys_Module();
     if (row != null)
     {
         if(row["ModuleID"]!=null && row["ModuleID"].ToString()!="")
         {
             model.ModuleID=int.Parse(row["ModuleID"].ToString());
         }
         if(row["M_ApplicationID"]!=null && row["M_ApplicationID"].ToString()!="")
         {
             model.M_ApplicationID=int.Parse(row["M_ApplicationID"].ToString());
         }
         if(row["M_ParentID"]!=null && row["M_ParentID"].ToString()!="")
         {
             model.M_ParentID=int.Parse(row["M_ParentID"].ToString());
         }
         if(row["M_PageCode"]!=null)
         {
             model.M_PageCode=row["M_PageCode"].ToString();
         }
         if(row["M_CName"]!=null)
         {
             model.M_CName=row["M_CName"].ToString();
         }
         if(row["M_Directory"]!=null)
         {
             model.M_Directory=row["M_Directory"].ToString();
         }
         if(row["M_OrderLevel"]!=null)
         {
             model.M_OrderLevel=row["M_OrderLevel"].ToString();
         }
         if(row["M_IsSystem"]!=null && row["M_IsSystem"].ToString()!="")
         {
             model.M_IsSystem=int.Parse(row["M_IsSystem"].ToString());
         }
         if(row["M_Close"]!=null && row["M_Close"].ToString()!="")
         {
             model.M_Close=int.Parse(row["M_Close"].ToString());
         }
         if(row["M_Icon"]!=null)
         {
             model.M_Icon=row["M_Icon"].ToString();
         }
         if(row["M_Info"]!=null)
         {
             model.M_Info=row["M_Info"].ToString();
         }
     }
     return model;
 }
Esempio n. 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.sys_Module model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sys_Module set ");
            strSql.Append("M_ParentID=@M_ParentID,");
            strSql.Append("M_CName=@M_CName,");
            strSql.Append("M_Directory=@M_Directory,");
            strSql.Append("M_OrderLevel=@M_OrderLevel,");
            strSql.Append("M_IsSystem=@M_IsSystem,");
            strSql.Append("M_Close=@M_Close,");
            strSql.Append("M_Icon=@M_Icon,");
            strSql.Append("M_Info=@M_Info");
            strSql.Append(" where ModuleID=@ModuleID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@M_ParentID",      SqlDbType.Int,        4),
                new SqlParameter("@M_CName",         SqlDbType.NVarChar,  50),
                new SqlParameter("@M_Directory",     SqlDbType.NVarChar, 255),
                new SqlParameter("@M_OrderLevel",    SqlDbType.VarChar,    4),
                new SqlParameter("@M_IsSystem",      SqlDbType.TinyInt,    1),
                new SqlParameter("@M_Close",         SqlDbType.TinyInt,    1),
                new SqlParameter("@M_Icon",          SqlDbType.VarChar,  255),
                new SqlParameter("@M_Info",          SqlDbType.NVarChar, 500),
                new SqlParameter("@ModuleID",        SqlDbType.Int,        4),
                new SqlParameter("@M_ApplicationID", SqlDbType.Int,        4),
                new SqlParameter("@M_PageCode",      SqlDbType.VarChar, 100)
            };
            parameters[0].Value  = model.M_ParentID;
            parameters[1].Value  = model.M_CName;
            parameters[2].Value  = model.M_Directory;
            parameters[3].Value  = model.M_OrderLevel;
            parameters[4].Value  = model.M_IsSystem;
            parameters[5].Value  = model.M_Close;
            parameters[6].Value  = model.M_Icon;
            parameters[7].Value  = model.M_Info;
            parameters[8].Value  = model.ModuleID;
            parameters[9].Value  = model.M_ApplicationID;
            parameters[10].Value = model.M_PageCode;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
 private void ShowInfo(int ModuleID)
 {
     Maticsoft.BLL.sys_Module   bll   = new Maticsoft.BLL.sys_Module();
     Maticsoft.Model.sys_Module model = bll.GetModel(ModuleID);
     this.lblModuleID.Text        = model.ModuleID.ToString();
     this.lblM_ApplicationID.Text = model.M_ApplicationID.ToString();
     this.lblM_ParentID.Text      = model.M_ParentID.ToString();
     this.lblM_PageCode.Text      = model.M_PageCode;
     this.lblM_CName.Text         = model.M_CName;
     this.lblM_Directory.Text     = model.M_Directory;
     this.lblM_OrderLevel.Text    = model.M_OrderLevel;
     this.lblM_IsSystem.Text      = model.M_IsSystem.ToString();
     this.lblM_Close.Text         = model.M_Close.ToString();
     this.lblM_Icon.Text          = model.M_Icon;
     this.lblM_Info.Text          = model.M_Info;
 }
Esempio n. 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.sys_Module model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into sys_Module(");
            strSql.Append("M_ApplicationID,M_ParentID,M_PageCode,M_CName,M_Directory,M_OrderLevel,M_IsSystem,M_Close,M_Icon,M_Info)");
            strSql.Append(" values (");
            strSql.Append("@M_ApplicationID,@M_ParentID,@M_PageCode,@M_CName,@M_Directory,@M_OrderLevel,@M_IsSystem,@M_Close,@M_Icon,@M_Info)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@M_ApplicationID", SqlDbType.Int,        4),
                new SqlParameter("@M_ParentID",      SqlDbType.Int,        4),
                new SqlParameter("@M_PageCode",      SqlDbType.VarChar,  100),
                new SqlParameter("@M_CName",         SqlDbType.NVarChar,  50),
                new SqlParameter("@M_Directory",     SqlDbType.NVarChar, 255),
                new SqlParameter("@M_OrderLevel",    SqlDbType.VarChar,    4),
                new SqlParameter("@M_IsSystem",      SqlDbType.TinyInt,    1),
                new SqlParameter("@M_Close",         SqlDbType.TinyInt,    1),
                new SqlParameter("@M_Icon",          SqlDbType.VarChar,  255),
                new SqlParameter("@M_Info",          SqlDbType.NVarChar, 500)
            };
            parameters[0].Value = model.M_ApplicationID;
            parameters[1].Value = model.M_ParentID;
            parameters[2].Value = model.M_PageCode;
            parameters[3].Value = model.M_CName;
            parameters[4].Value = model.M_Directory;
            parameters[5].Value = model.M_OrderLevel;
            parameters[6].Value = model.M_IsSystem;
            parameters[7].Value = model.M_Close;
            parameters[8].Value = model.M_Icon;
            parameters[9].Value = model.M_Info;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.sys_Module GetModel(int ModuleID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ModuleID,M_ApplicationID,M_ParentID,M_PageCode,M_CName,M_Directory,M_OrderLevel,M_IsSystem,M_Close,M_Icon,M_Info from sys_Module ");
            strSql.Append(" where ModuleID=@ModuleID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ModuleID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ModuleID;

            Maticsoft.Model.sys_Module model = new Maticsoft.Model.sys_Module();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 7
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txtM_ParentID.Text))
            {
                strErr+="所属父级模块ID与Module格式错误!\\n";
            }
            if(this.txtM_CName.Text.Trim().Length==0)
            {
                strErr+="模块/栏目名称当ParentI不能为空!\\n";
            }
            if(this.txtM_Directory.Text.Trim().Length==0)
            {
                strErr+="模块/栏目???录名不能为空!\\n";
            }
            if(this.txtM_OrderLevel.Text.Trim().Length==0)
            {
                strErr+="当前所在排序级别支持双层99级不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtM_IsSystem.Text))
            {
                strErr+="是否为系统模块1:是0:否如为格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtM_Close.Text))
            {
                strErr+="是否关闭1:是0:否格式错误!\\n";
            }
            if(this.txtM_Icon.Text.Trim().Length==0)
            {
                strErr+="模块Icon不能为空!\\n";
            }
            if(this.txtM_Info.Text.Trim().Length==0)
            {
                strErr+="模块说明不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int ModuleID=int.Parse(this.lblModuleID.Text);
            int M_ApplicationID=int.Parse(this.lblM_ApplicationID.Text);
            int M_ParentID=int.Parse(this.txtM_ParentID.Text);
            string M_PageCode=this.lblM_PageCode.Text;
            string M_CName=this.txtM_CName.Text;
            string M_Directory=this.txtM_Directory.Text;
            string M_OrderLevel=this.txtM_OrderLevel.Text;
            int M_IsSystem=int.Parse(this.txtM_IsSystem.Text);
            int M_Close=int.Parse(this.txtM_Close.Text);
            string M_Icon=this.txtM_Icon.Text;
            string M_Info=this.txtM_Info.Text;

            Maticsoft.Model.sys_Module model=new Maticsoft.Model.sys_Module();
            model.ModuleID=ModuleID;
            model.M_ApplicationID=M_ApplicationID;
            model.M_ParentID=M_ParentID;
            model.M_PageCode=M_PageCode;
            model.M_CName=M_CName;
            model.M_Directory=M_Directory;
            model.M_OrderLevel=M_OrderLevel;
            model.M_IsSystem=M_IsSystem;
            model.M_Close=M_Close;
            model.M_Icon=M_Icon;
            model.M_Info=M_Info;

            Maticsoft.BLL.sys_Module bll=new Maticsoft.BLL.sys_Module();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Esempio n. 8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.sys_Module GetModel(int ModuleID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ModuleID,M_ApplicationID,M_ParentID,M_PageCode,M_CName,M_Directory,M_OrderLevel,M_IsSystem,M_Close,M_Icon,M_Info from sys_Module ");
            strSql.Append(" where ModuleID=@ModuleID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ModuleID", SqlDbType.Int,4)
            };
            parameters[0].Value = ModuleID;

            Maticsoft.Model.sys_Module model=new Maticsoft.Model.sys_Module();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Esempio n. 9
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtM_ParentID.Text))
            {
                strErr += "所属父级模块ID与Module格式错误!\\n";
            }
            if (this.txtM_CName.Text.Trim().Length == 0)
            {
                strErr += "模块/栏目名称当ParentI不能为空!\\n";
            }
            if (this.txtM_Directory.Text.Trim().Length == 0)
            {
                strErr += "模块/栏目???录名不能为空!\\n";
            }
            if (this.txtM_OrderLevel.Text.Trim().Length == 0)
            {
                strErr += "当前所在排序级别支持双层99级不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtM_IsSystem.Text))
            {
                strErr += "是否为系统模块1:是0:否如为格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtM_Close.Text))
            {
                strErr += "是否关闭1:是0:否格式错误!\\n";
            }
            if (this.txtM_Icon.Text.Trim().Length == 0)
            {
                strErr += "模块Icon不能为空!\\n";
            }
            if (this.txtM_Info.Text.Trim().Length == 0)
            {
                strErr += "模块说明不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    ModuleID        = int.Parse(this.lblModuleID.Text);
            int    M_ApplicationID = int.Parse(this.lblM_ApplicationID.Text);
            int    M_ParentID      = int.Parse(this.txtM_ParentID.Text);
            string M_PageCode      = this.lblM_PageCode.Text;
            string M_CName         = this.txtM_CName.Text;
            string M_Directory     = this.txtM_Directory.Text;
            string M_OrderLevel    = this.txtM_OrderLevel.Text;
            int    M_IsSystem      = int.Parse(this.txtM_IsSystem.Text);
            int    M_Close         = int.Parse(this.txtM_Close.Text);
            string M_Icon          = this.txtM_Icon.Text;
            string M_Info          = this.txtM_Info.Text;


            Maticsoft.Model.sys_Module model = new Maticsoft.Model.sys_Module();
            model.ModuleID        = ModuleID;
            model.M_ApplicationID = M_ApplicationID;
            model.M_ParentID      = M_ParentID;
            model.M_PageCode      = M_PageCode;
            model.M_CName         = M_CName;
            model.M_Directory     = M_Directory;
            model.M_OrderLevel    = M_OrderLevel;
            model.M_IsSystem      = M_IsSystem;
            model.M_Close         = M_Close;
            model.M_Icon          = M_Icon;
            model.M_Info          = M_Info;

            Maticsoft.BLL.sys_Module bll = new Maticsoft.BLL.sys_Module();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }