Exemplo n.º 1
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                string    UserName  = HttpContext.Current.Server.UrlDecode(Request.Cookies["Fadmin"]["UserName"].ToString());
                string    PassWord  = HttpContext.Current.Server.UrlDecode(Request.Cookies["Fadmin"]["PassWord"].ToString());
                string    tableName = "Sys_Admin";
                string    sqlWhere  = " and AUserName='******' and APassWord='******'";
                string    showField = "top 1 Id";
                DataTable dt_user   = new HoneyWell.BLL.Sys_Public().SelectData(showField, tableName, sqlWhere).Tables[0];
                if (dt_user == null || dt_user.Rows.Count <= 0)
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("window.alert('非法登陆系统!');");
                    Response.Write("location.href='" + ResolveUrl("~/") + "Friend.aspx';");
                    Response.Write("</script>");
                    Response.End();
                }
            }
            catch (Exception)
            {
                Response.Write("<script language='javascript'>");
                Response.Write("window.alert('异常登陆系统1!');");
                Response.Write("location.href='" + ResolveUrl("~/") + "Friend.aspx';");
                Response.Write("</script>");
            }


            base.OnInit(e);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化角色-更新
        /// </summary>
        void InitDutyUpdate()
        {
            DataTable     dt           = new HoneyWell.BLL.Sys_Public().SelectData(" ID,DutyName", "Sys_Duty", " order by DutyDesc").Tables[0];
            string        str_selected = "";
            StringBuilder sbDuty       = new StringBuilder();

            //拼接HTML-角色
            if (DutyID == 0)
            {
                str_selected = "selected=\"selected\"";
            }
            sbDuty.Append("<option value='0' " + str_selected + ">==请选择==</option>");
            foreach (DataRow dr in dt.Rows)
            {
                if (StringHelper.NullToInt(dr["ID"]) == DutyID)
                {
                    sbDuty.Append("<option value=" + StringHelper.NullToInt(dr["ID"]) + " selected=\"selected\">" + StringHelper.NullToStr(dr["DutyName"]) + "</option>");
                }
                else
                {
                    sbDuty.Append("<option value=" + StringHelper.NullToInt(dr["ID"]) + "  >" + StringHelper.NullToStr(dr["DutyName"]) + "</option>");
                }
            }

            DutyStr = sbDuty.ToString();
        }
Exemplo n.º 3
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            int result = 0;

            if (Utils.ToInt(nodeValue) > 0)
            {
                HoneyWell.Model.Sys_Menu info = new HoneyWell.BLL.Sys_Menu().GetModel(Convert.ToInt32(nodeValue));
                HoneyWell.Model.Sys_Logs logs = new HoneyWell.Model.Sys_Logs();
                logs.ID         = 0;
                logs.DutyId     = Utils.ToInt(GetDutyId());
                logs.LoginName  = GetUserName();
                logs.TitleName  = "模块管理";
                logs.Depicts    = "删除模块信息,名称为:" + info.MenuNameC + "";
                logs.CreateTime = DateTime.Now;
                logs.IpAddress  = Request.UserHostAddress;
                logs.MoreCol1   = "";
                logs.MoreCol2   = "";
                new HoneyWell.BLL.Sys_Logs().Add(logs);
                result = new HoneyWell.BLL.Sys_Public().Delete("Sys_Menu", " ID=" + Utils.ToInt(nodeValue) + "");
            }


            if (result > 0)
            {
                ScriptManager.RegisterClientScriptBlock(btnSave, GetType(), "", "alert('操作成功!');parent.location='sys_Module_Tree.aspx'", true);
            }
        }
Exemplo n.º 4
0
        public void pageBind()
        {
            string strWhere = " ";


            if (txtDutyId.SelectedValue.Trim().Length > 0)
            {
                strWhere += " and DutyId = '" + txtDutyId.SelectedValue.Trim() + "'";
            }

            if (txt_TitleName.Value.Trim().Length > 0)
            {
                strWhere += " and TitleName like '%" + txt_TitleName.Value.Trim() + "%'";
            }

            if (txt_Depicts.Value.Trim().Length > 0)
            {
                strWhere += " and Depicts like '%" + txt_Depicts.Value.Trim() + "%'";
            }

            string tableName  = "Sys_Logs";
            string showField  = " ID,DutyId,LoginName,TitleName,Depicts,IpAddress,CreateTime";
            string orderField = "ID";
            int    count      = 0;

            DataSet ds = new HoneyWell.BLL.Sys_Public().GetList(tableName, showField, orderField, MyPager.Pagesize, MyPager.Pageindex + 1, 0, strWhere, out count);

            rptLoop.DataSource = ds;
            rptLoop.DataBind();
            MyPager.Count = count;
        }
