예제 #1
0
파일: Main.aspx.cs 프로젝트: siqianyu/cttx
    protected void BindRootMenu()
    {
        AdoHelper adoHelper = AdoHelper.CreateHelper("DB_Instance");
        DataSet   ds        = new StarTech.Adapter.IACenter().GetAllMenusByUserId(int.Parse(this.UserId));

        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            DataRow[] rows = ds.Tables[0].Select("parentMenuId=105");
            //DataSet ds = adoHelper.ExecuteSqlDataset("select * from IACenter_Menu where parentMenuId=0 order by orderIndex");
            string menus    = "";
            string firstTab = "";
            for (int i = 0; i < rows.Length; i++)
            {
                DataRow row = rows[i];
                this.hidRootMenu.Value += "tab_" + row["uniqueId"] + ",";
                if (firstTab == "")
                {
                    firstTab = "tab_" + row["uniqueId"] + "|" + row["menuName"];
                }
                string css = i == 0 ? "Active" : "Normal";
                menus += "<a href=\"javascript:selectTab('tab_" + row["uniqueId"] + "','" + row["menuName"] + "');void(0);\" class=\"" + css + "\" id=\"tab_" + row["uniqueId"] + "\">" + row["menuName"] + "</a>";
            }
            this.ltRootMenu.Text = menus;
            if (this.hidRootMenu.Value != "")
            {
                this.hidRootMenu.Value = this.hidRootMenu.Value.TrimEnd(',');
            }
            if (firstTab != "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "a", "selectTab('" + firstTab.Split('|')[0] + "','" + firstTab.Split('|')[1] + "');", true);
            }
        }
    }
예제 #2
0
        /// <summary>
        /// 菜单权限
        /// </summary>
        public void CheckMenuPermissions(int menuId)
        {
            bool r = new IACenter().CheckIsMyMenu(menuId, Int32.Parse(this.UserId));

            if (r == false)
            {
                Response.Redirect("/Login.aspx", true);
            }
        }
예제 #3
0
        /// <summary>
        /// 获取当前用户相应的首页
        /// </summary>
        public string GetMyIndexPage()
        {
            DataSet ds = new IACenter().ExecuteSqlDataset("select * from t_platform_base_depart where trim(departcode)='" + this.DepartCode.Trim() + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(ds.Tables[0].Rows[0]["indexpagename"].ToString().Trim() == "" ? "Index_FJ.aspx" : ds.Tables[0].Rows[0]["indexpagename"].ToString());
            }
            else
            {
                return("Index_FJ.aspx");
            }
        }
예제 #4
0
    /// <summary>
    /// 验证
    /// </summary>
    public void SetButtonsPermissions(int menuId, string groupIds)
    {
        string ids = new StarTech.Adapter.IACenter().GetAllButtons(menuId, groupIds);

        ids = "," + ids + ",";

        //IACenter_Button
        //1	新增	add
        //2	删除	delete
        //3	修改	edit
        //4	查询	search
        //5	查看	show
        //6	权限设置	pemissionset
        //7	审核	approved
        //8	取消审核    unapproved

        if (ids.IndexOf(",1,") == -1)
        {
            this.btnAdd.Visible = false;
        }
        if (ids.IndexOf(",2,") == -1)
        {
            this.btnDelete.Visible = false;
        }
        if (ids.IndexOf(",3,") == -1)
        {
            this.btnEdit.Visible = false;
        }
        if (ids.IndexOf(",4,") == -1)
        {
            this.btnSearch.Visible = false;
        }
        if (ids.IndexOf(",5,") == -1)
        {
            this.btnShow.Visible = false;
        }
        //if (ids.IndexOf(",6,") == -1) { this.btnAdd.Visible = false; }
        if (ids.IndexOf(",7,") == -1)
        {
            this.btnSH.Visible = false;
        }
        if (ids.IndexOf(",8,") == -1)
        {
            this.btnNSH.Visible = false;
        }
    }
