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

            if (!IsPostBack)
            {
                //進入新增頁面
                _overtimeRepo = RepositoryFactory.CreateOvertimeRepo();
                _rootRepo     = RepositoryFactory.CreateRootRepo();

                //將部門資料 與下拉式選單綁定
                ViewUtils.SetOptions(DefaultDeptName, _rootRepo.GetDepartment());
                //將支援部門資料 與下拉式選單綁定
                ViewUtils.SetOptions(DefaultSupportDeptName, _rootRepo.GetDepartment());
                //20161117 修改抓成本部門
                //ViewUtils.SetOptions(DefaultSupportDeptName, _rootRepo.GetCostDepartment());
                //將訂餐資料 與下拉式選單綁定
                ViewUtils.SetOptions(DefaultMealOrderValue, _overtimeRepo.CreateMealOrderType());
                //將報酬資料 與下拉式選單綁定
                ViewUtils.SetOptions(DefaultPayTypeValue, _overtimeRepo.CreatePayType());

                var employeeData = _rootRepo.QueryForEmployeeByADAccount(User.Identity.Name);
                ApplyID_FK.Value = employeeData != null ? employeeData["EmployeeID"].ToString() : String.Empty;
                ApplyName.Text   = employeeData != null ? employeeData["EmployeeName"].ToString() : String.Empty;

                var deptData = _rootRepo.QueryForDepartmentByDeptID(employeeData != null ? employeeData["departmentID_FK"].ToString() : String.Empty);
                ApplyDeptID_FK.Value          = deptData != null ? deptData["DepartmentID"].ToString() : String.Empty;
                ApplyDeptName.Text            = deptData != null ? deptData["DepartmentName"].ToString() : String.Empty;
                DefaultDeptName.SelectedValue = !String.IsNullOrWhiteSpace(ApplyDeptID_FK.Value) ? ApplyDeptID_FK.Value : String.Empty;
                //20161117 支援單位預設值抓成本部門(已取消此做法)
                DefaultSupportDeptName.SelectedValue = !String.IsNullOrWhiteSpace(ApplyDeptID_FK.Value) ? ApplyDeptID_FK.Value : String.Empty;
                //DefaultSupportDeptName.SelectedValue = employeeData != null ? employeeData["CostDepartmentID"].ToString() : String.Empty;
                if (employeeData["CostDepartmentID"].ToString().Substring(0, 2) == "39")
                {
                    DefaultMealOrderValue.SelectedValue = "none";
                }
                else
                {
                    DefaultMealOrderValue.SelectedValue = "Carnivore";
                }
                DefaultPayTypeValue.SelectedValue = "overtimePay";
                DefaultStartDateTime.Text         = DateTime.Now.ToString("yyyy-MM-dd 17:20:00");
                DefaultEndDateTime.Text           = DateTime.Now.ToString("yyyy-MM-dd 19:20:00");
                PageTitle.Value  = "表單新增作業 > 加班單";
                FormSeries.Value = "Overtime";
                DefaultSupportDeptName_SelectedIndexChanged(sender, e);
                string signDocID = String.IsNullOrEmpty(Request["SignDocID_FK"]) ? String.Empty : Request["SignDocID_FK"].ToString();
                if (!String.IsNullOrWhiteSpace(signDocID))
                {
                    PageTitle.Value = "表單編輯作業 > 加班單";
                    SignDocID.Value = signDocID;
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //驗證身分權限
            if (!Authentication.HasResource(User.Identity.Name, "EmployeeData"))
            {
                Response.Redirect(@"/account/logon.aspx?ReturnUrl=%2f");
            }

            //表單第一次載入
            if (!IsPostBack)
            {
                _employeeRepo = RepositoryFactory.CreateEmployeeRepo();
                _rootRepo     = RepositoryFactory.CreateRootRepo();
                //從QueryString取得 員工編號
                string empID = String.IsNullOrEmpty(Request["EmployeeID"]) ? String.Empty : Request["EmployeeID"].ToString();

                //將部門資料 與下拉式選單綁定
                ViewUtils.SetOptions(DepartmentID_FK, _rootRepo.GetDepartment());
                //將成本部門資料 與下拉式選單綁定
                ViewUtils.SetOptions(CostDepartmentID, _rootRepo.GetCostDepartment());
                //代理人資料 與下拉式選單綁定
                ViewUtils.SetOptions(AgentName, _rootRepo.GetEmployee());
                //權限類別  與下拉式選單綁定
                ViewUtils.SetOptions(AccessType, _rootRepo.GetGroup());
                //國籍類別  與下拉式選單綁定
                ViewUtils.SetOptions(NationalType, _employeeRepo.GenarationNationalType());
                //性別類別  與下拉式選單綁定
                ViewUtils.SetOptions(SexType, _employeeRepo.GenarationSexType());

                PageTitle.Value = "員工基本資料 > 新增";

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

                    EmployeeID.ReadOnly      = true;
                    DepartmentName.Value     = DepartmentID_FK.Text;
                    CostDepartmentName.Value = CostDepartmentID.Text;
                    PageTitle.Value          = "員工基本資料 > 編輯";
                }
            }
        }
