Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Authentication.HasResource(User.Identity.Name, "OvertimeList"))
            {
                Response.Redirect(@"/account/logon.aspx?ReturnUrl=%2f");
            }

            if (!IsPostBack)
            {
                _overitmeRepo = RepositoryFactory.CreateOvertimeRepo();
                _rootRepo     = RepositoryFactory.CreateRootRepo();
                _smartRepo    = RepositoryFactory.CreateSmartManRepo();

                // 取得 QueryString
                var paggerParms   = WebUtils.ParseQueryString <PaggerParms>(Page.Request);
                var signListParms = WebUtils.ParseQueryString <SignListParms>(Page.Request);
                signListParms.GridView      = OvertimeGridView;
                signListParms.PaginationBar = paginationBar;

                //根據查詢的 簽核代碼 搜尋加班單
                var pagination = _overitmeRepo.GetOvertimeListPagination(signListParms, paggerParms);

                if (pagination == null)
                {
                    return;
                }

                //設定 gridView Source
                ViewUtils.SetGridView(OvertimeGridView, pagination.Data);

                //Pagination Bar Generator
                string paginationHtml = WebUtils.GetPagerNumericString(pagination, Request);
                paginationBar.InnerHtml = paginationHtml;


                model = _overitmeRepo.GetWorkflowData(signListParms.SignDocID);
                WebUtils.PageDataBind(model, this.Page);
                Signed.NavigateUrl = "~/Area/Sign/WorkflowDetail.aspx?signDocID=" + signListParms.SignDocID;
                if (model == null)
                {
                    return;
                }
                var employeeData = _rootRepo.QueryForEmployeeByEmpID(model.EmployeeID_FK);
                ApplyName.Text = employeeData != null ? employeeData["EmployeeName"].ToString() : String.Empty;
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _forgotRepo  = RepositoryFactory.CreateForgotPunchRepo();
            _rootRepo    = RepositoryFactory.CreateRootRepo();
            _smartRepo   = RepositoryFactory.CreateSmartManRepo();
            _employeeRow = _smartRepo.QueryForEmployee(EmployeeID_FK.Text);

            if (!Authentication.HasResource(User.Identity.Name, "ForgotPunch"))
            {
                Response.Redirect(@"/account/logon.aspx?ReturnUrl=%2f");
            }

            if (!IsPostBack)
            {
                string signDocID = String.IsNullOrEmpty(Request["SignDocID_FK"]) ? String.Empty : Request["SignDocID_FK"].ToString();

                //將部門資料 與下拉式選單綁定
                ViewUtils.SetOptions(DepartmentID_FK, _rootRepo.GetDepartment());
                //忘刷員工資料 與下拉式選單綁定
                ViewUtils.SetOptions(EmployeeID_FK, _rootRepo.GetEmployee());
                //忘刷類型資料 與下拉式選單綁定
                ViewUtils.SetOptions(PeriodType, _rootRepo.GetPeriodType());

                var employeeData = _rootRepo.QueryForEmployeeByADAccount(User.Identity.Name);
                ApplyID_FK.Text               = employeeData != null ? employeeData["EmployeeID"].ToString() : String.Empty;
                ApplyName.Text                = employeeData != null ? employeeData["EmployeeName"].ToString() : String.Empty;
                ApplyDateTime.Text            = DateTime.Now.FormatDatetime();
                EmployeeID_FK.SelectedValue   = employeeData != null ? employeeData["EmployeeID"].ToString() : String.Empty;
                DepartmentID_FK.SelectedValue = employeeData != null ? employeeData["DepartmentID_FK"].ToString() : String.Empty;
                PageTitle.Value               = "表單新增作業 > 忘刷單";
                FormSeries.Value              = "ForgotPunch";

                if (!String.IsNullOrWhiteSpace(signDocID))
                {
                    //將 viewModel 的值綁定到 頁面上
                    WebUtils.PageDataBind(_forgotRepo.GetForgotPunchForm(signDocID), this.Page);

                    SignDocID_FK.Text = signDocID;
                    PageTitle.Value   = "表單編輯作業 > 忘刷單";
                }
            }
        }