Esempio n. 1
0
        /// <summary>
        /// 增加一个模块分类
        /// </summary>
        /// <param name="model">模块分类实体类</param>
        /// <returns></returns>
        public int CreateModuleType(RedGlovePermission.Model.RGP_ModuleType model)
        {
            int ret = 0;

            if (!ModuleTypeExists(model.ModuleTypeName))
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into RGP_ModuleType(");
                strSql.Append("ModuleTypeName,ModuleTypeOrder,ModuleTypeDescription)");
                strSql.Append(" values (");
                strSql.Append("?ModuleTypeName,?ModuleTypeOrder,?ModuleTypeDescription)");
                MySqlParameter[] parameters =
                {
                    new MySqlParameter("?ModuleTypeName",        MySqlDbType.VarChar, 30),
                    new MySqlParameter("?ModuleTypeOrder",       MySqlDbType.Int32,   11),
                    new MySqlParameter("?ModuleTypeDescription", MySqlDbType.VarChar, 50)
                };
                parameters[0].Value = model.ModuleTypeName;
                parameters[1].Value = model.ModuleTypeOrder;
                parameters[2].Value = model.ModuleTypeDescription;

                if (RedGlovePermission.DBUtility.MySqlHelper.ExecuteSql(strSql.ToString(), parameters) >= 1)
                {
                    ret = 1;
                }
            }
            else
            {
                ret = 2;
            }
            return(ret);
        }