Exemplo n.º 3
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   = "表單編輯作業 > 忘刷單";
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Authentication.HasResource(User.Identity.Name, "TypeData"))
            {
                Response.Redirect(@"/account/logon.aspx?ReturnUrl=%2f");
            }

            if (!IsPostBack)
            {
                _typeRepo = RepositoryFactory.CreateTypeRepo();
                _rootRepo = RepositoryFactory.CreateRootRepo();
                //從QueryString取得 表單簽核類型
                string formIDTxt = String.IsNullOrEmpty(Request["FormID"]) ? String.Empty : Request["FormID"].ToString();

                //將部門資料 與下拉式選單綁定
                ViewUtils.SetOptions(FilingDepartmentID_FK, _rootRepo.GetDepartment());
                //代理人資料 與下拉式選單綁定
                ViewUtils.SetOptions(SignID_FK, _rootRepo.GetSignProcedure());

                PageTitle.Value = "表單類型資料 > 新增";

                if (!String.IsNullOrWhiteSpace(formIDTxt))
                {
                    int formID;
                    if (!Int32.TryParse(formIDTxt, out formID))
                    {
                        return;
                    }
                    //將 viewModel 的值綁定到 頁面上
                    WebUtils.PageDataBind(_typeRepo.GetTypeData(formID), this.Page);

                    FilingDepartmentName.Value = FilingDepartmentID_FK.Text;
                    PageTitle.Value            = "表單類型資料 > 編輯";
                }
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Authentication.HasResource(User.Identity.Name, "DepartmentData"))
            {
                Response.Redirect(@"/account/logon.aspx?ReturnUrl=%2f");
            }

            if (!IsPostBack)
            {
                _departmentRepo = RepositoryFactory.CreateDepartmentRepo();
                _rootRepo       = RepositoryFactory.CreateRootRepo();
                //從QueryString取得 部門代碼
                string deptID = String.IsNullOrEmpty(Request["DepartmentID"]) ? String.Empty : Request["DepartmentID"].ToString();

                //將主管資料 與下拉式選單綁定
                ViewUtils.SetOptions(ChiefID_FK, _rootRepo.GetEmployee());
                //部門資料 與下拉式選單綁定
                ViewUtils.SetOptions(UpperDepartmentID, _rootRepo.GetDepartment());
                //將員工資料 與下拉式選單綁定
                ViewUtils.SetOptions(FilingEmployeeID_FK, _rootRepo.GetEmployee());

                PageTitle.Value = "部門基本資料 > 新增";

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

                    DepartmentID.ReadOnly     = true;
                    ChiefName.Value           = ChiefID_FK.Text;
                    UpperDepartmentName.Value = UpperDepartmentID.Text;;
                    FilingEmployeeName.Value  = FilingEmployeeID_FK.Text;
                    PageTitle.Value           = "部門基本資料 > 編輯";
                }
            }
        }