Exemplo n.º 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool result = false;

            HoneyWell.Model.Sys_Area area = SetObjectValue();

            if (nodeValue != "")
            {
                //判断区域代码是否重复
                DataSet ds = new HoneyWell.BLL.Sys_Public().SelectData("top 1 ID", "Sys_Area", " and AreaCode='" + txt_ClassCode.Value.Trim() + "' and AreaCode<>'" + nodeValue + "'");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    Response.Write("<script language='javascript'>alert('您输入的区域代码已存在,请重新输入!');location.href='sys_Area_Manage.aspx?nodeText=" + nodeText + "&nodeValue=" + nodeValue + "'</script>");
                    Response.End();
                }

                //判断区域名称是否重复
                DataSet ds1 = new HoneyWell.BLL.Sys_Public().SelectData("top 1 ID", "Sys_Area", " and AreaName='" + txt_ClassName.Value.Trim() + "' and AreaCode<>'" + nodeValue + "'");
                if (ds1 != null && ds1.Tables[0].Rows.Count > 0)
                {
                    Response.Write("<script language='javascript'>alert('您输入的区域名称已存在,请重新输入!');location.href='sys_Area_Manage.aspx?nodeText=" + nodeText + "&nodeValue=" + nodeValue + "'</script>");
                    Response.End();
                }

                result = new HoneyWell.BLL.Sys_Area().Update(area);
            }

            if (true)
            {
                ScriptManager.RegisterClientScriptBlock(btnSave, GetType(), "", "alert('操作成功!');location.href='sys_Area_Manage.aspx?nodeText=" + nodeText + "&nodeValue=" + nodeValue + "'", true);
            }
        }
Exemplo n.º 6
0
        public void pageBind()
        {
            string strWhere = " ";


            if (txtDutyId.SelectedValue.Trim().Length > 0)
            {
                strWhere += " and DutyId = '" + txtDutyId.SelectedValue.Trim() + "'";
            }


            if (txtLoginName.Value.Trim().Length > 0)
            {
                strWhere += " and AUserName ='******'";
            }

            string tableName  = "Sys_Admin";
            string showField  = " ID,DutyId,AUserName,Remark,ModifyTime";
            string orderField = "ID";
            int    count      = 0;

            DataSet ds = new HoneyWell.BLL.Sys_Public().GetList(tableName, showField, orderField, MyPager.Pagesize, MyPager.Pageindex + 1, 0, strWhere, out count);

            rptLoop.DataSource = ds;
            rptLoop.DataBind();
            MyPager.Count = count;
        }
Exemplo n.º 7
0
        public string GetDuty(string DutyId)
        {
            string    Type_Str = "";
            DataTable dt       = new HoneyWell.BLL.Sys_Public().SelectData("top 1 DutyName", "Sys_Duty", " and ID='" + DutyId + "'").Tables[0];

            if (dt.Rows.Count > 0)
            {
                Type_Str = dt.Rows[0]["DutyName"].ToString();
            }

            return(Type_Str);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 初始化角色-新增
        /// </summary>
        void InitDutyAdd()
        {
            BLL.Sys_Duty  sys_duty_bll = new BLL.Sys_Duty();
            DataTable     dt           = new HoneyWell.BLL.Sys_Public().SelectData(" ID,DutyName", "Sys_Duty", " order by DutyDesc").Tables[0];
            StringBuilder sbDuty       = new StringBuilder();

            //拼接HTML-角色
            sbDuty.Append("<option value='0'>==请选择==</option>");
            foreach (DataRow dr in dt.Rows)
            {
                sbDuty.Append("<option value=" + StringHelper.NullToInt(dr["ID"]) + "  >" + StringHelper.NullToStr(dr["DutyName"]) + "</option>");
            }

            DutyStr = sbDuty.ToString();
        }
Exemplo n.º 9
0
        public void BindDuty()
        {
            txtDutyId.Items.Clear();
            ListItem item1 = new ListItem("==请选择==", "");

            txtDutyId.Items.Add(item1);
            DataTable dt = new HoneyWell.BLL.Sys_Public().SelectData(" ID,DutyName", "sys_Duty", " order by DutyDesc").Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ListItem item = new ListItem();
                item.Text  = dt.Rows[i]["DutyName"].ToString();
                item.Value = dt.Rows[i]["ID"].ToString();
                txtDutyId.Items.Add(item);
            }
        }
