public frmRpt_SystemUserInfo(UserInfomationEN aUserInfomationEN) { InitializeComponent(); if (aUserInfomationEN.Image != null) { MemoryStream ms = new MemoryStream(aUserInfomationEN.Image); pbxImage.Image = Image.FromStream(ms); } lblName.Text = aUserInfomationEN.Name; lblNames.Text = aUserInfomationEN.Name; lblBirthday.Text = aUserInfomationEN.Birthday.Value.ToString("dd/MM/yyyy"); // chưa set đc format time "{0:dd/MM/yyyy}" if (aUserInfomationEN.Gender == 1) { lblGender.Text = "Nam"; } else { lblGender.Text = "Nữ"; } lblHomeTown.Text = aUserInfomationEN.aSystemUserExts.Hometown; lblIdentify1.Text = aUserInfomationEN.Identifier1; lblPlaceCreateIdentify1.Text = aUserInfomationEN.PlaceOfIssue1; DateTime tempt = new DateTime(); DateTime.TryParse(aUserInfomationEN.Identifier1CreatedDate.ToString(),out tempt); lblHightestAppellation.Text = aUserInfomationEN.aSystemUserExts.HightestAppellation; lblCreateDateIdentify1.Text = aUserInfomationEN.Identifier1CreatedDate != null ? aUserInfomationEN.Identifier1CreatedDate.Value.ToString("dd/MM/yyyy") : null; // chưa set đc format time "{0:dd/MM/yyyy}" lblAddress.Text = aUserInfomationEN.aSystemUserExts.Address; lblPermanentResidence.Text = aUserInfomationEN.aSystemUserExts.PermanentResidence; lblYouthUnionDate.Text = aUserInfomationEN.aSystemUserExts.YouthUnionDate != null? aUserInfomationEN.aSystemUserExts.YouthUnionDate.Value.ToString("dd/MM/yyyy"): null ; // chưa set đc format time "{0:dd/MM/yyyy}" lblCommunistPartyDate.Text = aUserInfomationEN.aSystemUserExts.CommunistPartyDate != null? aUserInfomationEN.aSystemUserExts.CommunistPartyDate.Value.ToString("dd/MM/yyyy") : null; // chưa set đc format time "{0:dd/MM/yyyy}" lblYearJob.Text = aUserInfomationEN.aSystemUserExts.YearJob != null? aUserInfomationEN.aSystemUserExts.YearJob.Value.ToString("dd/MM/yyyy"): null; lblYearDepartment.Text = aUserInfomationEN.aSystemUserExts.YearDepartment != null ? aUserInfomationEN.aSystemUserExts.YearDepartment.Value.ToString("dd/MM/yyyy") : null; lblYearUnemploymentInsurance.Text = aUserInfomationEN.aSystemUserExts.YearUnemploymentInsurance != null ? aUserInfomationEN.aSystemUserExts.YearUnemploymentInsurance.Value.ToString("dd/MM/yyyy"): null; lblEnlistmentDate.Text = aUserInfomationEN.aSystemUserExts.EnlistmentDate != null ? aUserInfomationEN.aSystemUserExts.EnlistmentDate.Value.ToString("dd/MM/yyyy") : null; lblDemobilizedDate.Text = aUserInfomationEN.aSystemUserExts.DemobilizedDate != null ? aUserInfomationEN.aSystemUserExts.DemobilizedDate.Value.ToString("dd/MM/yyyy") : null; lblRecruitment.Text = aUserInfomationEN.aSystemUserExts.Recruitment; if (aUserInfomationEN.aSystemUserExts.LaborFamily == true) { lblLaborFamily.Text = "X"; } if (aUserInfomationEN.aSystemUserExts.MartyrsFamily == true) { lblMartyrsFamily.Text = "X"; } if (aUserInfomationEN.aSystemUserExts.WoundedFamily == true) { lblWoundedFamily.Text = "X"; } // Bằng chính quy this.DetailReport1.DataSource = aUserInfomationEN.aListCertificateExt_Regular; cellSchool1.DataBindings.Add("Text", this.DetailReport1.DataSource, "Certificates_Organization"); cellBranch1.DataBindings.Add("Text", this.DetailReport1.DataSource, "Certificates_Certificates"); cellCreatedDate1.DataBindings.Add("Text", this.DetailReport1.DataSource, "SystemUsers_Certificates_CreatedDate", "{0:dd/MM/yyyy}"); cellExpirationDate1.DataBindings.Add("Text", this.DetailReport1.DataSource, "SystemUsers_Certificates_ExpirationDate", "{0:dd/MM/yyyy}"); cellTrainingType1.DataBindings.Add("Text", this.DetailReport1.DataSource, "TrainingTypeDisplay"); cellLevel1.DataBindings.Add("Text", this.DetailReport1.DataSource, "SystemUsers_Certificates_Level"); // Chứng chỉ this.DetailReport2.DataSource = aUserInfomationEN.aListCertificateExt_Sub; cellSchool2.DataBindings.Add("Text", this.DetailReport2.DataSource, "Certificates_Organization"); cellBranch2.DataBindings.Add("Text", this.DetailReport2.DataSource, "Certificates_Certificates"); cellCreatedDate2.DataBindings.Add("Text", this.DetailReport2.DataSource, "SystemUsers_Certificates_CreatedDate", "{0:dd/MM/yyyy}"); cellExpirationDate2.DataBindings.Add("Text", this.DetailReport2.DataSource, "SystemUsers_Certificates_ExpirationDate", "{0:dd/MM/yyyy}"); cellTrainingType2.DataBindings.Add("Text", this.DetailReport2.DataSource, "TrainingTypeDisplay"); cellLevel2.DataBindings.Add("Text", this.DetailReport2.DataSource, "SystemUsers_Certificates_Level"); // Ly luan chinh tri + Quan ly nha nuoc this.DetailReport7.DataSource = aUserInfomationEN.aListCertificateExt_PoliticGorvenmentManager; cellSchool3.DataBindings.Add("Text", this.DetailReport7.DataSource, "Certificates_Organization"); cellBranch3.DataBindings.Add("Text", this.DetailReport7.DataSource, "Certificates_Certificates"); cellCreatedDate3.DataBindings.Add("Text", this.DetailReport7.DataSource, "SystemUsers_Certificates_CreatedDate", "{0:dd/MM/yyyy}"); cellExpirationDate3.DataBindings.Add("Text", this.DetailReport7.DataSource, "SystemUsers_Certificates_ExpirationDate", "{0:dd/MM/yyyy}"); cellTrainingType3.DataBindings.Add("Text", this.DetailReport7.DataSource, "TrainingTypeDisplay"); cellLevel3.DataBindings.Add("Text", this.DetailReport7.DataSource, "SystemUsers_Certificates_Level"); // Quá trình công tác this.DetailReport3.DataSource = aUserInfomationEN.aListAuditHistories; cellAuditHistories_From.DataBindings.Add("Text", this.DetailReport3.DataSource, "From", "{0:dd/MM/yyyy}"); cellAuditHistories_To.DataBindings.Add("Text", this.DetailReport3.DataSource, "To", "{0:dd/MM/yyyy}"); cellAuditHistories_Note.DataBindings.Add("Text", this.DetailReport3.DataSource, "Note"); // Quan hệ gia đình this.DetailReport4.DataSource = aUserInfomationEN.aListFamilyMembers; cellRelationType.DataBindings.Add("Text", this.DetailReport4.DataSource, "RelationDisplay"); cellNameFamily.DataBindings.Add("Text", this.DetailReport4.DataSource, "Name"); cellBirthday_FamilyMember.DataBindings.Add("Text", this.DetailReport4.DataSource, "Birthday", "{0:dd/MM/yyyy}"); cellInfo.DataBindings.Add("Text", this.DetailReport4.DataSource, "Info"); // Khen thưởng this.DetailReport.DataSource = aUserInfomationEN.aListReward; cellSubjectReward.DataBindings.Add("Text", this.DetailReport.DataSource, "Subject"); cellDecisionRewardDate.DataBindings.Add("Text", this.DetailReport.DataSource, "DecisionDate", "{0:dd/MM/yyyy}"); cellNumberDecisionReward.DataBindings.Add("Text", this.DetailReport.DataSource, "NumberDecision"); cellDecisionRewardLevel.DataBindings.Add("Text", this.DetailReport.DataSource, "DecisionLevel"); // Kỷ luật this.DetailReport6.DataSource = aUserInfomationEN.aListPunishments; cellSubjectPunishment.DataBindings.Add("Text", this.DetailReport6.DataSource, "Subject"); cellDecisionPunishDate.DataBindings.Add("Text", this.DetailReport6.DataSource, "DecisionDate", "{0:dd/MM/yyyy}"); cellNumberDecisionPunish.DataBindings.Add("Text", this.DetailReport6.DataSource, "NumberDecision"); cellDecisionPunishLevel.DataBindings.Add("Text", this.DetailReport6.DataSource, "DecisionLevel"); // Giấy tờ khác this.DetailReport5.DataSource = aUserInfomationEN.aListDocumentSystemUsers; cellNameDocumentSystemUsers.DataBindings.Add("Text", this.DetailReport5.DataSource, "Note"); lblDateNow.Text = DateTime.Now.Day.ToString(); lblMonthNow.Text = DateTime.Now.Month.ToString(); lblYearNow.Text = DateTime.Now.Year.ToString(); }
private void btnPrint_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { SystemUsersBO aSysUserBO = new SystemUsersBO(); UserInfomationEN aUserInfomationEN = new UserInfomationEN(); int IDSystemUser = int.Parse(grvSystemUser.GetFocusedRowCellValue("ID").ToString()); // Thong tin cua SystemUser SystemUsers aSystemUsers = aSysUserBO.Select_ByID(IDSystemUser); aUserInfomationEN.ID = IDSystemUser; aUserInfomationEN.Name = aSystemUsers.Name; aUserInfomationEN.Gender = aSystemUsers.Gender; aUserInfomationEN.Birthday = aSystemUsers.Birthday; aUserInfomationEN.Identifier1 = aSystemUsers.Identifier1; aUserInfomationEN.Identifier1CreatedDate = aSystemUsers.Identifier1CreatedDate; aUserInfomationEN.PlaceOfIssue1 = aSystemUsers.PlaceOfIssue1; aUserInfomationEN.Image = aSystemUsers.Image; // Thong tin cua SystemUserExt SystemUserExts aSystemUserExts = aSystemUserExtsBO.Select_ByIDSystemUser(IDSystemUser); aUserInfomationEN.aSystemUserExts = aSystemUserExts; // Thong tin bang chinh quy List<CertificateExtInfoEN> aListCertificateExt_Regular = new List<CertificateExtInfoEN>(); List<vw__CertificatesInfo__SystemUsers_Certificates> aTemp_Regular = aCertificatesBO.GetRegularCertificate(IDSystemUser); CertificateExtInfoEN aCertificateExtInfoEN_Regular; for (int i = 0; i < aTemp_Regular.Count; i++) { aCertificateExtInfoEN_Regular = new CertificateExtInfoEN(); aCertificateExtInfoEN_Regular.Certificates_Organization = aTemp_Regular[i].Certificates_Organization; aCertificateExtInfoEN_Regular.Certificates_Certificates = aTemp_Regular[i].Certificates_Certificates; if (aTemp_Regular[i].SystemUsers_Certificates_Level == "1") { aCertificateExtInfoEN_Regular.SystemUsers_Certificates_Level = "Giỏi"; } else if (aTemp_Regular[i].SystemUsers_Certificates_Level == "2") { aCertificateExtInfoEN_Regular.SystemUsers_Certificates_Level = "Khá"; } else { aCertificateExtInfoEN_Regular.SystemUsers_Certificates_Level = "Trung bình"; } aCertificateExtInfoEN_Regular.SystemUsers_Certificates_CreatedDate = aTemp_Regular[i].SystemUsers_Certificates_CreatedDate; aCertificateExtInfoEN_Regular.SystemUsers_Certificates_ExpirationDate = aTemp_Regular[i].SystemUsers_Certificates_ExpirationDate; if (aTemp_Regular[i].SystemUsers_Certificates_TrainingType == "1") { aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Chính Quy"; } else if (aTemp_Regular[i].SystemUsers_Certificates_TrainingType == "2") { aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Tại chức"; } else if (aTemp_Regular[i].SystemUsers_Certificates_TrainingType == "3") { aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Văn bằng 2"; } else if (aTemp_Regular[i].SystemUsers_Certificates_TrainingType == "4") { aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Liên thông"; } else if (aTemp_Regular[i].SystemUsers_Certificates_TrainingType == "5") { aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Chứng chỉ"; } else { aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Từ xa"; } aListCertificateExt_Regular.Add(aCertificateExtInfoEN_Regular); } aUserInfomationEN.aListCertificateExt_Regular = aListCertificateExt_Regular; // Thong tin chung chi phu List<CertificateExtInfoEN> aListCertificateExt_Sub = new List<CertificateExtInfoEN>(); List<vw__CertificatesInfo__SystemUsers_Certificates> aTemp_Sub = aCertificatesBO.GetSubCertificate(IDSystemUser); CertificateExtInfoEN aCertificateExtInfoEN_Sub; for (int i = 0; i < aTemp_Sub.Count; i++) { aCertificateExtInfoEN_Sub = new CertificateExtInfoEN(); aCertificateExtInfoEN_Sub.Certificates_Organization = aTemp_Sub[i].Certificates_Organization; aCertificateExtInfoEN_Sub.Certificates_Certificates = aTemp_Sub[i].Certificates_Certificates; if (aTemp_Sub[i].SystemUsers_Certificates_Level == "1") { aCertificateExtInfoEN_Sub.SystemUsers_Certificates_Level = "Giỏi"; } else if (aTemp_Sub[i].SystemUsers_Certificates_Level == "2") { aCertificateExtInfoEN_Sub.SystemUsers_Certificates_Level = "Khá"; } else { aCertificateExtInfoEN_Sub.SystemUsers_Certificates_Level = "Trung bình"; } aCertificateExtInfoEN_Sub.SystemUsers_Certificates_CreatedDate = aTemp_Sub[i].SystemUsers_Certificates_CreatedDate; aCertificateExtInfoEN_Sub.SystemUsers_Certificates_ExpirationDate = aTemp_Sub[i].SystemUsers_Certificates_ExpirationDate; aCertificateExtInfoEN_Sub.SystemUsers_Certificates_TrainingType = aTemp_Sub[i].SystemUsers_Certificates_TrainingType; if (aTemp_Sub[i].SystemUsers_Certificates_TrainingType == "1") { aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Chính Quy"; } else if (aTemp_Sub[i].SystemUsers_Certificates_TrainingType == "2") { aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Tại chức"; } else if (aTemp_Sub[i].SystemUsers_Certificates_TrainingType == "3") { aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Văn bằng 2"; } else if (aTemp_Sub[i].SystemUsers_Certificates_TrainingType == "4") { aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Liên thông"; } else if (aTemp_Sub[i].SystemUsers_Certificates_TrainingType == "5") { aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Chứng chỉ"; } else { aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Từ xa"; } aListCertificateExt_Sub.Add(aCertificateExtInfoEN_Sub); } aUserInfomationEN.aListCertificateExt_Sub = aListCertificateExt_Sub; // Thong tin chung chi Ly luan chinh tri + Quan ly nha nuoc List<CertificateExtInfoEN> aListCertificateExt_PoliticGorvenmentManager = new List<CertificateExtInfoEN>(); List<vw__CertificatesInfo__SystemUsers_Certificates> aTemp_PoliticGorvenmentManager = aCertificatesBO.GetPoliticalGorvenmentManagerCertificate(IDSystemUser); CertificateExtInfoEN aCertificateExtInfoEN_PoliticGorvenmentManager; for (int i = 0; i < aTemp_PoliticGorvenmentManager.Count; i++) { aCertificateExtInfoEN_PoliticGorvenmentManager = new CertificateExtInfoEN(); aCertificateExtInfoEN_PoliticGorvenmentManager.Certificates_Organization = aTemp_PoliticGorvenmentManager[i].Certificates_Organization; aCertificateExtInfoEN_PoliticGorvenmentManager.Certificates_Certificates = aTemp_PoliticGorvenmentManager[i].Certificates_Certificates; if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_Level == "1") { aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_Level = "Giỏi"; } else if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_Level == "2") { aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_Level = "Khá"; } else { aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_Level = "Trung bình"; } aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_CreatedDate = aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_CreatedDate; aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_ExpirationDate = aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_ExpirationDate; aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_TrainingType = aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType; if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType == "1") { aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Chính Quy"; } else if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType == "2") { aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Tại chức"; } else if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType == "3") { aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Văn bằng 2"; } else if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType == "4") { aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Liên thông"; } else if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType == "5") { aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Chứng chỉ"; } else { aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Từ xa"; } aListCertificateExt_PoliticGorvenmentManager.Add(aCertificateExtInfoEN_PoliticGorvenmentManager); } aUserInfomationEN.aListCertificateExt_PoliticGorvenmentManager = aListCertificateExt_PoliticGorvenmentManager; // Thong tin gia dinh List<FamilyMembersExtEN> aListFamilyMembersExtEN = new List<FamilyMembersExtEN>(); List<FamilyMembers> aTemp_FamilyMembers = aFamilyMembersBO.Select_ByIDSystemUser(IDSystemUser); FamilyMembersExtEN aFamilyMembersExtEN; for (int i = 0; i < aTemp_FamilyMembers.Count; i++) { aFamilyMembersExtEN = new FamilyMembersExtEN(); aFamilyMembersExtEN.Name = aTemp_FamilyMembers[i].Name; aFamilyMembersExtEN.Birthday = aTemp_FamilyMembers[i].Birthday; aFamilyMembersExtEN.Info = aTemp_FamilyMembers[i].Info; if (aTemp_FamilyMembers[i].RelationType == 1) { aFamilyMembersExtEN.RelationDisplay = "Bố"; } else if (aTemp_FamilyMembers[i].RelationType == 2) { aFamilyMembersExtEN.RelationDisplay = "Mẹ"; } else if (aTemp_FamilyMembers[i].RelationType == 3) { aFamilyMembersExtEN.RelationDisplay = "Anh/Chị/Em"; } else if (aTemp_FamilyMembers[i].RelationType == 4) { aFamilyMembersExtEN.RelationDisplay = "Con cái"; } aListFamilyMembersExtEN.Add(aFamilyMembersExtEN); } aUserInfomationEN.aListFamilyMembers = aListFamilyMembersExtEN; // Thong tin qua trinh cong tac aUserInfomationEN.aListAuditHistories = aAuditHistoriesBO.Select_ByIDSystemUser(IDSystemUser); // Thong tin khen thuong aUserInfomationEN.aListReward = aRewardAndPunishmentsBO.Select_ByIDSystemUser_ByType(IDSystemUser,1); // Thong tin khen thuong aUserInfomationEN.aListPunishments = aRewardAndPunishmentsBO.Select_ByIDSystemUser_ByType(IDSystemUser, 2); // Thong tin giay to # aUserInfomationEN.aListDocumentSystemUsers = aDocumentSystemUsersBO.Select_ByIDSystemUser(IDSystemUser); frmRpt_SystemUserInfo aReport = new frmRpt_SystemUserInfo(aUserInfomationEN); ReportPrintTool tool = new ReportPrintTool(aReport); tool.ShowPreview(); }