Esempio n. 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model">模块分类实体类</param>
        /// <returns></returns>
        public bool UpdateModuleType(RedGlovePermission.Model.RGP_ModuleType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update RGP_ModuleType set ");
            strSql.Append("ModuleTypeName=?ModuleTypeName,");
            strSql.Append("ModuleTypeOrder=?ModuleTypeOrder,");
            strSql.Append("ModuleTypeDescription=?ModuleTypeDescription");
            strSql.Append(" where ModuleTypeID=?ModuleTypeID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("?ModuleTypeID",          MySqlDbType.Int32,   11),
                new MySqlParameter("?ModuleTypeName",        MySqlDbType.VarChar, 30),
                new MySqlParameter("?ModuleTypeOrder",       MySqlDbType.Int32,   11),
                new MySqlParameter("?ModuleTypeDescription", MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.ModuleTypeID;
            parameters[1].Value = model.ModuleTypeName;
            parameters[2].Value = model.ModuleTypeOrder;
            parameters[3].Value = model.ModuleTypeDescription;

            if (RedGlovePermission.DBUtility.MySqlHelper.ExecuteSql(strSql.ToString(), parameters) >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 得到一个模块分类实体
        /// </summary>
        /// <param name="ModuleTypeID">模块分类ID</param>
        /// <returns></returns>
        public RedGlovePermission.Model.RGP_ModuleType GetModuleTypeModel(int ModuleTypeID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from RGP_ModuleType ");
            strSql.Append(" where ModuleTypeID=?ModuleTypeID ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("?ModuleTypeID", MySqlDbType.Int32, 11)
            };
            parameters[0].Value = ModuleTypeID;

            RedGlovePermission.Model.RGP_ModuleType model = new RedGlovePermission.Model.RGP_ModuleType();
            DataSet ds = RedGlovePermission.DBUtility.MySqlHelper.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ModuleTypeID"].ToString() != "")
                {
                    model.ModuleTypeID = int.Parse(ds.Tables[0].Rows[0]["ModuleTypeID"].ToString());
                }
                model.ModuleTypeName = ds.Tables[0].Rows[0]["ModuleTypeName"].ToString();
                if (ds.Tables[0].Rows[0]["ModuleTypeOrder"].ToString() != "")
                {
                    model.ModuleTypeOrder = int.Parse(ds.Tables[0].Rows[0]["ModuleTypeOrder"].ToString());
                }
                model.ModuleTypeDescription = ds.Tables[0].Rows[0]["ModuleTypeDescription"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 添加数据
        /// </summary>
        protected void btn_add_Click(object sender, EventArgs e)
        {
            if (txt_Name.Text.Trim() != "" || txt_order.Text.Trim() != "" || Lib.TypeParse.IsUnsign(txt_order.Text.Trim()))
            {
                RedGlovePermission.Model.RGP_ModuleType model = new RedGlovePermission.Model.RGP_ModuleType();

                model.ModuleTypeName        = txt_Name.Text.Trim();
                model.ModuleTypeDescription = txt_Description.Text.Trim();
                model.ModuleTypeOrder       = int.Parse(txt_order.Text.Trim());

                switch (bll.CreateModuleType(model))
                {
                case 1:
                    txt_Name.Text        = "";
                    txt_Description.Text = "";
                    txt_order.Text       = "";
                    BindOrder();
                    ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_add_true") + "')", true);
                    break;

                case 2:
                    ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_Istype") + "')", true);
                    break;

                default:
                    ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_add_false") + "')", true);
                    break;
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 更新数据
        /// </summary>
        protected void ModuleTypeList_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            RedGlovePermission.Model.RGP_ModuleType model = new RedGlovePermission.Model.RGP_ModuleType();
            model.ModuleTypeID          = int.Parse(ModuleTypeList.DataKeys[e.RowIndex].Values[0].ToString());
            model.ModuleTypeName        = ((TextBox)ModuleTypeList.Rows[e.RowIndex].FindControl("txt_name")).Text.Trim();
            model.ModuleTypeDescription = ((TextBox)ModuleTypeList.Rows[e.RowIndex].FindControl("txt_Description")).Text.Trim();
            model.ModuleTypeOrder       = int.Parse(((TextBox)ModuleTypeList.Rows[e.RowIndex].FindControl("txt_order")).Text);

            if (!bll.UpdateModuleType(model))
            {
                ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_update_false") + "')", true);
            }
            //返回浏览狀態
            ModuleTypeList.EditIndex = -1;
            BindOrder();
        }
Esempio n. 6
0
        /// <summary>
        /// 得到一个模块分类实体
        /// </summary>
        /// <param name="ModuleTypeID">模块分类ID</param>
        /// <returns></returns>
        public RedGlovePermission.Model.RGP_ModuleType GetModuleTypeModel(int ModuleTypeID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from RGP_ModuleType ");
            strSql.Append(" where ModuleTypeID=?ModuleTypeID ");
            MySqlParameter[] parameters = {
					new MySqlParameter("?ModuleTypeID", MySqlDbType.Int32,11)};
            parameters[0].Value = ModuleTypeID;

            RedGlovePermission.Model.RGP_ModuleType model = new RedGlovePermission.Model.RGP_ModuleType();
            DataSet ds = RedGlovePermission.DBUtility.MySqlHelper.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ModuleTypeID"].ToString() != "")
                {
                    model.ModuleTypeID = int.Parse(ds.Tables[0].Rows[0]["ModuleTypeID"].ToString());
                }
                model.ModuleTypeName = ds.Tables[0].Rows[0]["ModuleTypeName"].ToString();
                if (ds.Tables[0].Rows[0]["ModuleTypeOrder"].ToString() != "")
                {
                    model.ModuleTypeOrder = int.Parse(ds.Tables[0].Rows[0]["ModuleTypeOrder"].ToString());
                }
                model.ModuleTypeDescription = ds.Tables[0].Rows[0]["ModuleTypeDescription"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 添加数据
        /// </summary>
        protected void btn_add_Click(object sender, EventArgs e)
        {
            if (txt_Name.Text.Trim() != "" || txt_order.Text.Trim() != "" || Lib.TypeParse.IsUnsign(txt_order.Text.Trim()))
            {
                RedGlovePermission.Model.RGP_ModuleType model = new RedGlovePermission.Model.RGP_ModuleType();

                model.ModuleTypeName = txt_Name.Text.Trim();
                model.ModuleTypeDescription = txt_Description.Text.Trim();
                model.ModuleTypeOrder = int.Parse(txt_order.Text.Trim());

                switch (bll.CreateModuleType(model))
                {
                    case 1:
                        txt_Name.Text = "";
                        txt_Description.Text = "";
                        txt_order.Text = "";
                        BindOrder();
                        ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_add_true") + "')", true);
                        break;
                    case 2:
                        ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_Istype") + "')", true);                        
                        break;
                    default:
                        ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_add_false") + "')", true);
                        break;
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 更新数据
        /// </summary>
        protected void ModuleTypeList_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            RedGlovePermission.Model.RGP_ModuleType model = new RedGlovePermission.Model.RGP_ModuleType();
            model.ModuleTypeID = int.Parse(ModuleTypeList.DataKeys[e.RowIndex].Values[0].ToString());
            model.ModuleTypeName = ((TextBox)ModuleTypeList.Rows[e.RowIndex].FindControl("txt_name")).Text.Trim();
            model.ModuleTypeDescription = ((TextBox)ModuleTypeList.Rows[e.RowIndex].FindControl("txt_Description")).Text.Trim();
            model.ModuleTypeOrder = int.Parse(((TextBox)ModuleTypeList.Rows[e.RowIndex].FindControl("txt_order")).Text);

            if (!bll.UpdateModuleType(model))
            {
                ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_update_false") + "')", true);
            }
            //返回浏览狀態
            ModuleTypeList.EditIndex = -1;
            BindOrder();
        }