private void BindReportInfo() { if (ReportId > 0) { try { AuditReport report = new AuditReport(); AuditReportService reportBSO = new AuditReportService(); report = reportBSO.FindByKey(ReportId); if (report != null) { if (report.Status == 1 || report.Status == 3) { btnSend.Visible = true; btnConfirm.Visible = true; } else { btnSend.Visible = false; btnConfirm.Visible = false; } if (report.PathFile != "") { lbtDownload.Text = report.PathFile; lbtDownload.Visible = true; } else { lbtDownload.Visible = false; } if (report.EnterpriseId > 0) { Enterprise enter = new EnterpriseService().FindByKey((report.EnterpriseId)); if (enter != null) { ltEnterpriseName.Text = enter.Title; ucEnergyConsume.CustomerCode = enter.CustomerCode; ltAreaName.Text = "------"; if (enter.AreaId > 0) { Area area = new Area(); area = new AreaService().FindByKey(enter.AreaId); if (area != null) { ltAreaName.Text = area.AreaName; } } ltSubAreaName.Text = "------"; if (enter.SubAreaId > 0) { Area area = new Area(); area = new AreaService().FindByKey(enter.SubAreaId); if (area != null) { ltSubAreaName.Text = area.AreaName; } } ltProvinceName.Text = "------"; if (enter.ProvinceId > 0) { Province area = new Province(); area = new ProvinceService().FindByKey(enter.ProvinceId); if (area != null) { ltProvinceName.Text = area.ProvinceName; } } ltDistrictName.Text = "------"; if (enter.DistrictId > 0) { District area = new District(); area = new DistrictService().FindByKey(enter.DistrictId); if (area != null) { ltDistrictName.Text = area.DistrictName; } } ltTaxNo.Text = enter.TaxCode; ltAddress.Text = enter.Address; ltEmail.Text = enter.Email; ltFaxNo.Text = enter.Fax; ltPhoneNumber.Text = enter.Phone; ltResponsible.Text = enter.ManPerson; ltParentName.Text = enter.ParentName; ltProvinceParent.Text = "------"; if (enter.ManProvinceId > 0) { Province area = new Province(); area = new ProvinceService().FindByKey(enter.ManProvinceId); if (area != null) { ltProvinceParent.Text = area.ProvinceName; } } //ltDistrictParent.Text = ddlDistrictReporter.SelectedItem.Text; ltDistrictParent.Text = "------"; if (enter.ManDistrictId > 0) { District area = new District(); area = new DistrictService().FindByKey(enter.ManDistrictId); if (area != null) { ltDistrictParent.Text = area.DistrictName; } } ltEmailParent.Text = enter.ManEmail; ltFaxParent.Text = enter.ManFax; ltAddressParent.Text = enter.ManAddress; ltPhoneParent.Text = enter.ManPhone; ltCustomerCode.Text = enter.CustomerCode; } } ucElectrictSystem.ReportYear = report.AuditYear; ucElectrictSystem.AllowEdit = AllowEdit; ucElectrictSystem.ReportId = ReportId; ucAuditSolution.ReportYear = report.AuditYear; ucAuditSolution.AllowEdit = AllowEdit; ucAuditSolution.ReportId = ReportId; ucAuditProduct.ReportYear = report.AuditYear; ucAuditProduct.AllowEdit = AllowEdit; ucAuditProduct.ReportId = ReportId; ucAuditOperationArea.ReportYear = report.AuditYear; ucAuditOperationArea.AllowEdit = AllowEdit; ucAuditOperationArea.ReportId = ReportId; ucEnergyConsume.ReportYear = report.AuditYear; ucEnergyConsume.AllowEdit = AllowEdit; ucEnergyConsume.ReportId = ReportId; ucEnergyQuota.ReportYear = report.AuditYear; ucEnergyQuota.AllowEdit = AllowEdit; ucEnergyQuota.ReportId = ReportId; //if (memVal.OrgId > 0 && report.Or != Convert.ToInt32(memVal.OrgId))//Neu // Response.Redirect(ResolveUrl("~")); AuditYearReport = report.AuditYear; ltAuditYear.Text = AuditYearReport.ToString(); ltAuditYear.Text = AuditYearReport.ToString(); ltDataYear.Text = report.DataYear.ToString(); ltAuditUnit.Text = report.AuditConsultancyName; ltAuditAddress.Text = report.Address; ltAuditor.Text = report.AuditorName; ltAuditScope.Text = report.AuditingScope; ltShiftNo1.Text = ""; ltShiftNo2.Text = ""; ltShiftNo3.Text = ""; if (report.ShiftNo == 0) { ltShiftNo1.Text = "X"; } else { if (report.ShiftNo == 1) { ltShiftNo2.Text = "X"; } else { ltShiftNo3.Text = "X"; } } } } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } } }
private void BindReportInfo() { if (ReportId > 0) { btn_edit2.Visible = true; AllowEdit = true; try { AuditReport report = new AuditReport(); AuditReportService reportBSO = new AuditReportService(); report = reportBSO.FindByKey(ReportId); if (report != null) { if (memVal.OrgId > 0) { Enterprise enter = new EnterpriseService().FindByKey((memVal.OrgId)); if (enter != null) { ucEnergyConsume.CustomerCode = enter.CustomerCode; } } if (report.Status == 0 || report.Status == 2) { AllowEdit = true; } else { AllowEdit = false; } btnAddPlan.Visible = btnSaveEquipment.Visible = btnEditBasicInfo.Visible = btnSend.Visible = btn_edit2.Visible = AllowEdit; txtAuditConsultant.Text = report.AuditConsultancyName; txtAddress.Text = report.Address; txtAuditor.Text = report.AuditorName; txtAuditScope.Text = report.AuditingScope; rbtShiftNo.SelectedValue = report.ShiftNo.ToString(); ddlAuditYear.SelectedValue = report.AuditYear.ToString(); ddlDataYear.SelectedValue = report.DataYear.ToString(); txtAuditorCode.Text = report.AuditorCode; txtMST.Text = report.TaxNo; if (report.PathFile != "") { lbtDownload.Text = report.PathFile; lbtDownload.Visible = true; ltAttach.Text = report.PathFile; } else { lbtDownload.Visible = false; ltAttach.Text = "Chọn file đính kèm"; } ucElectrictSystem.ReportYear = report.AuditYear; ucElectrictSystem.AllowEdit = AllowEdit; ucElectrictSystem.ReportId = ReportId; ucAuditSolution.ReportYear = report.AuditYear; ucAuditSolution.AllowEdit = AllowEdit; ucAuditSolution.ReportId = ReportId; ucAuditProduct.ReportYear = report.AuditYear; ucAuditProduct.AllowEdit = AllowEdit; ucAuditProduct.ReportId = ReportId; ucAuditOperationArea.ReportYear = report.AuditYear; ucAuditOperationArea.AllowEdit = AllowEdit; ucAuditOperationArea.ReportId = ReportId; ucEnergyConsume.ReportYear = report.AuditYear; ucEnergyConsume.AllowEdit = AllowEdit; ucEnergyConsume.ReportId = ReportId; ucEnergyQuota.ReportYear = report.AuditYear; ucEnergyQuota.AllowEdit = AllowEdit; ucEnergyQuota.ReportId = ReportId; ucAuditDevice.ReportYear = report.AuditYear; ucAuditDevice.AllowEdit = AllowEdit; ucAuditDevice.ReportId = ReportId; if (memVal.OrgId > 0 && report.EnterpriseId != memVal.OrgId)//Neu { Response.Redirect(ResolveUrl("~")); } AuditYearReport = report.AuditYear; ltAuditYear.Text = AuditYearReport.ToString(); BindInfoLabel(); } } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } } }