Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        private void DisplayTotalBirthInMonth()
        {
            var firstDayOfMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); // get start of month
            var lastDayOfMonth  = firstDayOfMonth.AddMonths(1).AddDays(-1);               // last day of month
            // count birth in month
            var totalBirdInMonth = SQLHelper
                                   .ExecuteTable(SQLManagementAdapter.GetStore_BirthdayOfEmployee(DepartmentIds, firstDayOfMonth, lastDayOfMonth, null, null)).Rows.Count;

            pnlSinhNhatNhanVien.Title += @" <b id='pSinhNhatNhanVien' style='color:red;'>(" + totalBirdInMonth + @" cán bộ)</b>";
        }
Esempio n. 2
0
        public void BindData()
        {
            try
            {
                var firstDayOfMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); // get start of month
                var lastDayOfMonth  = firstDayOfMonth.AddMonths(1).AddDays(-1);               // last day of month

                // from date
                var fromDate = _filter.StartDate != null ? _filter.StartDate.Value : firstDayOfMonth;

                // to date
                var toDate = _filter.EndDate != null ? _filter.EndDate.Value : lastDayOfMonth;

                // select form db
                string departmentIds = string.Join(",", _filter.Departments.Split(
                                                       new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(d => "'{0}'".FormatWith(d)));

                var table = SQLHelper.ExecuteTable(SQLManagementAdapter.GetStore_BirthdayOfEmployee(departmentIds, fromDate, toDate, null, null));
                DataSource = table;

                //binding data
                xrCellEmployeeCode.DataBindings.Add("Text", DataSource, "EmployeeCode");
                xrCellFullName.DataBindings.Add("Text", DataSource, "FullName");
                xrCellPosition.DataBindings.Add("Text", DataSource, "PositionName");
                xrCellPosition.DataBindings.Add("Text", DataSource, "PositionName");
                xrCellDepartment.DataBindings.Add("Text", DataSource, "DepartmentName");
                xrCellBirthDate.DataBindings.Add("Text", DataSource, "BirthDate", "{0:dd/MM/yyyy}");
                xrCellAge.DataBindings.Add("Text", DataSource, "Age");

                GroupHeader1.GroupFields.AddRange(new[] {
                    new GroupField("DepartmentId", XRColumnSortOrder.Ascending)
                });
                xrt_GroupDepartment.DataBindings.Add("Text", DataSource, "DepartmentName");
                // other items
                // label report title
                if (!string.IsNullOrEmpty(_filter.ReportTitle))
                {
                    lblReportTitle.Text = _filter.ReportTitle;
                }
                // lablel duration
                if (_filter.StartDate != null && _filter.EndDate != null)
                {
                    lblDuration.Text = lblDuration.Text.FormatWith(_filter.StartDate.Value.ToString("dd/MM/yyyy"),
                                                                   _filter.EndDate.Value.ToString("dd/MM/yyyy"));
                }
                else
                {
                    lblDuration.Text = string.Empty;
                }
                // label report date
                lblReportDate.Text = lblReportDate.Text.FormatWith(_filter.ReportDate.Day, _filter.ReportDate.Month, _filter.ReportDate.Year);
                // created by
                if (!string.IsNullOrEmpty(_filter.CreatedByTitle))
                {
                    lblCreatedByTitle.Text = _filter.CreatedByTitle;
                }
                if (!string.IsNullOrEmpty(_filter.CreatedByName))
                {
                    lblCreatedByName.Text = _filter.CreatedByName;
                }
                // reviewed by
                //if(!string.IsNullOrEmpty(_filter.ReviewedByTitle)) lblReviewedByTitle.Text = _filter.ReviewedByTitle;
                //if(!string.IsNullOrEmpty(_filter.ReviewedByName)) lblReviewedByName.Text = _filter.ReviewedByName;
                // signed by
                if (!string.IsNullOrEmpty(_filter.SignedByTitle))
                {
                    lblSignedByTitle.Text = _filter.SignedByTitle;
                }
                if (!string.IsNullOrEmpty(_filter.SignedByName))
                {
                    lblSignedByName.Text = _filter.SignedByName;
                }
            }
            catch (Exception ex)
            {
                Dialog.ShowError(ex);
            }
        }
