Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //登录验证
            Cms.Model.C_admin admin = adminUser.GetLoginState();
            Application["adminname"] = admin.user_name;

            int userId = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");//ID



            string action = this.Request.QueryString["action"] ?? "";//编辑:edit 添加:add
            switch (action)
            {
            case "add":
                break;

            case "edit":
                if (new Cms.BLL.C_user().Exists(userId))
                {
                    this.DataBind(userId);    //绑定信息
                }
                break;
            }
        }
    }
Beispiel #2
0
    public static bool setpurview(string classname, string type)
    {
        bool bl = false;

        if (adminUser.GetLoginState() != null)
        {
            Cms.BLL.C_admin_role_value cvalue = new Cms.BLL.C_admin_role_value();
            Cms.Model.C_admin          admin  = adminUser.GetLoginState();
            HttpCookie cookie   = System.Web.HttpContext.Current.Request.Cookies["admin"];
            string     username = admin.user_name;
            if (username == "admin")
            {
                bl = true;
            }
            else
            {
                string    role_id = admin.role_id.ToString();;
                DataTable dt      = cvalue.GetList("nav_name='" + classname + "' and role_id=" + role_id + "").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    string actiontype = dt.Rows[0]["action_type"].ToString();
                    if (actiontype.IndexOf(type) > -1)
                    {
                        bl = true;
                    }
                }
            }
        }

        return(bl);
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(Admin_product_edit)); //注册Ajax可调用的类的名称
        int id = Convert.ToInt32(this.Request.QueryString["id"] ?? "0"); //ID

        if (!Page.IsPostBack)
        {
            //登录验证
            Cms.Model.C_admin admin = adminUser.GetLoginState();
            Application["adminname"] = admin.user_name;
            DropList_Bind();                                          //绑定分类
            this.hreflist.HRef = "list.aspx";                         //设置返回列表链接
            string action = this.Request.QueryString["action"] ?? ""; //编辑:edit 添加:add
            switch (action)
            {
            case "add":
                break;

            case "edit":
                if (!new Cms.BLL.C_product().Exists(id))
                {
                    JscriptMsg("不存在或已被删除!", "back", "Error");
                    return;
                }
                this.DataBind(id);    //绑定信息
                break;
            }
        }
        else
        {
        }
    }
Beispiel #4
0
 /// <summary>
 /// 判断管理员是否已经登录(解决Session超时问题)
 /// </summary>
 public bool IsAdminLogin()
 {
     //如果Session为Null
     if (Session["adminname"] != null)
     {
         return(true);
     }
     else
     {
         //检查Cookies
         HttpCookie cookie    = System.Web.HttpContext.Current.Request.Cookies["admin"];
         string     adminname = (string)cookie.Values["adminname"];
         string     adminpwd  = (string)cookie.Values["adminPwd"];
         if (adminname != "" && adminpwd != "")
         {
             Cms.BLL.C_admin   bll   = new Cms.BLL.C_admin();
             Cms.Model.C_admin model = bll.GetModel(adminname, adminpwd);
             if (model != null)
             {
                 Session["adminname"] = model;
                 return(true);
             }
         }
     }
     return(false);
 }
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //登录验证
            Cms.Model.C_admin admin = adminUser.GetLoginState();
            Application["adminname"] = admin.user_name;

            string where = "select * from C_order  order by id desc";
            this.AspNetPager1.AlwaysShow  = true;
            this.AspNetPager1.PageSize    = 10;
            this.AspNetPager1.RecordCount = bllorder.GetRecordCount("");
            this.RepeaterDataBind(where);

            int    id     = Convert.ToInt32(this.Request.QueryString["id"] ?? "0"); //订单ID
            string action = this.Request.QueryString["action"] ?? "";               //编辑:edit 添加:add
            switch (action)
            {
            case "Updateorder":
                this.Updateorder(id);    // 赋值操作信息
                break;

            case "UpdateRefund":
                this.UpdateRefund(id);
                break;
            }
        }
    }
