Beispiel #1
0
        public void BindData(ReportFilter filter)
        {
            try
            {
                ReportController rpCtr = new ReportController();
                xrl_TenCongTy.Text = rpCtr.GetCompanyName(filter.SessionDepartment);
                var location = new ReportController().GetCityName(filter.SessionDepartment);
                xrtReportDate.Text = string.Format(xrtReportDate.Text, location, DateTime.Now.Day,
                                                   DateTime.Now.Month, DateTime.Now.Year);

                //Lấy thông tin của nhân viên
                var record = RecordController.GetById(filter.RecordId);
                if (record != null)
                {
                    xrl_FullName.Text         = record.FullName;
                    xrl_DepartmentName.Text   = record.DepartmentName;
                    xrl_Position.Text         = record.PositionName;
                    xrl_Occupation.Text       = "";
                    xr_ParticipationDate.Text = record.ParticipationDate.ToString();
                }

                //Tính thâm niên của nhân viên
                var seniority =
                    SQLHelper.ExecuteTable(
                        SQLManagementAdapter.GetStore_CalculateSeniorityByRecordId(filter.RecordId));
                if (seniority.Rows.Count > 0)
                {
                    xrt_Seniority.Text = seniority.Rows[0]["Seniority"].ToString();
                }

                var table = SQLHelper.ExecuteTable(
                    SQLManagementAdapter.GetStore_ListContractOfEmployee(filter.RecordId));
                DataSource = table;
                xrt_ContractNumber.DataBindings.Add("Text", DataSource, "ContractNumber");
                xrt_ContractType.DataBindings.Add("Text", DataSource, "ContractTypeName");
                xrt_Job.DataBindings.Add("Text", DataSource, "JobName");
                xrt_ContractDate.DataBindings.Add("Text", DataSource, "ContractDate", "{0:dd/MM/yyyy}");
                xrt_EffectiveDate.DataBindings.Add("Text", DataSource, "EffectiveDate", "{0:dd/MM/yyyy}");
                xrt_ContractEndDate.DataBindings.Add("Text", DataSource, "ContractEndDate", "{0:dd/MM/yyyy}");
                xrt_ContractStatus.DataBindings.Add("Text", DataSource, "ContractStatusName");
            }
            catch (Exception ex)
            {
                Dialog.ShowError("Có lỗi xảy ra: " + ex.Message);
            }
        }