Пример #1
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Supplier_Limit model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Supplier_Limit](");
                strSql.Append("parentid,Code,Name,Sort)");
                strSql.Append(" values (");
                strSql.Append("@parentid,@Code,@Name,@Sort)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@parentid", model.parentid),
                    new SqlParameter("@Code",     model.Code),
                    new SqlParameter("@Name",     model.Name),
                    new SqlParameter("@Sort",     model.Sort)
                };

                object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
Пример #2
0
 public static bool Power(string code, string name, string powercodes = "")
 {
     if (RequestTool.GetConfigKey("DemoSite").Trim() == "1")
     {
         return(false);
     }
     if (powercodes.Contains("'" + code + "'"))
     {
         return(true);
     }
     else
     {
         Lebi_Supplier_Limit limit = B_Lebi_Supplier_Limit.GetModel("Code='" + code + "'");
         if (limit == null)
         {
             limit = B_Lebi_Supplier_Limit.GetModel("Code='default'");
             if (limit == null)
             {
                 limit          = new Lebi_Supplier_Limit();
                 limit.parentid = 0;
                 limit.id       = 1;
                 limit.Code     = "default";
                 limit.Name     = "未分组";
                 B_Lebi_Supplier_Limit.Add(limit);
                 limit.id = B_Lebi_Supplier_Limit.GetMaxId();
             }
             limit.Code     = code;
             limit.Name     = name;
             limit.parentid = limit.id;
             B_Lebi_Supplier_Limit.Add(limit);
         }
     }
     return(false);
 }
Пример #3
0
            /// <summary>
            /// 得到一个对象实体 by SQLpara
            /// </summary>
            public Lebi_Supplier_Limit GetModel(SQLPara para)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select top 1 * from [Lebi_Supplier_Limit] ");
                if (para.Where != "")
                {
                    strSql.Append(" where " + para.Where + "");
                }
                Lebi_Supplier_Limit model = new Lebi_Supplier_Limit();
                DataSet             ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), para.Para);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["parentid"].ToString() != "")
                    {
                        model.parentid = int.Parse(ds.Tables[0].Rows[0]["parentid"].ToString());
                    }
                    model.Code = ds.Tables[0].Rows[0]["Code"].ToString();
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Пример #4
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Supplier_Limit model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Supplier_Limit] set ");
                strSql.Append("parentid= @parentid,");
                strSql.Append("Code= @Code,");
                strSql.Append("Name= @Name,");
                strSql.Append("Sort= @Sort");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",       SqlDbType.Int,        4),
                    new SqlParameter("@parentid", SqlDbType.Int,        4),
                    new SqlParameter("@Code",     SqlDbType.VarChar,   50),
                    new SqlParameter("@Name",     SqlDbType.NVarChar, 500),
                    new SqlParameter("@Sort",     SqlDbType.Int, 4)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.parentid;
                parameters[2].Value = model.Code;
                parameters[3].Value = model.Name;
                parameters[4].Value = model.Sort;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Пример #5
0
        /// <summary>
        /// 编辑权限
        /// </summary>
        public void limit_Edit()
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                AjaxNoPower();
                return;
            }
            int id = RequestTool.RequestInt("id", 0);
            Lebi_Supplier_Limit model = B_Lebi_Supplier_Limit.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Supplier_Limit();
                model = B_Lebi_Supplier_Limit.BindForm(model);
                B_Lebi_Supplier_Limit.Add(model);
                string action      = Tag("添加权限分组");
                string description = Shop.Bussiness.Language.Content(Language.RequestString("Name"), "CN");
                Log.Add(action, "Supplier_Group", model.id.ToString(), CurrentAdmin, description);
            }
            else
            {
                model = B_Lebi_Supplier_Limit.BindForm(model);
                B_Lebi_Supplier_Limit.Update(model);
                string action      = Tag("编辑权限分组");
                string description = Shop.Bussiness.Language.Content(Language.RequestString("Name"), "CN");
                Log.Add(action, "Supplier_Group", model.id.ToString(), CurrentAdmin, description);
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                PageNoPower();
            }
            int id = RequestTool.RequestInt("id", 0);

            model = B_Lebi_Supplier_Limit.GetModel(id);
            if (model == null)
            {
                model = new Lebi_Supplier_Limit();
            }
        }
Пример #7
0
        /// <summary>
        /// 删除一个权限代码
        /// </summary>
        public void limit_Del()
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                AjaxNoPower();
                return;
            }
            int id = RequestTool.RequestInt("id", 0);
            Lebi_Supplier_Limit model = B_Lebi_Supplier_Limit.GetModel(id);
            string action             = Tag("删除权限分组");
            string description        = Shop.Bussiness.Language.Content(model.Name, "CN");

            Log.Add(action, "Supplier_Group", id.ToString(), CurrentAdmin, description);
            B_Lebi_Supplier_Limit.Delete(id);
            Response.Write("{\"msg\":\"OK\"}");
        }