Exemplo n.º 10
0
        public void pageBind()
        {
            string strWhere = " ";

            if (txt_DutyName.Value.Trim().Length > 0)
            {
                strWhere += " and DutyName like '%" + txt_DutyName.Value.Trim() + "%'";
            }
            string tableName  = "Sys_Duty";
            string showField  = " ID,DutyName,DutyDesc,CreateUser,CreateTime";
            string orderField = "ID";
            int    count      = 0;

            DataSet ds = new HoneyWell.BLL.Sys_Public().GetList(tableName, showField, orderField, MyPager.Pagesize, MyPager.Pageindex + 1, 0, strWhere, out count);

            rptLoop.DataSource = ds;
            rptLoop.DataBind();
            MyPager.Count = count;
        }
Exemplo n.º 11
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            int       result    = 0;
            string    tableName = "Sys_Area";
            string    showField = " top 1 ID";
            string    strWhere  = " and AreaCode='" + nodeValue + "'";
            DataTable dt        = new BLL.Sys_Public().SelectData(showField, tableName, strWhere).Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                nodeId = Utils.ToInt(dt.Rows[0]["ID"].ToString());
            }
            if (nodeId > 0)
            {
                HoneyWell.Model.Sys_Area info = new HoneyWell.BLL.Sys_Area().GetModel(nodeId);

                HoneyWell.Model.Sys_Logs logs = new HoneyWell.Model.Sys_Logs();
                logs.ID         = 0;
                logs.DutyId     = Utils.ToInt(GetDutyId());
                logs.LoginName  = GetUserName();
                logs.TitleName  = "区域管理";
                logs.Depicts    = "删除区域信息,名称为:" + info.AreaName + "";
                logs.CreateTime = DateTime.Now;
                logs.IpAddress  = Request.UserHostAddress;
                logs.MoreCol1   = "";
                logs.MoreCol2   = "";
                new HoneyWell.BLL.Sys_Logs().Add(logs);

                result = new HoneyWell.BLL.Sys_Public().Delete("Sys_Area", " ID=" + nodeId + "");
            }


            if (result > 0)
            {
                ScriptManager.RegisterClientScriptBlock(btnSave, GetType(), "", "alert('操作成功!');parent.location='sys_Area_Tree.aspx'", true);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 页面权限验证
        /// </summary>
        public void CheckUrlUser()
        {
            System.Web.UI.Page page = HttpContext.Current.CurrentHandler as System.Web.UI.Page;
            try
            {
                string strUrl   = HttpContext.Current.Request.FilePath;
                string UserName = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.Cookies["Fadmin"]["UserName"].ToString());
                string PassWord = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.Cookies["Fadmin"]["PassWord"].ToString());

                string    tableName = "V_Sys_Admin";
                string    sqlWhere  = " and AUserName='******' and APassWord='******'";
                string    showField = "top 1 MenuSetting";
                DataTable dt_user   = new HoneyWell.BLL.Sys_Public().SelectData(showField, tableName, sqlWhere).Tables[0];
                if (dt_user != null && dt_user.Rows.Count > 0)
                {
                    string    MenuSetting = dt_user.Rows[0]["MenuSetting"].ToString();
                    string    sqlWhere1   = " and ID in (" + MenuSetting + ")";
                    DataTable dt_menu     = new HoneyWell.BLL.Sys_Public().SelectData("MenuUrl", "Sys_Menu", sqlWhere1).Tables[0];
                    if (dt_menu != null && dt_menu.Rows.Count > 0)
                    {
                        int k = 0;
                        for (int i = 0; i < dt_menu.Rows.Count; i++)
                        {
                            if (dt_menu.Rows[i]["MenuUrl"].ToString() == strUrl)
                            {
                                k += 1;
                            }
                        }
                        if (k <= 0)
                        {
                            HttpContext.Current.Response.Write("<script language='javascript'>");
                            HttpContext.Current.Response.Write("window.alert('您没有权限查看该页面!');");
                            HttpContext.Current.Response.Write("window.close();");
                            HttpContext.Current.Response.Write("</script>");
                            HttpContext.Current.Response.End();
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.Write("<script language='javascript'>");
                        HttpContext.Current.Response.Write("window.alert('异常登陆系统1!');");
                        HttpContext.Current.Response.Write("window.close();");
                        HttpContext.Current.Response.Write("</script>");
                        HttpContext.Current.Response.End();
                    }
                }

                else
                {
                    HttpContext.Current.Response.Write("<script language='javascript'>");
                    HttpContext.Current.Response.Write("window.alert('异常登陆系统2!');");
                    HttpContext.Current.Response.Write("window.close();");
                    HttpContext.Current.Response.Write("</script>");
                    HttpContext.Current.Response.End();
                }
            }
            catch (Exception)
            {
                HttpContext.Current.Response.Write("<script language='javascript'>");
                HttpContext.Current.Response.Write("window.alert('异常登陆系统3!');");
                HttpContext.Current.Response.Write("window.close();");
                HttpContext.Current.Response.Write("</script>");
                HttpContext.Current.Response.End();
            }
        }
