예제 #1
0
        public void BindData(ReportFilter filter)
        {
            var location = new ReportController().GetCityName(filter.SessionDepartment);

            xrtOutputDate.Text = string.Format(xrtOutputDate.Text, location, DateTime.Now.Day,
                                               DateTime.Now.Month, DateTime.Now.Year);

            xrlCompanyName.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_ListEmployeeNotHaveSocialInsuranceRecord(string.Join(",",
                                                                                                       arrOrgCode)));

                DataSource = table;

                //binding data
                xrtEmployeeCode.DataBindings.Add("Text", DataSource, "EmployeeCode");
                xrtFullName.DataBindings.Add("Text", DataSource, "FullName");
                xrtBirthDate.DataBindings.Add("Text", DataSource, "BirthDate", "{0:dd/MM/yyyy}");
                xrtSex.DataBindings.Add("Text", DataSource, "Sex");
                xrtAddress.DataBindings.Add("Text", DataSource, "Address");
                xrtPhone.DataBindings.Add("Text", DataSource, "Phone");
                xrtDate.DataBindings.Add("Text", DataSource, "ParticipationDate", "{0:dd/MM/yyyy}");
                xrtEducation.DataBindings.Add("Text", DataSource, "Education");
                xrtPosition.DataBindings.Add("Text", DataSource, "Position");
                GroupHeader1.GroupFields.AddRange(new[] { new GroupField("DepartmentId", XRColumnSortOrder.Ascending) });
                xrtDepartment.DataBindings.Add("Text", DataSource, "DepartmentName");
            }
        }