Beispiel #6
0
    //保存
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            string strErr = "";
            if (this.txtreqKeywords.Text.Trim().Length == 0)
            {
                strErr += "关键词不能为空!";
            }

            if (strErr != "")
            {
                JscriptMsg(strErr, "back", "Error");
                return;
            }

            Cms.Model.C_admin admin = adminUser.GetLoginState();


            int rid = int.Parse(hidrId.Value);                                 //规则id
            AddRule(rid);
            adminUser.AddAdminLog(Enums.ActionEnum.Edit.ToString(), "编辑图文回复"); //记录日志
            MessageBox.ResponseScript(this, " api.close(); ");
        }
        catch
        {
            JscriptMsg("编辑回复规则有问题!", "", "Error");
        }
    }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(Admin_index));//注册Ajax可调用的类的名称
        if (!Page.IsPostBack)
        {
            //登录验证
            Cms.Model.C_admin admin = adminUser.GetLoginState();
            Application["adminname"] = admin.user_name;
            Application["adminType"] = new Cms.BLL.C_admin_role().GetModel(Convert.ToInt32(admin.role_id)).role_name.ToString();

            // string action = this.Request.QueryString["action"] ?? "add";//编辑:edit 添加:add
            string column = this.Request.QueryString["id"] ?? "26";           //编辑:edit 添加:add
            bind_RepeaterNav();                                               //加载菜单
            this.files.InnerHtml = ListControl_Bind(Convert.ToInt32(column)); //加载栏目
            //switch (action)
            //{
            //    case "add":
            //        this.files.InnerHtml = ListControl_Bind(Convert.ToInt32(column));//加载栏目
            //        break;
            //    case "edit":
            //        this.files.InnerHtml = ListControl_Bind(Convert.ToInt32(column));//加载栏目
            //        break;
            //}
        }
    }
Beispiel #8
0
    private bool DoAdd()
    {
        string strErr = "";

        if (this.txtreqKeywords.Text.Trim().Length == 0)
        {
            strErr += "关键词不能为空!";
        }
        if (this.txtrContent.Text.Trim().Length == 0)
        {
            strErr += "内容或简介不能为空!";
        }
        if (strErr != "")
        {
            JscriptMsg(strErr, "back", "Error");
            return(false);
        }

        Cms.Model.C_admin admin = adminUser.GetLoginState();


        Cms.Model.wx_requestRule rule = new Cms.Model.wx_requestRule();
        rule.uId          = admin.id;
        rule.wId          = 1;
        rule.ruleName     = "纯文本回复";
        rule.reqKeywords  = txtreqKeywords.Text.Trim();
        rule.reqestType   = 1;
        rule.responseType = 1;
        string radoValue = rblisLikeSearch.SelectedItem.Value;

        if (radoValue == "0")
        {
            rule.isLikeSearch = false;
        }
        else
        {
            rule.isLikeSearch = true;
        }
        rule.createDate = DateTime.Now;
        int rId = rBll.Add(rule);

        Cms.Model.wx_requestRuleContent rc = new Cms.Model.wx_requestRuleContent();
        rc.uId        = admin.id;
        rc.rId        = rId;
        rc.rContent   = txtrContent.Text.Trim();
        rc.createDate = DateTime.Now;
        int rcId = rcBll.Add(rc);


        if (rcId > 0)
        {
            adminUser.AddAdminLog(Enums.ActionEnum.Add.ToString(), "添加纯文本回复,主键为:" + rId + ",关键词为:" + txtreqKeywords.Text.Trim()); //记录日志
            return(true);
        }
        return(false);
    }
Beispiel #9
0
 /// <summary>
 /// 取得管理员信息
 /// </summary>
 public Cms.Model.C_admin GetAdminInfo()
 {
     if (IsAdminLogin())
     {
         Cms.Model.C_admin model = Session["adminname"] as Cms.Model.C_admin;
         if (model != null)
         {
             return(model);
         }
     }
     return(null);
 }
Beispiel #10
0
    /// <summary>
    /// 写入管理日志
    /// </summary>
    public static bool AddAdminLog(string action_type, string remark)
    {
        Cms.Model.C_admin admin = adminUser.GetLoginState();
        int newId = new Cms.BLL.C_admin_log().Add(admin.id, admin.user_name, action_type, remark);

        if (newId > 0)
        {
            return(true);
        }

        return(false);
    }
