protected void btnVoid_Click(object sender, EventArgs e)
    {
        Guid        newUid  = new Guid();
        Button      btnVoid = (Button)sender;
        GridViewRow gvRow   = (GridViewRow)btnVoid.Parent.Parent;
        var         email   = ADUser.CurrentUser.Mail;

        string[] senderEmail = { email };
        var      countryCode = gvRow.Cells[0].Text.Split('-')[1].Trim();
        var      reportingPeriod = gvRow.Cells[1].Text; var outCBC = DBReadManager.OutGoingCBCDeclarationsDetails(countryCode, reportingPeriod);
        var      id = string.IsNullOrEmpty(outCBC.Id.ToString()) ? 0 : outCBC.Id;
        var      reportP = DateTime.Parse(reportingPeriod).ToString("yyyy-MM-ddTHH:mm:ss");
        Guid     uid     = new Guid();

        if (outCBC != null)
        {
            var prepareVoidPackage = PrepareNMVoidPackage(id, countryCode, outCBC.NMCBC, reportingPeriod);
            var nmPackage          = prepareVoidPackage;
            uid = outCBC.UID;
            var voidedCBC = new OutGoingCBCDeclarations()
            {
                Id              = id,
                Country         = countryCode,
                CBCData         = prepareVoidPackage,
                StatusId        = 8,
                Year            = int.Parse(reportingPeriod.Substring(0, 4)),
                UID             = uid,
                ActionId        = 3,
                NSCBCData       = nmPackage,
                ReportingPeriod = DateTime.Parse(reportP),
                CreatedBy       = Sars.Systems.Security.ADUser.CurrentSID
            };
            decimal saved = DatabaseWriter.SaveOutgoingCBC(voidedCBC, ref uid);
            DBWriteManager.ApproveOutgoingPackage(id, countryCode, reportingPeriod, 8, ADUser.CurrentSID);
            DBWriteManager.Insert_OutgoingPackageAuditTrail(outCBC.UID, Sars.Systems.Security.ADUser.CurrentSID, string.Format("Outgoing Package for {0} Pending Void Review", gvRow.Cells[0].Text.Split('-')[0].Trim()));
            var Subject = "Outgoing Package pending void review ";
            Common.SendEmailToRole("Reviewer", outCBC.CountryName, Subject, FDRPage.Statuses.Voided, senderEmail);
            MessageBox.Show("Package pending void review");
            LoadCBC();
        }
    }
Beispiel #2
0
    protected void btnCorrect_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["ccode"] != null && Request.QueryString["period"] != null)
        {
            FDRPage  fPage           = new FDRPage();
            Guid     newUid          = new Guid();
            var      country         = Request.QueryString["ccode"].ToString();
            var      reportingPeriod = Request.QueryString["period"].ToString();
            var      outCBC          = DBReadManager.OutGoingCBCDeclarationsDetails(country, reportingPeriod);
            decimal  id          = string.IsNullOrEmpty(outCBC.Id.ToString()) ? 0 : outCBC.Id;
            var      package     = Common.GenerateCorrectionPackage(country, reportingPeriod);
            var      email       = ADUser.CurrentUser.Mail;
            string[] senderEmail = { email };
            if (!string.IsNullOrEmpty(package.ToString()))
            {
                var outgoingCBC = new OutGoingCBCDeclarations()
                {
                    Id        = id,
                    Country   = country,
                    CBCData   = package.ToString(),
                    StatusId  = 7,
                    Year      = int.Parse(reportingPeriod.Substring(0, 4)),
                    CreatedBy = Sars.Systems.Security.ADUser.CurrentSID
                };
                decimal saved = DatabaseWriter.SaveOutgoingCBC(outgoingCBC, ref newUid);
                DBWriteManager.ApproveOutgoingPackage(id, country, reportingPeriod, 7, ADUser.CurrentSID);
                DBWriteManager.Insert_OutgoingPackageAuditTrail(outCBC.UID, Sars.Systems.Security.ADUser.CurrentSID, string.Format("Outgoing Package for {0} corrected", gvCBC.Rows[0].Cells[0].Text.Split('-')[0].Trim()));

                var Subject = "Outgoing CBC Report has been corrected ";
                Common.SendEmailToRole("Reviewer", outCBC.CountryName, Subject, FDRPage.Statuses.Corrected, senderEmail);
                LoadCBC(country, reportingPeriod);
                MessageBox.Show("Package has been corrected successfully");
            }
            else
            {
                MessageBox.Show("No package was corrected");
            }
        }
    }
Beispiel #3
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();
            }
        }
    }