void BindOtherConsume() { DataSet ds = new DataSet(); ds = new AuditReportService().GetTOEByAuditReport(ReportId); TotalCO2 = ds.Tables[0].Select().Sum(p => Convert.ToDecimal(p["NoCO2"])); ltTotaCO2.Text = Tool.ConvertDecimalToString(TotalCO2, 2); TotalTOE = ds.Tables[0].Select().Sum(p => Convert.ToDecimal(p["NoTOE"])); ltTotalTOE.Text = Tool.ConvertDecimalToString(TotalTOE, 2); rptFuelConsume.DataSource = ds.Tables[0]; rptFuelConsume.DataBind(); TotalCO2S = ds.Tables[1].Select().Sum(p => Convert.ToDecimal(p["NoCO2"])); ltTotalCO2S.Text = Tool.ConvertDecimalToString(TotalCO2S, 2); TotalTOES = ds.Tables[1].Select().Sum(p => Convert.ToDecimal(p["NoTOE"])); ltTotalTOES.Text = Tool.ConvertDecimalToString(TotalTOES, 2); rptSaveFuel.DataSource = ds.Tables[1]; rptSaveFuel.DataBind(); if (TotalTOE > 0) { ltRateSave.Text = (Math.Round((TotalTOES * 100) / TotalTOE, 1)) + "%"; } else { ltRateSave.Text = Math.Round((TotalTOES * 100), 1).ToString() + "%"; } }
protected void rptAuditReport_ItemDataBound(object sender, RepeaterItemEventArgs e) { Literal ltLevelCO2 = (Literal)e.Item.FindControl("ltLevelCO2"); Literal ltNoTOE = (Literal)e.Item.FindControl("ltNoTOE"); DataRowView dr = (DataRowView)e.Item.DataItem; if (dr != null) { int eID = Convert.ToInt32(dr["Id"]); DataTable dtFuel = new AuditReportService().GetCO2ByReport(eID); decimal dsum = 0; decimal NoTOE = 0; if (dtFuel != null && dtFuel.Rows.Count > 0) { for (int i = 0; i < dtFuel.Rows.Count; i++) { dsum = dsum + Convert.ToDecimal(dtFuel.Rows[i]["NoCO2"]); NoTOE = NoTOE + Convert.ToDecimal(dtFuel.Rows[i]["NoTOE"]); } } ltLevelCO2.Text = Tool.ConvertDecimalToString(Math.Round(dsum, 2), 2); ltNoTOE.Text = Tool.ConvertDecimalToString(Math.Round(NoTOE, 2), 2); } }
private void BindData() { ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage); if (memVal.OrgId > 0) { DataTable list = new AuditReportService().FindList(0, 0, 0, memVal.OrgId, 0, 0, -1, 0, "", paging); rptAuditReport.DataSource = list; rptAuditReport.DataBind(); if (list != null && list.Rows.Count > 0) { Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]); Paging.PageSize = PageSize; Paging.DataLoad(); if (Paging.TotalPages > 1) { Paging.Visible = true; } else { Paging.Visible = false; } } else { Paging.Visible = false; } } }
protected void btnAddReport_Click(object sender, EventArgs e) { if (memVal.OrgId > 0) { AuditReport report = new AuditReport(); report.EnterpriseId = Convert.ToInt32(memVal.OrgId); report.AuditYear = Convert.ToInt32(ddlAuditYear.SelectedValue); report.DataYear = Convert.ToInt32(ddlDataYear.SelectedValue); report.AuditConsultancyName = txtAuditConsultant.Text.Trim(); report.Address = txtAddress.Text.Trim(); report.AuditorName = txtAuditor.Text.Trim(); report.AuditingScope = txtAuditScope.Text.Trim(); report.ShiftNo = Convert.ToInt32(rbtShiftNo.SelectedValue); report.AuditorCode = txtAuditorCode.Text.Trim(); report.TaxNo = txtMST.Text.Trim(); int ret = new AuditReportService().Insert(report); if (ret > 0) { Response.Redirect(ResolveUrl("~") + "bao-cao-so-kiem-toan-nl-" + ret + ".aspx"); } else { ScriptManager.RegisterStartupScript(this, GetType(), "addReport", "ShowDialogAuditReport();", true); } } }
protected void lbtDownload_Click(object sender, EventArgs e) { LinkButton lbtDownload = (LinkButton)sender; AuditReport report = new AuditReportService().FindByKey(Convert.ToInt32(lbtDownload.CommandArgument)); if (report != null && report.PathFile != "") { string Filpath = Server.MapPath("~/UserFile/Report/" + report.PathFile); DownLoad(Filpath); } }
protected void rptAuditReport_ItemDataBound(object sender, RepeaterItemEventArgs e) { Literal ltSaveTOE = (Literal)e.Item.FindControl("ltSaveTOE"); Literal ltTotalTOE = (Literal)e.Item.FindControl("ltTotalTOE"); StringBuilder sb = new StringBuilder(); DataRowView dr = (DataRowView)e.Item.DataItem; if (dr != null) { int eID = Convert.ToInt32(dr["Id"]); DataSet dsFuel = new AuditReportService().GetTOEByAuditReport(eID); IList <Fuel> listFuel = new List <Fuel>(); if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Fuel_All)) { listFuel = new FuelService().FindAll(); AspNetCache.SetCache(Constants.Cache_ReportFuel_Fuel_All, listFuel); } else { listFuel = (IList <Fuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Fuel_All); } decimal dsum = 0; decimal NoTOE = 0; decimal dsumTK = 0; decimal NoTOETK = 0; if (dsFuel != null && dsFuel.Tables.Count > 0) { for (int i = 0; i < dsFuel.Tables[0].Rows.Count; i++) { dsum = dsum + Convert.ToDecimal(dsFuel.Tables[0].Rows[i]["NoCO2"]); NoTOE = NoTOE + Convert.ToDecimal(dsFuel.Tables[0].Rows[i]["NoTOE"]); } for (int i = 0; i < dsFuel.Tables[1].Rows.Count; i++) { dsumTK = dsumTK + Convert.ToDecimal(dsFuel.Tables[1].Rows[i]["NoCO2"]); NoTOETK = NoTOETK + Convert.ToDecimal(dsFuel.Tables[1].Rows[i]["NoTOE"]); } } decimal rate = 0; if (NoTOE > 0) { rate = Math.Round((NoTOETK / NoTOE) * 100, 2); } ltSaveTOE.Text = rate.ToString() + "%"; ltTotalTOE.Text = Tool.ConvertDecimalToString(NoTOE, 2); } }
private void BindData() { ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage); //if (m_UserValidation.OrgId > 0) //{ int AuditYear = 0; if (ddlYear.SelectedIndex > 0) { AuditYear = Convert.ToInt32(ddlYear.SelectedValue); } int AreaId = 0; if (ddlArea.SelectedIndex > 0) { AreaId = Convert.ToInt32(ddlArea.SelectedValue); } int DistrictId = 0; //if (ddlDistrict.SelectedIndex > 0) // DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue); DataTable list = new AuditReportService().FindList(AreaId, 0, 0, 0, 0, DistrictId, Convert.ToInt32(AuditReportStatus.CONFIRMED), AuditYear, txtKeyword.Text.Trim(), paging); rptAuditReport.DataSource = list; rptAuditReport.DataBind(); if (list != null && list.Rows.Count > 0) { Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]); Paging.PageSize = PageSize; Paging.DataLoad(); Paging2.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]); Paging2.PageSize = PageSize; Paging2.DataLoad(); if (Paging.TotalPages > 1) { ltTotal.Text = "Có " + list.Rows.Count + " trong tổng số " + list.Rows[0]["Total"] + " báo cáo"; Paging2.Visible = Paging.Visible = true; } else { ltTotal.Text = "Có tổng số " + list.Rows[0]["Total"] + " báo cáo"; Paging2.Visible = Paging.Visible = false; } } else { Paging2.Visible = Paging.Visible = false; } //} }
protected void btnDelete_Click(object sender, EventArgs e) { LinkButton btnDelete = (LinkButton)sender; AuditReportService faqsBSO = new AuditReportService(); AuditReport report = faqsBSO.FindByKey(Convert.ToInt32(btnDelete.CommandArgument)); if (report != null && report.Status > 0) { if (faqsBSO.Delete(Convert.ToInt32(btnDelete.CommandArgument)) > 0) { BindData(); } else { Tool.Message(this.Page, "Xóa không thành công. Vui lòng thử lại"); } } else { Tool.Message(this.Page, "Báo cáo đã được gửi đi đang được duyệt, bạn không thể xóa báo cáo này."); } }
protected void btnConfirm_Click(object sender, EventArgs e) { try { AuditReportService faqsBSO = new AuditReportService(); ReportLog log = new ReportLog(); log.ActionName = "Xác nhận báo cáo"; log.Comment = txtContent.Text; log.ReportId = ReportId; log.Created = DateTime.Now; log.MemberId = memVal.UserId; log.UserName = memVal.UserName; log.LogType = Convert.ToInt32(LogType.AUDITREPORT); if (rblApproved.SelectedIndex == 0) { log.Status = "Đã hoàn thành"; new ReportLogService().Insert(log); if (faqsBSO.UpdateStatus(ReportId, Convert.ToInt32(AuditReportStatus.CONFIRMED)) > 0) { Response.Redirect(ResolveUrl("~") + "Admin/UnConfirmAuditReportList/Default.aspx"); } } else { log.Status = "Đang tiếp tục"; new ReportLogService().Insert(log); if (faqsBSO.UpdateStatus(ReportId, Convert.ToInt32(AuditReportStatus.EDIT)) > 0) { Response.Redirect(ResolveUrl("~") + "Admin/UnConfirmAuditReportList/Default.aspx"); } } } catch (Exception ex) { //clientview.Text = ex.Message.ToString(); } }
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(); } } }
protected void rptAuditReport_ItemDataBound(object sender, RepeaterItemEventArgs e) { Literal ltNoTOE = (Literal)e.Item.FindControl("ltNoTOE"); Literal ltTotalTOE = (Literal)e.Item.FindControl("ltTotalTOE"); StringBuilder sb = new StringBuilder(); DataRowView dr = (DataRowView)e.Item.DataItem; if (dr != null) { int eID = Convert.ToInt32(dr["Id"]); DataTable dtFuel = new AuditReportService().GetCO2ByReport(eID); IList <Fuel> listFuel = new List <Fuel>(); if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Fuel_All)) { listFuel = new FuelService().FindAll(); AspNetCache.SetCache(Constants.Cache_ReportFuel_Fuel_All, listFuel); } else { listFuel = (IList <Fuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Fuel_All); } decimal dsum = 0; decimal NoTOE = 0; if (dtFuel != null && dtFuel.Rows.Count > 0) { for (int i = 0; i < dtFuel.Rows.Count; i++) { dsum = dsum + Convert.ToDecimal(dtFuel.Rows[i]["NoCO2"]); NoTOE = NoTOE + Convert.ToDecimal(dtFuel.Rows[i]["NoTOE"]); } } foreach (Fuel fuel in listFuel) { sb.Append("<td class='text-right'>"); if (dtFuel != null && dtFuel.Rows.Count > 0) { DataRow[] drows = dtFuel.Select("FuelId=" + fuel.Id); if (drows != null && drows.Count() > 0) { decimal rate = 0; if (NoTOE > 0) { rate = Math.Round((Convert.ToDecimal(drows[0]["NoTOE"]) / NoTOE) * 100, 2); } //sb.Append(Tool.ConvertDecimalToString(Math.Round(Convert.ToDecimal(drows[0]["NoTOE"]), 2)) + "(" + rate + "%)"); if (rate > 50) { sb.Append("<b>" + rate + "%</b>"); } else { sb.Append(rate + "%"); } } else { sb.Append("-"); } } else { sb.Append("-"); } sb.Append("</td>"); } ltNoTOE.Text = sb.ToString(); ltTotalTOE.Text = Tool.ConvertDecimalToString(NoTOE, 2); } }
private void BindData() { IList <Fuel> listFuel = new List <Fuel>(); if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Fuel_All)) { listFuel = new FuelService().FindAll(); AspNetCache.SetCache(Constants.Cache_ReportFuel_Fuel_All, listFuel); } else { listFuel = (IList <Fuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Fuel_All); } foreach (Fuel fuel in listFuel) { ltHeaderFuel.Text = ltHeaderFuel.Text + "<th>" + fuel.FuelName + "</th>"; } ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage); //if (m_UserValidation.OrgId > 0) //{ int AuditYear = 0; if (ddlYear.SelectedIndex > 0) { AuditYear = Convert.ToInt32(ddlYear.SelectedValue); } int AreaId = 0; if (ddlArea.SelectedIndex > 0) { AreaId = Convert.ToInt32(ddlArea.SelectedValue); } int DistrictId = 0; //if (ddlDistrict.SelectedIndex > 0) // DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue); DataTable list = new AuditReportService().FindList(AreaId, 0, 0, 0, 0, DistrictId, Convert.ToInt32(AuditReportStatus.CONFIRMED), AuditYear, txtKeyword.Text.Trim(), paging); rptAuditReport.DataSource = list; rptAuditReport.DataBind(); if (list != null && list.Rows.Count > 0) { Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]); Paging.PageSize = PageSize; Paging.DataLoad(); Paging2.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]); Paging2.PageSize = PageSize; Paging2.DataLoad(); if (Paging.TotalPages > 1) { ltTotal.Text = "Có " + list.Rows.Count + " trong tổng số " + list.Rows[0]["Total"] + " báo cáo"; Paging2.Visible = Paging.Visible = true; } else { ltTotal.Text = "Có tổng số " + list.Rows[0]["Total"] + " báo cáo"; Paging2.Visible = Paging.Visible = false; } } else { Paging2.Visible = Paging.Visible = false; } //} }
protected void btn_edit_Click(object sender, EventArgs e) { try { AuditReportService reportBSO = new AuditReportService(); AuditReport report = new AuditReport(); report = reportBSO.FindByKey(ReportId); if (report != null) { report.EnterpriseId = Convert.ToInt32(memVal.OrgId); report.AuditYear = Convert.ToInt32(ddlAuditYear.SelectedValue); report.DataYear = Convert.ToInt32(ddlDataYear.SelectedValue); report.AuditConsultancyName = txtAuditConsultant.Text.Trim(); report.Address = txtAddress.Text.Trim(); report.AuditorName = txtAuditor.Text.Trim(); report.AuditingScope = txtAuditScope.Text.Trim(); report.ShiftNo = Convert.ToInt32(rbtShiftNo.SelectedValue); report.AuditorCode = txtAuditorCode.Text.Trim(); report.TaxNo = txtMST.Text.Trim(); report.Id = ReportId; string strPath = Server.MapPath("~/UserFile/Report/"); string strFilename = ""; if (fAttach.HasFile) { Random rand = new Random(); strFilename = memVal.UserName + "_BCKT_" + AuditYearReport + "_" + rand.Next(100) + System.IO.Path.GetExtension(fAttach.FileName).ToLower(); if (System.IO.File.Exists(strPath + strFilename)) { strFilename = memVal.UserName + "_BCKT_" + AuditYearReport + "_" + rand.Next(100) + System.IO.Path.GetExtension(fAttach.FileName).ToLower(); } fAttach.PostedFile.SaveAs(strPath + strFilename); ReportAttachFile reportAtt = new ReportAttachFile(); reportAtt.ReportId = ReportId; reportAtt.PathFile = strFilename; reportAtt.Created = DateTime.Now; reportAtt.ActionName = "DN đã gửi kèm file báo cáo"; reportAtt.Comment = txtContent.Text; reportAtt.UserId = memVal.UserId; reportAtt.UserName = memVal.UserName; reportAtt.ReportType = Convert.ToInt32(LogType.AUDITREPORT); new ReportAttachFileService().Insert(reportAtt); } report.PathFile = strFilename; if (reportBSO.Update(report) != null) { clientview.Text = "<div class='alert alert-sm alert-success bg-gradient'>Cập nhật Thành công !</div>"; BindInfoLabel(); lbtDownload.Text = strFilename; ltAttach.Text = strFilename; } else { clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật không Thành công !</div>"; } } } catch (Exception ex) { log.Error("Loi khong cap nhat duoc bao cao: ", ex); } }
protected void btn_Send_Click(object sender, EventArgs e) { try { AuditReportService faqsBSO = new AuditReportService(); if (ReportId > 0) { if (lbtDownload.Text == "" && !fAttachResend.HasFile) { ScriptManager.RegisterStartupScript(this, GetType(), "sendreport", "ShowDialogSend();alert('Vui lòng chọn file đính kèm.');", true); } else { string strPath = Server.MapPath("~/UserFile/Report/"); if (fAttachResend.HasFile) { try { Random rand = new Random(); string strFilename = ""; strFilename = "BCKT_" + memVal.UserName + "_" + AuditYearReport + "_" + rand.Next(100) + System.IO.Path.GetExtension(fAttachResend.FileName).ToLower(); if (System.IO.File.Exists(strPath + strFilename)) { strFilename = "BCKT_" + memVal.UserName + "_" + AuditYearReport + "_" + rand.Next(100) + System.IO.Path.GetExtension(fAttachResend.FileName).ToLower(); } fAttachResend.PostedFile.SaveAs(strPath + strFilename); ReportAttachFile reportAtt = new ReportAttachFile(); reportAtt.ReportId = ReportId; reportAtt.PathFile = strFilename; reportAtt.Created = DateTime.Now; reportAtt.ActionName = "DN đã gửi báo cáo cho SCT"; reportAtt.Comment = txtContent.Text; reportAtt.UserId = memVal.UserId; reportAtt.UserName = memVal.UserName; reportAtt.ReportType = Convert.ToInt32(LogType.AUDITREPORT); new ReportAttachFileService().Insert(reportAtt); if (faqsBSO.UpdateStatusFile(ReportId, 1, strFilename) > 0) { ReportLog log = new ReportLog(); log.ActionName = "DN đã gửi báo cáo cho SCT"; log.Comment = txtContent.Text; log.ReportId = ReportId; log.Created = DateTime.Now; log.MemberId = memVal.UserId; log.UserName = memVal.UserName; log.Status = "Đã gửi báo cáo"; log.LogType = Convert.ToInt32(LogType.AUDITREPORT); new ReportLogService().Insert(log); Response.Redirect(ResolveUrl("~/Danh-sach-bao-cao-ktnl.aspx")); } else { ScriptManager.RegisterStartupScript(this, GetType(), "sendreport", "ShowDialogSend();alert('Chưa gửi được báo cáo. Vui lòng kiểm tra lại.');", true); } } catch (Exception ex) { log.Error("Loi Attach file: ", ex); ScriptManager.RegisterStartupScript(this, GetType(), "sendreport", "ShowDialogSend();alert('Chưa gửi được báo cáo. Vui lòng kiểm tra lại.');", true); return; } } else { if (faqsBSO.UpdateStatus(ReportId, 1) > 0) { Response.Redirect(ResolveUrl("~/Danh-sach-bao-cao-ktnl.aspx")); } else { ScriptManager.RegisterStartupScript(this, GetType(), "sendreport", "ShowDialogSend();alert('Chưa gửi được báo cáo. Vui lòng kiểm tra lại.');", true); } } } } } 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(); } } }