Beispiel #11
0
    /// <summary>
    /// 检查管理员权限
    /// </summary>
    /// <param name="nav_name">菜单名称</param>
    /// <param name="action_type">操作类型</param>
    public void ChkAdminLevel(string nav_name, string action_type)
    {
        Cms.Model.C_admin    model = GetAdminInfo();
        Cms.BLL.C_admin_role bll   = new Cms.BLL.C_admin_role();
        bool result = bll.Exists(model.role_id);

        if (!result)
        {
            string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\", \"Error\")";
            Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
            Response.End();
        }
    }
Beispiel #12
0
 public static Cms.Model.C_admin GetLoginState(string id)
 {
     Cms.Model.C_admin model = null;
     if (id == null || id.Length <= 0)
     {
         WebHint.ShowError("登录超时,请重新登录", "/admin/login.aspx", true, "Error");
     }
     else
     {
         model = new Cms.BLL.C_admin().GetModel(Convert.ToInt32(id));
     }
     return(model);
 }
Beispiel #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.keywords = DTRequest.GetQueryString("keywords");

        this.pageSize = GetPageSize(10); //每页数量

        if (!Page.IsPostBack)
        {
            //登录验证
            Cms.Model.C_admin admin = adminUser.GetLoginState();
            Application["adminname"] = admin.user_name;
            RptBind(CombSqlTxt(keywords), "createDate desc,id desc");
        }
    }
Beispiel #14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         //登录验证
         Cms.Model.C_admin admin = adminUser.GetLoginState();
         Application["adminname"] = admin.user_name;
         setqx();
         string where = "select * from C_integral_product order by id desc,sortId desc";
         this.AspNetPager1.AlwaysShow  = true;
         this.AspNetPager1.PageSize    = 10;
         this.AspNetPager1.RecordCount = new Cms.BLL.C_integral_product().GetRecordCount("");
         this.RepeaterDataBind(where);
     }
 }
Beispiel #15
0
    /// <summary>
    /// 判断登录状态
    /// </summary>
    /// <param name="ip"></param>
    /// <returns></returns>
    public static Cms.Model.C_admin GetLoginState()
    {
        HttpCookie cookie = (HttpCookie)HttpContext.Current.Request.Cookies["admin"];
        string     id     = "";

        if (cookie != null)
        {
            id = Convert.ToString(cookie.Values["id"]);
        }
        else if (HttpContext.Current.Session["id"] != null)
        {
            id = Convert.ToString(HttpContext.Current.Session["id"]);
        }
        Cms.Model.C_admin model = adminUser.GetLoginState(id);
        return(model);
    }
Beispiel #16
0
 //保存
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     Cms.Model.C_admin admin            = adminUser.GetLoginState();
     Cms.Model.wx_requestRuleContent rc = new Cms.Model.wx_requestRuleContent();
     if (id != 0)
     {
         rc = rcBll.GetModel(id);
     }
     if (id == 0)
     {
         rc.rId        = rid;
         rc.uId        = admin.id;
         rc.createDate = DateTime.Now;
     }
     rc.rContent  = txtTitle.Value.Trim();
     rc.picUrl    = txtImgUrl.Text;
     rc.rContent2 = txtContent.Value.Trim();
     rc.detailUrl = txtUrl.Value.Trim();
     rc.seq       = int.Parse(txtSortId.Text.Trim());
     if (id == 0)
     {
         int ret = rcBll.Add(rc);
         if (ret > 0)
         {
             JscriptMsg("修改图文回复内容信息成功!", "tuwenMgr.aspx?rid=" + rid, "Success");
         }
         else
         {
             JscriptMsg("保存过程中发生错误!", "", "Error");
             return;
         }
     }
     else
     {
         bool ret = rcBll.Update(rc);
         if (ret)
         {
             JscriptMsg("添加图文回复内容信息成功!", "tuwenMgr.aspx?rid=" + rid, "Success");
         }
         else
         {
             JscriptMsg("保存过程中发生错误!", "", "Error");
             return;
         }
     }
 }
Beispiel #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.prolistview = Utils.GetCookie("article_list_view"); //显示方式
     classid          = DTRequest.GetQueryString("classid");  //上级栏目ID
     if (!Page.IsPostBack)
     {
         //登录验证
         Cms.Model.C_admin admin = adminUser.GetLoginState();
         Application["adminname"] = admin.user_name;
         setqx();
         string where = "select * from C_article where parentId=" + Convert.ToInt32(classid) + " order by articleId desc,ordernumber desc";
         this.AspNetPager1.AlwaysShow  = true;
         this.AspNetPager1.PageSize    = 10;
         this.AspNetPager1.RecordCount = bllarticle.GetRecordCount("parentId=" + Convert.ToInt32(classid) + "");
         this.RepeaterDataBind(where);
     }
 }
