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

                // get organization
                var organization = cat_DepartmentServices.GetByDepartments(filter.SessionDepartment);
                if (organization != null)
                {
                    //select form db
                    var arrOrgCode = string.IsNullOrEmpty(filter.SelectedDepartment)
                        ? new string[] { }
                        : filter.SelectedDepartment.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 0; i < arrOrgCode.Length; i++)
                    {
                        arrOrgCode[i] = "'{0}'".FormatWith(arrOrgCode[i]);
                    }

                    var table = SQLHelper.ExecuteTable(
                        SQLManagementAdapter.GetStore_ReportListEmployeeJoinUnion(string.Join(",", arrOrgCode)));
                    DataSource = table;

                    //binding data

                    xrt_EmployeeCode.DataBindings.Add("Text", DataSource, "EmployeeCode");
                    xrt_FullName.DataBindings.Add("Text", DataSource, "FullName");
                    xrt_BirthDate.DataBindings.Add("Text", DataSource, "BirthDate", "{0:dd/MM/yyyy}");
                    xrt_Sex.DataBindings.Add("Text", DataSource, "Sex");
                    xrt_PhoneNumber.DataBindings.Add("Text", DataSource, "Phone");
                    xrt_UnionJoinedDate.DataBindings.Add("Text", DataSource, "UnionJoinedDate", "{0:dd/MM/yyyy}");
                    xrt_UnionPosition.DataBindings.Add("Text", DataSource, "Position");
                    GroupHeader1.GroupFields.AddRange(new[]
                                                      { new GroupField("DepartmentId", XRColumnSortOrder.Ascending) });
                    xrl_DepartmentName.DataBindings.Add("Text", DataSource, "DepartmentName");
                }
            }
            catch (Exception ex)
            {
                Dialog.ShowNotification("Có lỗi xảy ra: " + ex.Message);
            }
        }