Ejemplo n.º 1
0
    protected void btnDownloadXcel_Click(object sender, EventArgs e)
    {
        //System.Threading.Thread.Sleep(1000);

        if (Request.QueryString["idx"] == null)
        {
            return;
        }
        var mspecId    = Request.QueryString["idx"].ToString();
        var xmlResults = DBReadManager.GetMessageSpecById(decimal.Parse(mspecId));

        if (xmlResults.UID != null)
        {
            string fullURL = "window.open('../queueMonitors/MANUAL/CbCReport.aspx?UID=" + xmlResults.UID + "&src=IN ', '_blank', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,titlebar=no' );";
            System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
            //string fullURL = "window.open('CbCReport.aspx?UID=" + xmlResults.UID + "&src=IN ', '_blank', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,titlebar=no' );";
            //Response.Redirect(string.Format("~/queueMonitors/MANUAL/CbCReport.aspx?UID={0}&src=IN", xmlResults.UID));
        }


        if (fp.IsUserInRole("Reviewer"))
        {
            int?statusId = int.Parse(Request.QueryString["statusIdx"].ToString());
            var id       = decimal.Parse(Request.QueryString["idx"].ToString());
            var mspec    = DBReadManager.GetMessageSpecById(id);
            if (mspec != null)
            {
                if (mspec.StatusID > 0)
                {
                    statusId = mspec.StatusID;
                }
            }
            if (statusId == 1)
            {
                btnApprove.Visible = true;
            }
        }

        if (fp.IsUserInRole("Approver"))
        {
            int?statusId = int.Parse(Request.QueryString["statusIdx"].ToString());
            var id       = decimal.Parse(Request.QueryString["idx"].ToString());
            var mspec    = DBReadManager.GetMessageSpecById(id);
            if (mspec != null)
            {
                if (mspec.StatusID > 0)
                {
                    statusId = mspec.StatusID;
                }
            }
            if (statusId == 3)
            {
                btnApprove.Visible = true;
                btnReject.Visible  = true;
            }
        }

        // Response.Redirect(string.Format("~/queueMonitors/MANUAL/CbCReport.aspx?UID={0}&src=IN", results.UID));
    }
Ejemplo n.º 2
0
    protected void btnDownload_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(1000);
        if (Request.QueryString["idx"] == null)
        {
            return;
        }
        var mspecId = Request.QueryString["idx"].ToString();

        var country = gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim() + "_" + gvCBC.Rows[0].Cells[5].Text;

        if (fp.IsUserInRole("Reviewer"))
        {
            int?statusId = int.Parse(Request.QueryString["statusIdx"].ToString());
            var id       = decimal.Parse(Request.QueryString["idx"].ToString());
            var mspec    = DBReadManager.GetMessageSpecById(id);
            if (mspec != null)
            {
                if (mspec.StatusID > 0)
                {
                    statusId = mspec.StatusID;
                }
            }
            if (statusId == 1)
            {
                btnApprove.Visible = true;
            }
        }

        if (fp.IsUserInRole("Approver"))
        {
            int?statusId = int.Parse(Request.QueryString["statusIdx"].ToString());
            var id       = decimal.Parse(Request.QueryString["idx"].ToString());
            var mspec    = DBReadManager.GetMessageSpecById(id);
            if (mspec != null)
            {
                if (mspec.StatusID > 0)
                {
                    statusId = mspec.StatusID;
                }
            }
            if (statusId == 3)
            {
                btnApprove.Visible = true;
                btnReject.Visible  = true;
            }
        }
        string fullURL = "window.open('downloadXml.aspx?&mspecId=" + mspecId + "&country=" + country + "', '_blank', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,titlebar=no' );";

        System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
    }