예제 #5
0
    //绑定数据
    private void BindData()
    {
        //清除所有数据
        DeptTree.Nodes.Clear();
        //绑定模式
        TreeNode node = new TreeNode("用户", "0");

        node.SelectAction = TreeNodeSelectAction.Expand;
        node.Expand();

        //部门数据
        DataSet dsDept = new BllTableObject("T_Base_Department").Util_GetList2("*", "1=1", "orderBy");
        //所有人员数据
        DataSet dsUser = new StarTech.Adapter.IACenter().ExecuteSqlDataset("select * from IACenter_User order by orderBy");

        //创建部门节点
        CreateDeptNode(node, dsDept.Tables[0], dsUser.Tables[0], "");
        DeptTree.Nodes.Add(node);
    }
예제 #6
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        StarTech.Adapter.IACenter iaCenter = new StarTech.Adapter.IACenter();
        //menu
        iaCenter.SetGroupMenu(Int32.Parse(this.menuId), Int32.Parse(this.groupId), this.cbxMenu.Checked);
        if (this.cbxToSub.Checked)
        {
            DataSet subMenus = iaCenter.GetSubMenuById(Int32.Parse(this.menuId));
            foreach (DataRow row in subMenus.Tables[0].Rows)
            {
                iaCenter.SetGroupMenu(Int32.Parse(row["uniqueId"].ToString()), Int32.Parse(this.groupId), this.cbxMenu.Checked);
            }
        }

        //button
        string buttons = "";

        foreach (ListItem item in this.cbxButtons.Items)
        {
            if (item.Selected == true)
            {
                buttons += item.Value + ",";
            }
        }
        if (buttons != "")
        {
            buttons = buttons.TrimEnd(',');
        }
        bool addButtonsFlag = (buttons == "") ? false : true;

        iaCenter.SetGroupButtons(Int32.Parse(this.menuId), Int32.Parse(this.groupId), buttons, addButtonsFlag);
        if (this.cbxToSub.Checked)
        {
            DataSet subMenus = iaCenter.GetSubMenuById(Int32.Parse(this.menuId));
            foreach (DataRow row in subMenus.Tables[0].Rows)
            {
                iaCenter.SetGroupButtons(Int32.Parse(row["uniqueId"].ToString()), Int32.Parse(this.groupId), buttons, addButtonsFlag);
            }
        }
        ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功!');</script>");
    }
예제 #7
0
파일: Login.aspx.cs 프로젝트: siqianyu/cttx
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        //验证码
        //if (Request["txtYZM"] == null || Session["VerifyChar"] == null) { return; }
        //if (Session["VerifyChar"].ToString().ToLower() != Request["txtYZM"].ToString().ToLower())
        //{
        //    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<Script>alert('验证码错误!');</Script>");
        //    return;
        //}
        string username = this.txtUsername.Value.Trim().Replace("'", "");
        string pwd      = this.txtPassword.Value;

        pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "MD5");
        //Response.Write(pwd); Response.End();
        DataTable dtUser = new DataTable();
        int       r      = new StarTech.Adapter.IACenter().UserLogin(username, pwd, ref dtUser);

        if (r == 1)
        {
            //日志
            //iacenter.AddUserActionLog(dt.Rows[0]["UserName"].ToString(), dt.Rows[0]["TrueName"].ToString(), "", "", "", "登陆", "", "", "", Request.UserHostAddress, Request.Url.ToString());

            Session["UserId"] = dtUser.Rows[0]["uniqueId"].ToString();
            LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "用户‘" + dtUser.Rows[0]["userName"].ToString() + "’登录", "登录", "", "", HttpContext.Current.Request.Url.ToString());

            //string ids = GetRootMenus(dt.Rows[0]["uniqueId"].ToString());
            string ids = "1";
            if (ids != "")
            {
                Response.Redirect("Main.aspx?rootMenuId=" + ids.Split(',')[0] + "", true);
            }
            else
            {
                Response.Redirect("Main.aspx?rootMenuId=-1", true);
            }
        }
        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('用户名或密码错误!');</script>");
        }
    }