Esempio n. 3
0
        public void DirectLogin()
        {
            try
            {
                // init return message
                var message = string.Empty;
                // init user model
                var userModel = new UserModel
                {
                    // authenticate
                    User = UserServices.Authenticate(txtUserName.Text.Trim(), txtPassword.Text, ref message)
                };
                // check user login
                if (userModel.User == null)
                {
                    // login fail
                    ExtNet.MessageBox.Alert("Login Fail", message).Show();
                    return;
                }
                // check departments
                if (userModel.Departments.Count > 0)
                {
                    // set current user
                    Session["CurrentUser"] = userModel;
                    //

                    if (userModel.User != null)
                    {
                        // check u
                        //lấy danh sách các bộ phận được truy cập tìm cán bộ sinh nhật trong tháng
                        var listDepartmentId = string.Join(",", userModel.Departments.Select(d => d.Id));
                        var objCountContract =
                            SQLHelper.ExecuteTable(
                                SQLManagementAdapter.GetStore_DanhSachNhanVienSapHetHopDong(null, null, 30, listDepartmentId)).Rows.Count;

                        // Danh sách sinh nhật trong tháng
                        var firstDayOfMonth   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); // get start of month
                        var lastDayOfMonth    = firstDayOfMonth.AddMonths(1).AddDays(-1);               // last day of month
                        var tableBirthInMonth = SQLHelper
                                                .ExecuteTable(SQLManagementAdapter.GetStore_BirthdayOfEmployee(listDepartmentId, firstDayOfMonth, lastDayOfMonth, null, null)).Rows.Count;

                        // Danh sách nhân viên đến kì nghỉ hưu
                        var tableRetirement = SQLHelper
                                              .ExecuteTable(SQLManagementAdapter.GetStore_RetirementOfEmployee(null, null, listDepartmentId));
                        var countRetirement = 0;
                        var newEmployeeCode = string.Empty;
                        for (var i = 0; i < tableRetirement.Rows.Count; i++)
                        {
                            var currentEmployeeCode = (string)tableRetirement.Rows[i]["EmployeeCode"];
                            if (currentEmployeeCode != newEmployeeCode)
                            {
                                countRetirement++;
                                newEmployeeCode = currentEmployeeCode;
                            }
                        }

                        // Danh sách nhân viên được nâng lương
                        var tableListSalaryRaise =
                            SQLHelper.ExecuteTable(SQLManagementAdapter.GetStore_ListSalaryRaise(listDepartmentId,
                                                                                                 "1900-01-01", DateTime.Now.ToString("MM/dd/yyyy"), null, null, (int)SalaryDecisionType.Regular, null, null)).Rows.Count;


                        var tableOutFrameSalary =
                            SQLHelper.ExecuteTable(SQLManagementAdapter.GetStore_ListSalaryRaise(listDepartmentId, null, null, null, null, (int)SalaryDecisionType.OverGrade, null, null)).Rows.Count;
                        Session["DataHomePage"] = tableBirthInMonth + ";" + objCountContract + ";" + countRetirement + ";" + tableListSalaryRaise + ";" + tableOutFrameSalary;
                    }
                    else
                    {
                        RM.RegisterClientScriptBlock("al", "Ext.Msg.alert('Lỗi đăng nhập', 'Có lỗi xảy ra trong quá trình đăng nhập');");
                    }

                    // redirect home page
                    Response.Redirect("~/Default.aspx");
                }
                else
                {
                    // alert error message
                    ExtNet.MessageBox.Alert("No Department", "Người dùng chưa được cấp quyền với bất kỳ đơn vị nào.").Show();
                    // redirect login page
                    Response.Redirect("~/Login.aspx");
                }
            }
            catch (Exception ex)
            {
                ExtNet.MessageBox.Alert("Exception", ex.Message).Show();
            }
        }