Beispiel #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="accountVO"></param>
 public Account(AccountVO accountVO)
 {
     ID          = accountVO.Id;
     OAAccountId = accountVO.OAAccountId;
     AccountName = accountVO.AccountName;
     CompanyId   = accountVO.CompanyId;
 }
Beispiel #2
0
    public static SearchBoxData GetNameResults(SearchBoxContext context)
    {
        AccountVO      account = WebHelper.GetSessionAccount();
        List <StaffVO> list    = new List <StaffVO>();
        DataHandler    dh      = new DataHandler();

        string name         = context.Text;
        int    departmentID = 0;

        if (context.SelectedContextItem != null)
        {
            int.TryParse(context.SelectedContextItem.Key, out departmentID);
        }
        if (!string.IsNullOrEmpty(name))
        {
            list = dh.GetStaffByNameStatus(account.Company_ID, departmentID, name, Config.StaffStatus.Quit);
        }

        List <SearchBoxItemData> result = new List <SearchBoxItemData>();

        foreach (StaffVO item in list)
        {
            SearchBoxItemData itemData = new SearchBoxItemData();
            itemData.Text  = item.Name;
            itemData.Value = item.Staff_ID.ToString();
            result.Add(itemData);
        }

        SearchBoxData res = new SearchBoxData();

        res.Items = result.ToArray();

        return(res);
    }
Beispiel #3
0
    protected void DaysCB_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        AccountVO account   = WebHelper.GetSessionAccount();
        int       companyID = account.Company_ID;

        AreaCB.Items.Clear();
        AreaCB.DataSource = dh.GetCompanyArea(companyID);
        AreaCB.DataBind();
    }
Beispiel #4
0
    private void GetDay()
    {
        AccountVO account   = WebHelper.GetSessionAccount();
        int       companyID = account.Company_ID;

        DaysCB.Items.Clear();
        DaysCB.DataSource = dh.GetCompanyArea(companyID);
        DaysCB.DataBind();
    }
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccountVO account = WebHelper.GetSessionAccount();

        if (!IsPostBack)
        {
            NameTB.Text = account.Staff.Name.ToString().Trim();
            GetDay();
            AreaCb();
        }
    }
Beispiel #6
0
        /// <summary>
        /// Transpose model object to value object
        /// </summary>
        /// <param name="account"></param>
        public AccountVO Transpose()
        {
            AccountVO accountVO = new AccountVO();

            accountVO.Id          = this.ID;
            accountVO.OAAccountId = this.OAAccountId;
            accountVO.AccountName = this.AccountName;
            accountVO.CompanyId   = this.CompanyId;

            return(accountVO);
        }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        accountInfo = WebHelper.GetSessionAccount();

        if (!IsPostBack)
        {
            BuildBrand();
            BuildNav();
            BuildTask();
            CheckExamine();
            if (accountInfo.Staff != null)
            {
                Name.Text = accountInfo.Staff.Name + "[" + CommonHelper.StaffNumberLength(accountInfo.Staff.Staff_Number) + "]";
            }
        }
    }
Beispiel #8
0
 public static AccountVO CreateData(string str)
 {
     AccountVO data = null;
     var index = str.IndexOf(",", System.StringComparison.Ordinal);
     if (index >= 0)
     {
         var arr = str.Split(',');
         data = new AccountVO
         {
             Account = arr[0], Password = arr[1], Servers = new List<string>()
         };
         for (var i = 2; i < arr.Length; i++)
         {
             data.Servers.Add(arr[i]);
         }
     }
     return data;
 }
Beispiel #9
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 #10
0
    public void SetData(AccountVO account)
    {
        Data = account;

        Reset();
    }
Beispiel #11
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 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     account = WebHelper.GetSessionAccount();
     staff   = account.Staff;
 }