Пример #8
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Supplier_Limit model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Supplier_Limit](");
                strSql.Append("[parentid],[Code],[Name],[Sort])");
                strSql.Append(" values (");
                strSql.Append("@parentid,@Code,@Name,@Sort)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@parentid", model.parentid),
                    new OleDbParameter("@Code",     model.Code),
                    new OleDbParameter("@Name",     model.Name),
                    new OleDbParameter("@Sort",     model.Sort)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
Пример #9
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Supplier_Limit model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Supplier_Limit] set ");
                strSql.Append("[parentid]=@parentid,");
                strSql.Append("[Code]=@Code,");
                strSql.Append("[Name]=@Name,");
                strSql.Append("[Sort]=@Sort");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@parentid", model.parentid),
                    new OleDbParameter("@Code",     model.Code),
                    new OleDbParameter("@Name",     model.Name),
                    new OleDbParameter("@Sort",     model.Sort)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Пример #10
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Supplier_Limit SafeBindForm(Lebi_Supplier_Limit model)
 {
     if (HttpContext.Current.Request["parentid"] != null)
     {
         model.parentid = Shop.Tools.RequestTool.RequestInt("parentid", 0);
     }
     if (HttpContext.Current.Request["Code"] != null)
     {
         model.Code = Shop.Tools.RequestTool.RequestSafeString("Code");
     }
     if (HttpContext.Current.Request["Name"] != null)
     {
         model.Name = Shop.Tools.RequestTool.RequestSafeString("Name");
     }
     if (HttpContext.Current.Request["Sort"] != null)
     {
         model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0);
     }
     return(model);
 }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Power("supplier_power_edit", "编辑分组权限"))
            {
                AjaxNoPower();
                return;
            }
            models = GetLimit(0);
            int id = RequestTool.RequestInt("id", 0);

            group = B_Lebi_Supplier_UserGroup.GetModel("Supplier_id = " + CurrentSupplier.id + " and id = " + id);
            if (group == null)
            {
                PageError();
            }
            ps            = B_Lebi_Supplier_Power.GetList("Supplier_Group_id=" + group.id + " and Url=''", "");
            defaultparent = B_Lebi_Supplier_Limit.GetModel("Code='default'");
            if (defaultparent != null)
            {
                count = B_Lebi_Supplier_Limit.Counts("parentid = " + defaultparent.id + ""); //未分组
            }
        }
Пример #12
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_Supplier_Limit GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_Supplier_Limit] ");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id", SqlDbType.Int, 4)
                };
                parameters[0].Value = id;

                Lebi_Supplier_Limit model = new Lebi_Supplier_Limit();
                DataSet             ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["parentid"].ToString() != "")
                    {
                        model.parentid = int.Parse(ds.Tables[0].Rows[0]["parentid"].ToString());
                    }
                    model.Code = ds.Tables[0].Rows[0]["Code"].ToString();
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            models = GetLimit(0);
            int id = RequestTool.RequestInt("id", 0);

            group = B_Lebi_Supplier_Group.GetModel(id);
            if (group == null)
            {
                PageError();
            }
            ps            = B_Lebi_Supplier_Power.GetList("Supplier_Group_id=" + group.id + " and Url=''", "");
            purls         = B_Lebi_Supplier_Power.GetList("Supplier_Group_id=" + group.id + " and Url!=''", "");
            defaultparent = B_Lebi_Supplier_Limit.GetModel("Code='default'");
            if (defaultparent != null)
            {
                count = B_Lebi_Supplier_Limit.Counts("parentid = " + defaultparent.id + ""); //未分组
            }
        }
Пример #14
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_Supplier_Limit ReaderBind(IDataReader dataReader)
            {
                Lebi_Supplier_Limit model = new Lebi_Supplier_Limit();
                object ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                ojb = dataReader["parentid"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.parentid = (int)ojb;
                }
                model.Code = dataReader["Code"].ToString();
                model.Name = dataReader["Name"].ToString();
                ojb        = dataReader["Sort"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Sort = (int)ojb;
                }
                return(model);
            }
Пример #15
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Supplier_Limit SafeBindForm(Lebi_Supplier_Limit model)
 {
     return(D_Lebi_Supplier_Limit.Instance.SafeBindForm(model));
 }
Пример #16
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Supplier_Limit model)
 {
     D_Lebi_Supplier_Limit.Instance.Update(model);
 }
Пример #17
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Supplier_Limit model)
 {
     return(D_Lebi_Supplier_Limit.Instance.Add(model));
 }