Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        account = WebHelper.GetSessionAccount();
        staff   = account.Staff;

        if (staff.Status_ID == (int)Config.StaffStatus.Entry)
        {
            Response.Redirect("/hr/entry.aspx", true);
            return;
        }

        if (!IsPostBack)
        {
            // Show Bank Card Window
            if (staff != null)
            {
                BankCardWindow.VisibleOnPageLoad = string.IsNullOrEmpty(staff.BankCard);
            }

            if (WebHelper.CheckPurview(Config.Staff_Module, Config.Purview.Chart, false))
            {
                InitPage();
            }

            //if (WebHelper.CheckPurview(Config.Item_Module, Config.Purview.Chart))
            //{
            //    BarChartInit();
            //}

            if (WebHelper.CheckPurview(Config.Self_Attendance, Config.Purview.View, false))
            {
                attendanceDiv.Visible = true;
            }
            TaskLogInit();
            NoticeInit();
        }
    }
Beispiel #2
0
    public int DeleteStaff(StaffVO inStaff)
    {
        int staffId = 0;

        return(staffId);
    }
Beispiel #3
0
    public int UpdateStaff(StaffVO inStaff)
    {
        int staffId = 0;

        return(staffId);
    }
Beispiel #4
0
    public int AddStaff(StaffVO inStaff)
    {
        int staffId = 0;

        return(staffId);
    }
Beispiel #5
0
    protected void loginBtn_Click(object sender, EventArgs e)
    {
        string name     = accountTB.Text.Trim();
        string password = passwordTB.Text.Trim();

        if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(password))
        {
            Response.Write("<script>alert('账号或密码不能为空');</script>");
            return;
        }

        password = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
        DataHandler dh      = new DataHandler();
        AccountVO   account = dh.GetAccount(name, password);

        if (account == null)
        {
            Response.Write("<script>alert('账号或密码错误');</script>");
            return;
        }

        int timeout = Convert.ToInt32(FormsAuthentication.Timeout.TotalMinutes);

        //DateTime now = DateTime.Now;
        //FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, name, now, now.AddMinutes(timeout), true, password);
        //string HashTicket = FormsAuthentication.Encrypt(Ticket);
        //HttpCookie UserCookie = new HttpCookie(FormsAuthentication.FormsCookieName, HashTicket);
        //FormsAuthentication.SetAuthCookie(FormsAuthentication.FormsCookieName, true);
        //Context.Response.Redirect(Context.Request["ReturnUrl"]); // 重定向到用户申请的初始页面

        //account.PositionPurview = dh.GetPositionPurview(account.Position_ID);
        account.Position = dh.GetPositionByID(account.Position_ID);
        int templateID = account.Position == null ? 0 : account.Position.Template_ID;

        account.TemplatePurview = dh.GetTemplatePurview(templateID);

        //Session.Timeout = timeout;
        Session[Config.Session_Account] = account;

        //生成Cookie
        HttpCookie cookie = new HttpCookie(Config.Cookie_Account);

        cookie.Values.Add(Config.Cookie_UserName, name);
        cookie.Values.Add(Config.Cookie_Password, password);
        cookie.Expires = DateTime.Now.AddMinutes(timeout);
        Response.Cookies.Add(cookie);

        //判断是否为管理员
        if (account.Type_ID.Equals((int)Config.AccountType.Admin))
        {
            Response.Redirect("/system/purview.aspx");
            return;
        }

        //更新考勤工号
        StaffVO staff = account.Staff;

        if (staff != null && staff.User_ID == 0)
        {
            ZKDataHandler zkdh   = new ZKDataHandler();
            CompanyAreaVO area   = dh.GetCompanyAreaByID(staff.Area_ID);
            int           userID = zkdh.GetUserIDByNumber(staff.Badge_Number, area.DataBase_Name);
            dh.UpdateStaffUserID(staff.Staff_ID, userID);
            account.Staff.User_ID           = userID;
            Session[Config.Session_Account] = account;
        }

        //判断是否为入职
        if (staff != null && staff.Status_ID == (int)Config.StaffStatus.Entry)
        {
            Response.Redirect("/hr/entry.aspx");
        }
        else
        {
            Response.Redirect("index.aspx");
        }
    }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     account = WebHelper.GetSessionAccount();
     staff   = account.Staff;
 }
