protected void gvCBC_RowDataBound(object sender, GridViewRowEventArgs e) { FDRPage fp = new FDRPage(); if (e.Row.RowType == DataControlRowType.DataRow) { string ActionId = ""; string ReturnStatus = ""; Button btnGenerateSingle = (e.Row.FindControl("btnGenerateSingle") as Button); Button btnVerify = (e.Row.FindControl("btnVerifyPackage") as Button); CheckBox chkSelect = e.Row.FindControl("chkSelect") as CheckBox; Label lblActionId = e.Row.FindControl("lblActionId") as Label; Label lblReturnStatus = e.Row.FindControl("lblReturningStatus") as Label; if (lblActionId != null) { ActionId = lblActionId.Text; } if (lblReturnStatus != null) { ReturnStatus = lblReturnStatus.Text; } if (fp.IsUserInRole("Reviewer") || fp.IsUserInRole("Approver")) { var strStatus = Server.HtmlDecode(e.Row.Cells[3].Text); var reportingPeriod = Server.HtmlDecode(e.Row.Cells[1].Text); btnVerify.Enabled = true; btnGenerateSingle.Enabled = true; if (!string.IsNullOrWhiteSpace(strStatus) && strStatus.Trim() != "Rejected" && strStatus.Trim() != "Generated") { btnGenerateSingle.Enabled = false; } if ((ActionId == "3" && ReturnStatus.ToLower() == "accepted") || ReturnStatus.ToLower() == "rejected") { btnGenerateSingle.Enabled = true; } } else { btnGenerate.Enabled = false; btnGenerateSingle.Enabled = false; } } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { fsVerify.Visible = false; FDRPage fp = new FDRPage(); if (fp.IsUserInRole("CBC Administrator")) // if (User.CanPerformFunction("CBC_ApproveDataReady")) { if (Request["refno"] != null && Request["year"] != null) { var isApproved = DatabaseReader.CheckIfCBCApproved(Request["refno"].ToString(), int.Parse(Request["year"].ToString())); switch (isApproved) { case -1: fsVerify.Visible = true; break; case 0: case 1: fsVerify.Visible = false; break; } } } if (!Page.IsPostBack) { ViewState["prevPage"] = Request.UrlReferrer; } } } catch (Exception x) { throw new Exception(x.Message); } }
protected void Page_Load(object sender, EventArgs e) { var updatePanelControlIdThatCausedPostBack = String.Empty; var scriptManager = System.Web.UI.ScriptManager.GetCurrent(Page); Sars.Models.CBC.OutGoingCBCDeclarations outCBC = null; var countryCode = ""; var reportingPeriod = ""; int statusId = string.IsNullOrEmpty(Request.QueryString["StatusId"]) ? 0 : int.Parse(Request.QueryString["StatusId"].ToString()); if (Request.QueryString["xCountry"] != null & Request.QueryString["Period"] != null && (fp.IsUserInRole("Reviewer") || fp.IsUserInRole("Approver"))) { countryCode = Request.QueryString["xCountry"].ToString(); reportingPeriod = Request.QueryString["Period"].ToString(); outCBC = DBReadManager.OutGoingCBCDeclarationsDetails(countryCode, reportingPeriod); } if (!IsPostBack) { ViewState["prevPage"] = Request.UrlReferrer; lblHeader.Text = "VIEW"; countryCode = Request.QueryString["xCountry"].ToString(); reportingPeriod = Request.QueryString["Period"].ToString(); btnReject.Visible = false; btnApprove.Visible = false; //btnSendToReviewer.Visible = false; if (outCBC != null) { if (fp.IsUserInRole("Reviewer")) { btnApprove.Text = "Verify"; switch (outCBC.StatusId) { case 2: lblHeader.Text = "VERIFY"; break; case 7: lblHeader.Text = "VERIFY CORRECTED"; break; case 8: lblHeader.Text = "VERIFY VOIDED"; break; default: lblHeader.Text = "VIEW"; break; } } else if (fp.IsUserInRole("Approver")) { btnApprove.Text = "Approve"; lblHeader.Text = (outCBC.StatusId == 3) ? "APPROVE" : "VIEW"; } } else { btnDownloadXcel.Visible = false; btnDownload.Visible = false; } LoadCBC(countryCode, reportingPeriod, statusId); LoadCBCHsitory(countryCode, reportingPeriod); } else { if (scriptManager != null) { var smUniqueId = scriptManager.UniqueID; var smFieldValue = Request.Form[smUniqueId]; if (!String.IsNullOrEmpty(smFieldValue) && smFieldValue.Contains("|")) { updatePanelControlIdThatCausedPostBack = smFieldValue.Split('|')[1]; if (updatePanelControlIdThatCausedPostBack == "ctl00$MainContent$btnDownloadXcel" || updatePanelControlIdThatCausedPostBack == "ctl00$MainContent$btnDownload") { outCBC = DBReadManager.OutGoingCBCDeclarationsDetails(countryCode, reportingPeriod); if (fp.IsUserInRole("Approver")) { if (outCBC.StatusId == 3) { btnApprove.Visible = true; btnReject.Visible = true; if (SameApprover(outCBC)) { btnReject.Visible = false; btnApprove.Visible = false; } } } if (fp.IsUserInRole("Reviewer")) { if (outCBC.StatusId == 2 || outCBC.StatusId == 7 || outCBC.StatusId == 8) { btnApprove.Visible = true; } } } } } } }
protected void Page_Load(object sender, EventArgs e) { var updatePanelControlIdThatCausedPostBack = String.Empty; var scriptManager = System.Web.UI.ScriptManager.GetCurrent(Page); string countryCode = ""; string reportingPeriod = ""; int? statusId = 0; decimal id = 0; if (Request.QueryString["idx"] != null && Request.QueryString["statusIdx"] != null && Request.QueryString["incLocal"] != null) { lblHeader.Text = "VIEW"; id = decimal.Parse(Request.QueryString["idx"].ToString()); statusId = int.Parse(Request.QueryString["statusIdx"].ToString()); var mspec = DBReadManager.GetMessageSpecById(id); if (mspec != null) { if (mspec.StatusID > 0) { statusId = mspec.StatusID; } } } if (Request.QueryString["xCountry"] != null && Request.QueryString["Period"] != null) { countryCode = Request.QueryString["xCountry"].ToString(); reportingPeriod = Request.QueryString["Period"].ToString(); } if (!IsPostBack) { ViewState["prevPage"] = Request.UrlReferrer; lblHeader.Text = "VIEW"; btnApprove.Visible = false; btnReject.Visible = false; btnDownload.Visible = false; btnDownloadXcel.Visible = false; if (fp.IsUserInRole("Reviewer")) { btnApprove.Text = "Review"; lblHeader.Text = (statusId == 1) ? "REVIEW" : "VIEW"; btnDownload.Visible = true; btnDownloadXcel.Visible = true; } if (fp.IsUserInRole("Approver")) { btnApprove.Text = "Approve"; lblHeader.Text = (statusId == 3) ? "APPROVE" : "VIEW"; btnDownload.Visible = true; btnDownloadXcel.Visible = true; } LoadCBC(id); LoadCBCHsitory(countryCode, reportingPeriod); } /*else * { * if (scriptManager != null) * { * var smUniqueId = scriptManager.UniqueID; * var smFieldValue = Request.Form[smUniqueId]; * * if (!String.IsNullOrEmpty(smFieldValue) && smFieldValue.Contains("|")) * { * updatePanelControlIdThatCausedPostBack = smFieldValue.Split('|')[1]; * if (updatePanelControlIdThatCausedPostBack == "ctl00$MainContent$btnDownloadXcel" || updatePanelControlIdThatCausedPostBack == "ctl00$MainContent$btnDownload") || { || if (fp.IsUserInRole("Approver") || fp.IsUserInRole("Reviewer")) || { || btnApprove.Text = "Approve"; || lblHeader.Text = (statusId == 1) ? "APPROVE" : "VIEW"; || if (statusId == 1) || { || btnApprove.Visible = true; || btnReject.Visible = true; || } || } || } || } || } || ||}*/ }