Exemplo n.º 13
0
        public void BindMenu()
        {
            string    MenuSetting = "";
            string    TableName   = "Sys_Duty";
            string    ShowField   = " top 1 MenuSetting";
            string    OrderField  = " and ID='" + Request.Cookies["Fadmin"]["DutyID"].ToString() + "'";
            DataTable dt_user     = new HoneyWell.BLL.Sys_Public().SelectData(ShowField, TableName, OrderField).Tables[0];

            if (dt_user != null && dt_user.Rows.Count > 0)
            {
                MenuSetting = dt_user.Rows[0]["MenuSetting"].ToString();
            }
            else
            {
                Response.Write("<script language='javascript'>alert('非法登陆系统后台@!');selfIn.location.href='Friend.aspx';</script>");
                Response.End();
            }

            DataTable dt1 = new HoneyWell.BLL.Sys_Menu().GroupMenuTree("", " and ID in (select ParentID from Sys_Menu where ID in(" + MenuSetting + ")  group by ParentID) and MenuLevel='1' order by MenuOrder").Tables[0];

            for (int k = 0; k < dt1.Rows.Count; k++)
            {
                str_menu += "<div class=\"overall\">";
                str_menu += " <div class=\"mainmenu\"><i></i><span>" + dt1.Rows[k]["MenuNameC"].ToString() + "</span> <b></b></div>";
                str_menu += " <div class=\"submenu\">";
                str_menu += "  <ul>";
                DataTable dt2 = new HoneyWell.BLL.Sys_Menu().GetMenuTree("", " and ID in (" + MenuSetting + ") and ParentID=" + dt1.Rows[k]["ID"].ToString() + " and MenuLevel='2' order by MenuOrder").Tables[0];
                for (int j = 0; j < dt2.Rows.Count; j++)
                {
                    DataTable dt3 = new HoneyWell.BLL.Sys_Menu().GetMenuTree("", " and ID in (" + MenuSetting + ") and ParentID=" + dt2.Rows[j]["ID"].ToString() + " and MenuLevel='3' order by MenuOrder").Tables[0];
                    if (dt3 != null && dt3.Rows.Count > 0)
                    {
                        str_menu += "<li>";
                        str_menu += " <div class=\"second\"><img src=\"images/line1.png\" class=\"dashe\" /><span>" + dt2.Rows[j]["MenuNameC"].ToString() + "</span><i ></i></div>";
                        str_menu += " <div class=\"three\">";
                        str_menu += "  <ul>";
                        for (int m = 0; m < dt3.Rows.Count; m++)
                        {
                            string str_style1 = "";
                            if (dt3.Rows.Count - 1 == m && dt2.Rows.Count - 1 == j)
                            {
                                str_style1 = "style=\"border-bottom:none;\"";
                            }
                            else
                            {
                                str_style1 = "";
                            }

                            str_menu += "<li " + str_style1 + "><img src=\"images/line1.png\" class=\"threeimg\" /><a href=\"" + dt3.Rows[m]["MenuUrl"].ToString() + "\" target=\"main\"><span>" + dt3.Rows[m]["MenuNameC"].ToString() + "</span></a> <i></i></li>";
                        }
                        str_menu += "   </ul>";
                        str_menu += "  </div>";
                    }
                    else
                    {
                        string str_style2 = "";
                        if (dt2.Rows.Count - 1 == j)
                        {
                            str_style2 = "style=\"border-bottom:none;\"";
                        }
                        else
                        {
                            str_style2 = "";
                        }
                        str_menu += "<li>";
                        str_menu += " <div class=\"second\" " + str_style2 + "><img src=\"images/line1.png\" class=\"dashe\" /><a href=\"" + dt2.Rows[j]["MenuUrl"].ToString() + "\" target=\"main\"><span>" + dt2.Rows[j]["MenuNameC"].ToString() + "</span></a><i ></i></div>";
                    }

                    str_menu += "</li>";
                }

                str_menu += "   </ul>";
                str_menu += "  </div>";
                str_menu += "  </div>";
            }
        }