Beispiel #7
0
    private void BuildNav()
    {
        if (accountInfo.Type_ID.Equals((int)Config.AccountType.Admin))
        {
            task.Visible = false;

            Navigation.Controls.Clear();

            HtmlGenericControl purviewLi = new HtmlGenericControl("li");
            purviewLi.InnerHtml = "<a href=\"/system/purview.aspx\"><i class=\"fa fa-fw fa-gear \"></i> 权限管理</a>";
            Navigation.Controls.Add(purviewLi);

            HtmlGenericControl moduleLi = new HtmlGenericControl("li");
            moduleLi.InnerHtml = "<a href=\"/system/module.aspx\"><i class=\"fa fa-fw fa-windows \"></i> 模块管理</a>";
            Navigation.Controls.Add(moduleLi);

            HtmlGenericControl workFlowLi = new HtmlGenericControl("li");
            workFlowLi.InnerHtml = "<a href=\"/system/workflow.aspx\"><i class=\"fa fa-fw fa-list \"></i> 工作流管理</a>";
            Navigation.Controls.Add(workFlowLi);

            HtmlGenericControl holidayLi = new HtmlGenericControl("li");
            holidayLi.InnerHtml = "<a href=\"/system/holiday.aspx\"><i class=\"fa fa-fw fa-retweet \"></i> 节假日生成</a>";
            Navigation.Controls.Add(holidayLi);

            HtmlGenericControl templateLi = new HtmlGenericControl("li");
            templateLi.InnerHtml = "<a href=\"/system/template.aspx\"><i class=\"fa fa-fw fa-indent \"></i> 权限模板管理</a>";
            Navigation.Controls.Add(templateLi);
        }
        else
        {
            StaffVO staff = accountInfo.Staff;
            if (staff != null && staff.Status_ID == (int)Config.StaffStatus.Entry)
            {
                Navigation.Controls.Clear();
                HtmlGenericControl li = new HtmlGenericControl("li");
                li.InnerHtml = "<a href=\"/hr/entry.aspx\"><i class=\"fa fa-fw fa-sign-in\"></i> 入职登记表</a>";
                Navigation.Controls.Add(li);
                return;
            }

            //List<PositionPurviewVO> pp = accountInfo.PositionPurview;

            List <TemplatePurviewVO> pp   = accountInfo.TemplatePurview;
            List <ModuleVO>          list = WebHelper.GetModule();

            List <ModuleVO>      selfModuleList = new List <ModuleVO>();      //该用户拥有的模块列表
            List <ModuleGroupVO> modulegroup    = new List <ModuleGroupVO>(); //该用户拥有的一级菜单
            foreach (ModuleVO item in list)
            {
                if (pp.Exists(t => t.Module_ID.Equals(item.Module_ID) && t.Purview_ID.Equals((int)Config.Purview.View)))
                {
                    selfModuleList.Add(item);
                    if (!modulegroup.Exists(t => t.Group_Name.Equals(item.Group.Group_Name)))
                    {
                        modulegroup.Add(item.Group);
                    }
                }
            }

            foreach (ModuleGroupVO item in modulegroup)
            {
                HtmlGenericControl ul = new HtmlGenericControl("li");
                string             sb = "<a href='#'>" + item.Group_Name + "<span class=\"fa arrow\"></span></a><ul class=\"nav nav-second-level collapse\">";

                List <ModuleVO> moduleList = selfModuleList.FindAll(t => t.Group_ID.Equals(item.Group_ID));
                foreach (ModuleVO module in moduleList)
                {
                    sb += "<li><a href=\"" + module.Module_Url + "\" ><i class=\"fa fa-fw " + module.Module_Icon + "\"></i> " + module.Module_Name + "</a></li>";
                }
                sb          += "</ul>";
                ul.InnerHtml = sb;
                Navigation.Controls.Add(ul);
            }
        }
    }