Beispiel #18
0
    private bool DataUpdate(int _id)
    {
        Cms.BLL.C_admin   bll   = new Cms.BLL.C_admin();
        Cms.Model.C_admin model = new Cms.Model.C_admin();
        model.id        = _id;
        model.role_id   = int.Parse(ddlRoleId.SelectedValue);
        model.role_type = new Cms.BLL.C_admin_role().GetModel(model.role_id).role_type;
        if (cbIsLock.Checked == true)
        {
            model.is_lock = 0;
        }
        else
        {
            model.is_lock = 1;
        }
        ////检测用户名是否重复
        //if (bll.Exists(txtUserName.Text.Trim()))
        //{
        //    return false;
        //}
        model.user_name = txtUserName.Text.Trim();

        model.password  = txtPassword.Text.Trim();
        model.real_name = txtRealName.Text.Trim();
        model.telephone = txtTelephone.Text.Trim();
        model.email     = txtEmail.Text.Trim();
        model.add_time  = DateTime.Now;

        if (bll.Update(model))
        {
            adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), model.user_name); //记录日志

            JscriptMsg("修改信息成功!", "manager_list.aspx", "Success");
            return(true);
        }
        else
        {
            JscriptMsg("修改信息失败!", "manager_edit.aspx?action=add", "Error");
            return(false);
        }
    }
Beispiel #19
0
    /// <summary>
    /// 添加/修改规则
    /// </summary>
    /// <returns></returns>
    private void AddRule(int id)
    {
        Cms.Model.C_admin admin = adminUser.GetLoginState();

        Cms.Model.wx_requestRule rule = new Cms.Model.wx_requestRule();
        if (id == 0)
        {
            rule.uId      = admin.id;
            rule.wId      = 1;
            rule.ruleName = "图文回复";

            rule.isDefault    = false;
            rule.reqestType   = 1; //关键词回复
            rule.createDate   = DateTime.Now;
            rule.responseType = 2; //回复的类型:文本1,图文2,语音3,视频4,第三方接口5
        }
        else
        {
            rule = rBll.GetModel(id);
        }
        string radoValue = rblisLikeSearch.SelectedItem.Value;

        if (radoValue == "0")
        {
            rule.isLikeSearch = false;
        }
        else
        {
            rule.isLikeSearch = true;
        }
        rule.reqKeywords = txtreqKeywords.Text.Trim();

        if (id == 0)
        {
            rBll.Add(rule);
        }
        else
        {
            rBll.Update(rule);
        }
    }
Beispiel #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //登录验证
            Cms.Model.C_admin admin = adminUser.GetLoginState();
            Application["adminname"] = admin.user_name;

            int    id     = Convert.ToInt32(this.Request.QueryString["id"] ?? "0"); //文章类别ID=====================
            string action = this.Request.QueryString["action"] ?? "";               //编辑:edit 添加:add========================
            switch (action)
            {
            case "add":
                break;

            case "edit":
                this.ShowInfo(id);    //绑定栏目信息===========================================
                break;
            }
        }
    }
Beispiel #21
0
    public void bind_date(int _id)
    {
        Cms.BLL.C_admin   bll   = new Cms.BLL.C_admin();
        Cms.Model.C_admin model = bll.GetModel(_id);
        ddlRoleId.SelectedValue = model.role_id.ToString();
        if (model.is_lock == 0)
        {
            cbIsLock.Checked = true;
        }
        else
        {
            cbIsLock.Checked = false;
        }
        txtUserName.Text = model.user_name;

        txtUserName.Attributes.Remove("ajaxurl");

        txtPassword.Text  = model.password;
        txtPassword1.Text = model.password;
        txtRealName.Text  = model.real_name;
        txtTelephone.Text = model.telephone;
        txtEmail.Text     = model.email;
    }
Beispiel #22
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Cms.Model.C_admin model)
 {
     return(dal.Add(model));
 }
Beispiel #23
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Cms.Model.C_admin model)
 {
     return(dal.Update(model));
 }