예제 #8
0
        protected Hashtable GetUserInfo()
        {
            Hashtable hTable   = new Hashtable();
            string    memberId = HttpContext.Current.Session["MemberId"] == null ? "" : HttpContext.Current.Session["MemberId"].ToString();

            if (memberId == null || memberId.ToString() == "")
            {
                return(hTable);
            }

            DataTable dtUser = new IACenter().ExecuteSqlDataset("select * from T_Member_Info where memberId=" + memberId + "").Tables[0];

            if (dtUser.Rows.Count > 0)
            {
                hTable.Add("MemberId", dtUser.Rows[0]["memberId"].ToString());     //
                hTable.Add("MemberName", dtUser.Rows[0]["memberName"].ToString()); //
                hTable.Add("TrueName", dtUser.Rows[0]["TrueName"].ToString());     //
                hTable.Add("MemberLevel", dtUser.Rows[0]["memberLevel"].ToString());
                hTable.Add("HeadImg", dtUser.Rows[0]["HeadImg"].ToString());
            }
            return(hTable);
        }
예제 #9
0
    protected void BindData()
    {
        StarTech.Adapter.IACenter iaCenter = new StarTech.Adapter.IACenter();
        this.ltMenuName.Text = iaCenter.GetMenuNameById(Int32.Parse(this.menuId));
        this.cbxMenu.Checked = iaCenter.CheckIsGroupMenu(Int32.Parse(this.menuId), Int32.Parse(this.groupId));

        DataSet ds = iaCenter.GetSystemButtons();

        this.cbxButtons.DataSource     = ds;
        this.cbxButtons.DataTextField  = "buttonName";
        this.cbxButtons.DataValueField = "uniqueId";
        this.cbxButtons.DataBind();
        string buttons = iaCenter.GetAllButtons(Int32.Parse(this.menuId), this.groupId);

        buttons = "," + buttons + ",";
        foreach (ListItem item in this.cbxButtons.Items)
        {
            if (buttons.IndexOf("," + item.Value + ",") > -1)
            {
                item.Selected = true;
            }
        }
    }
예제 #10
0
        protected Hashtable GetUserInfo()
        {
            Hashtable hTable = new Hashtable();

            if (Session["UserInfo"] != null)
            {
                hTable = (Hashtable)Session["UserInfo"];
            }
            else
            {
                DataTable dtUser = new IACenter().GetUserInfoByUserId(int.Parse(Session["UserId"].ToString()));
                if (dtUser != null && dtUser.Rows.Count > 0)
                {
                    hTable.Add("UserId", dtUser.Rows[0]["uniqueId"].ToString());
                    hTable.Add("UserName", dtUser.Rows[0]["userName"].ToString());
                    hTable.Add("TrueName", dtUser.Rows[0]["trueName"].ToString());
                    hTable.Add("DepartCode", dtUser.Rows[0]["departId"].ToString());
                    hTable.Add("DepartName", dtUser.Rows[0]["departId"].ToString());
                }
                Session["UserInfo"] = hTable;
            }
            return(hTable);
        }
예제 #11
0
파일: Login.aspx.cs 프로젝트: siqianyu/cttx
    protected string GetRootMenus(string userId)
    {
        return("1");

        string ids = "";

        StarTech.Adapter.IACenter iacenter = new StarTech.Adapter.IACenter();
        DataSet dsMenus = iacenter.GetAllMenusByUserId(Int32.Parse(userId));

        if (dsMenus != null)
        {
            DataRow[] rowsMenus2 = dsMenus.Tables[0].Select("parentMenuId=0 and isAreaMenu=1");

            foreach (DataRow rowMenus2 in rowsMenus2)
            {
                ids += rowMenus2["uniqueId"].ToString() + ",";
            }
            return(ids);
        }
        else
        {
            return("");
        }
    }