Ejemplo n.º 3
0
    protected void btnApprove_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(1000);
        decimal id           = decimal.Parse(Request.QueryString["idx"].ToString());
        int     statusId     = int.Parse(Request.QueryString["statusIdx"].ToString());
        string  incominLocal = Request.QueryString["incLocal"].ToString();
        var     country      = gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim() + "_" + gvCBC.Rows[0].Cells[5].Text;

        if (fp.IsUserInRole("Reviewer") || fp.IsUserInRole("Approver"))
        {
            try
            {
                int      status        = fp.IsUserInRole("Reviewer") ? 3 : 5;
                bool     blnIsReviewer = fp.IsUserInRole("Reviewer") ? true : false;
                var      email         = string.IsNullOrEmpty(ADUser.CurrentUser.Mail) ? "*****@*****.**" : ADUser.CurrentUser.Mail;
                string[] senderEmail   = { email };
                string   Subject       = "";
                DBWriteManager.ApproveForeignPackage(status, id, ADUser.CurrentSID);
                var    mspec   = DBReadManager.GetMessageSpecById(id);
                string message = string.Format("Incoming Package for {0} has been approved successfully", country);
                if (blnIsReviewer)
                {
                    DBWriteManager.Insert_OutgoingPackageAuditTrail(mspec.UID, Sars.Systems.Security.ADUser.CurrentSID, string.Format("Incoming Package for {0} from {1} verified", gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim()));
                    Subject = string.Format("Incoming Package for {0} from {1} has been verified ", gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim(),
                                            gvCBC.Rows[0].Cells[3].Text.Split('-')[0].Trim());
                    Common.SendEmailToRole("Approver", gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim(), Subject, FDRPage.Statuses.Verified, senderEmail);
                }
                else
                {
                    DBWriteManager.Insert_OutgoingPackageAuditTrail(mspec.UID, Sars.Systems.Security.ADUser.CurrentSID, string.Format("Incoming Package for {0} from {1} approved",
                                                                                                                                      gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim(), gvCBC.Rows[0].Cells[3].Text.Split('-')[0].Trim()));
                    Subject = string.Format("Incoming Package for {0}  from {1} has been approved", gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim(),
                                            gvCBC.Rows[0].Cells[3].Text.Split('-')[0].Trim());
                    Common.SendEmailToRole("Reviewer", gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim(), Subject, FDRPage.Statuses.Approved, senderEmail);
                }
                btnApprove.Enabled = false;
                btnReject.Enabled  = false;
                MessageBox.Show(message);
                //LoadCBCHsitory(countryCode, reportingPeriod);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
Ejemplo n.º 4
0
    protected void btnAddComments_Click(object sender, EventArgs e)
    {
        var hiddenValue = Parent.FindControl("hdnDone") as HiddenField;
        var mpeMe       = Parent.FindControl("ModalPopupExtender1") as AjaxControlToolkit.ModalPopupExtender;

        hiddenValue.Value = txtComments.Text;
        var gvCBC = Parent.FindControl("gvCBC") as GridView;

        if (!string.IsNullOrEmpty(txtComments.Text))
        {
            var      email       = ADUser.CurrentUser.Mail;
            string[] senderEmail = { email };
            string   Subject     = "";
            if (Request.QueryString["idx"] == null)
            {
                return;
            }

            if (Request.QueryString["idx"] == "0")
            {
                var countryCode = Request.QueryString["xCountry"].ToString();

                if (gvCBC != null)
                {
                    string ReportingPeriod = gvCBC.Rows[0].Cells[4].Text;
                    var    outCBC          = DBReadManager.OutGoingCBCDeclarationsDetails(countryCode, ReportingPeriod);
                    var    comments        = new Comments()
                    {
                        OutGoingCBCDeclarationsID = outCBC.Id,
                        Notes   = txtComments.Text,
                        AddedBy = ADUser.CurrentSID
                    };
                    if (SaveComments(comments, 2) > 0)
                    {
                        DBWriteManager.ApproveOutgoingPackage(outCBC.Id, countryCode, ReportingPeriod, 4, ADUser.CurrentSID);
                        Subject = "Outgoing CBC Package has been rejected";
                        FDR.DataLayer.DBWriteManager.Insert_OutgoingPackageAuditTrail(outCBC.UID, Sars.Systems.Security.ADUser.CurrentSID, string.Format("Outgoing Package for {0} has been rejected", outCBC.CountryName));
                        Common.SendEmailToRole("Reviewer", outCBC.CountryName, Subject, FDRPage.Statuses.Rejected, senderEmail);
                        MessageBox.Show(string.Format("Outgoing Package for {0} has been successfully rejected", outCBC.CountryName));
                    }
                }
            }
            else
            {
                if (Request.QueryString["idx"] != null)
                {
                    string  ReportingPeriod = gvCBC.Rows[0].Cells[6].Text;
                    decimal msgSpecId       = decimal.Parse(Request.QueryString["idx"].ToString());
                    var     comments        = new Comments()
                    {
                        OutGoingCBCDeclarationsID = msgSpecId,
                        Notes   = txtComments.Text,
                        AddedBy = ADUser.CurrentSID
                    };
                    if (SaveComments(comments, 1) > 0)
                    {
                        DBWriteManager.ApproveForeignPackage(4, msgSpecId, ADUser.CurrentSID);
                        var mspec = DBReadManager.GetMessageSpecById(msgSpecId);
                        DBWriteManager.Insert_OutgoingPackageAuditTrail(mspec.UID, Sars.Systems.Security.ADUser.CurrentSID, string.Format("Incoming Package for {0} from {1} rejected",
                                                                                                                                          gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim(), gvCBC.Rows[0].Cells[3].Text.Split('-')[0].Trim()));
                        Subject = string.Format("Incoming Package for {0} has been rejected", gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim());
                        Common.SendEmailToRole("Reviewer", gvCBC.Rows[0].Cells[4].Text.Split('-')[0].Trim(), Subject, FDRPage.Statuses.Approved, senderEmail);
                        MessageBox.Show(string.Format("Incoming Foreign Package for {0} has been rejected successfully", gvCBC.Rows[0].Cells[3].Text.Split('-')[0]));
                    }
                }
            }
            txtComments.Text = "";
            var btnApprove = Parent.FindControl("btnApprove") as Button;
            var btnReject  = Parent.FindControl("btnReject") as Button;
            btnReject.Enabled  = false;
            btnApprove.Enabled = false;
        }

        else
        {
            MessageBox.Show("Please Enter comments");
            if (mpeMe != null)
            {
                mpeMe.Show();
            }
        }
    }
Ejemplo n.º 5
0
    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;
         ||                 }
         ||             }
         ||         }
         ||     }
         || }
         ||
         ||}*/
    }