Exemplo n.º 1
0
        private void CalcIR(object sender, EventArgs e, out string path, out XmlDocument xDoc, out string finalgenericone, out string hmrcirmark)
        {
            string subAsAgentIndi = "";

            using (var context = new Database1Entities())
            {
                ((System.Data.SqlClient.SqlConnection)context.Database.Connection).ConnectionString = @"data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=" + GlobalConstants.commondocsCOMPANYDBpath + "; integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework";
                var gg = from client in context.GGCredentials
                         where client.Fk_Client_Id == GlobalConstants.clientid
                         select new
                {
                    client.ggid,
                    client.ggpassword,
                    client.subas,
                    client.amend,
                    client.savecredentials,
                };
                if (gg.ToList().Count != 0)
                {
                    if (gg.ToList()[0].subas == "" || gg.ToList()[0].subas == null)
                    {
                        subAsAgentIndi = "Individual";
                    }
                    else
                    {
                        subAsAgentIndi = gg.ToList()[0].subas;
                    }


                    if (gg.ToList()[0].amend == "yes")
                    {
                        GlobalConstants.blnAmendedReturn = true;
                    }
                    else
                    {
                        GlobalConstants.blnAmendedReturn = false;
                    }
                }
            }
            GlobalConstants.cl2tagappended = false;
            GlobalConstants.fromfbi        = true;
            MainIndividual objMainIndividual = new MainIndividual();

            objMainIndividual.btnsa302_Click(sender, e);
            FILINGtoHMRC objFILINGtoHMRC = new FILINGtoHMRC();

            objFILINGtoHMRC.PrepareXml();
            GlobalConstants.commondocsSubmissionspath = GlobalConstants.commondocsCOMPANYpath + "\\FBI.xml";
            path = GlobalConstants.commondocsSubmissionspath;
            xDoc = new XmlDocument();
            using (FileStream fs = new FileStream(path, FileMode.Open))
            {
                xDoc.Load(fs);
            }

            //CreateIRMark();
            // IDFFCYFJ6UFNDM6DLM442WLUHTBHZI3N lastsuccess
            byte[]      hashValue;
            XmlDocument xDocforir    = xDoc;
            XmlNode     bodynode     = xDocforir.ChildNodes.Item(1).ChildNodes.Item(3);
            XmlNode     removeirnode = bodynode.ChildNodes.Item(0).ChildNodes.Item(0).ChildNodes.Item(2);

            removeirnode.ParentNode.RemoveChild(removeirnode);

            string postDatair = bodynode.OuterXml;
            int    sa100end   = postDatair.LastIndexOf("<MTR>");
            string bodyonly   = postDatair.Insert(sa100end + 5, GlobalConstants.sa102fbi);

            bodyonly = bodyonly.Replace("SHINTU1000000241", GlobalConstants.UTR);
            if (GlobalConstants.strAttach == "")
            {
                bodyonly = bodyonly.Replace("<AttachedFiles>SHINTUathachmntsSHINTU</AttachedFiles>", "");
            }
            else
            {
                bodyonly = bodyonly.Replace("SHINTUathachmntsSHINTU", GlobalConstants.strAttach);
            }


            if (GlobalConstants.blnAmendedReturn)
            {
                bodyonly = bodyonly.Replace("<MTR>", "<MTR AmendedReturn=\"yes\">");
            }

            if (subAsAgentIndi == "Agent")
            {
                bodyonly = bodyonly.Replace("<IndividualDeclaration>yes</IndividualDeclaration>", "<AgentDeclaration>yes</AgentDeclaration>");
            }
            //if (cmbIndorAgent.SelectedItem.ToString() == "Agent")
            //{
            //    bodyonly = bodyonly.Replace("<IndividualDeclaration>yes</IndividualDeclaration>", "<AgentDeclaration>yes</AgentDeclaration>");
            //}
            XmlDocument xmlDoctttt = new XmlDocument();

            xmlDoctttt.LoadXml(bodyonly);



            XmlDsigC14NTransform xmlTransform = new XmlDsigC14NTransform();

            xmlTransform.LoadInput(xmlDoctttt);
            MemoryStream memoryStream = (MemoryStream)xmlTransform.GetOutput();

            hashValue       = SHA1.Create().ComputeHash(memoryStream);
            finalgenericone = Convert.ToBase64String(hashValue);
            string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
            string b32 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=";

            hmrcirmark = "";
            string gentobytes = "";

            foreach (char c in finalgenericone)
            {
                int number = b64.IndexOf(c);
                var binary = Convert.ToString(number, 2);
                gentobytes = gentobytes + binary.PadLeft(6, '0');
            }
            for (int i = 0; i < 32; i++)
            {
                string input  = gentobytes.Substring(i * 5, 5);
                int    output = Convert.ToInt32(input, 2);
                hmrcirmark += b32.Substring(output, 1);
            }
            GlobalConstants.IRMARK = hmrcirmark;
        }
Exemplo n.º 2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            if (e.ColumnIndex == 3)
            {
                DataGridViewRow selectedRow = null;
                if (dataGridView1.SelectedRows.Count > 0)
                {
                    selectedRow = dataGridView1.SelectedRows[0];
                }
                if (selectedRow == null)
                {
                    return;
                }
                clientid = Convert.ToInt32(selectedRow.Cells["Reference"].Value);
                SAONE.GlobalConstants.clientid = clientid;
                MainIndividual objindividual = new MainIndividual(clientid);
                objindividual.ShowDialog();
            }

            if (e.ColumnIndex == 4)
            {
                DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete the selected Taxpayer?", GlobalConstants.prodname, MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    DataGridViewRow selectedRow = null;
                    if (dataGridView1.SelectedRows.Count > 0)
                    {
                        selectedRow = dataGridView1.SelectedRows[0];
                    }
                    if (selectedRow == null)
                    {
                        return;
                    }
                    clientid = Convert.ToInt32(selectedRow.Cells["Reference"].Value);
                    SAONE.GlobalConstants.clientid = clientid;


                    using (var context = new Database1Entities())
                    {
                        ((System.Data.SqlClient.SqlConnection)context.Database.Connection).ConnectionString = @"data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=" + GlobalConstants.commondocsCOMPANYDBpath + "; integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework";

                        SqlConnection CN = new SqlConnection();
                        CN.ConnectionString = ((System.Data.SqlClient.SqlConnection)context.Database.Connection).ConnectionString;
                        DataTable dt = new DataTable();
                        CN.Open();

                        // SqlCommand sqlcmd = new SqlCommand("delete from SA102 where Fk_Client_Id=" + clientid, CN);
                        SqlCommand sqlcmd = new SqlCommand("delete from client where Pk_Client_Id=" + clientid, CN);
                        int        x      = sqlcmd.ExecuteNonQuery();
                        if (x == 1)
                        {
                            dataGridView1.Rows.RemoveAt(dataGridView1.CurrentRow.Index);
                            MessageBox.Show("Taxpayer deleted successfully.", GlobalConstants.prodname, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else if (dialogResult == DialogResult.No)
                {
                    return;
                }
            }


            Cursor.Current = Cursors.Default;
        }
Exemplo n.º 3
0
        private void SA110_Load(object sender, EventArgs e)
        {
            // panel1.Visible = false;
            GlobalConstants.activeform = "sa110o";
            using (var context = new Database1Entities())
            {
                ((System.Data.SqlClient.SqlConnection)context.Database.Connection).ConnectionString = @"data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=" + GlobalConstants.commondocsCOMPANYDBpath + "; integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework";

                var sa102 = from client in context.SA110
                            where client.Fk_Client_Id == GlobalConstants.clientid
                            select new
                {
                    client.CAL1,
                    client.CAL2,
                    client.CAL3,
                    client.CAL4,
                    client.CAL4p1,
                    client.CAL5,
                    client.CAL6,
                    client.CAL7,
                    client.CAL8,
                    client.CAL9,
                    client.CAL10,
                    client.CAL11,
                    client.CAL12,
                    client.CAL13,
                    client.CAL14,
                    client.CAL15,
                    client.CAL16,
                    client.CAL17,
                };
                if (sa102.ToList().Count == 0)
                {
                    return;
                }

                CAL1.MyText   = sa102.ToList()[0].CAL1;
                CAL2.MyText   = sa102.ToList()[0].CAL2;
                CAL3.MyText   = sa102.ToList()[0].CAL3;
                CAL4.MyText   = sa102.ToList()[0].CAL4;
                CAL4p1.MyText = sa102.ToList()[0].CAL4p1;
                CAL5.MyText   = sa102.ToList()[0].CAL5;
                CAL6.MyText   = sa102.ToList()[0].CAL6;

                GlobalConstants.fromfbi = true;
                MainIndividual objMainIndividual = new MainIndividual();
                objMainIndividual.btnsa302_Click(sender, e);
                CAL1.MyText = GlobalConstants.CAL1 >= 0 ? string.Format("{0:F2}", GlobalConstants.CAL1) : "";
                CAL2.MyText = GlobalConstants.CAL1 < 0 ? string.Format("{0:F2}", Math.Abs(GlobalConstants.CAL1)) : "";
                CAL3.MyText = GlobalConstants.CAL3 > 0 ? string.Format("{0:F2}", GlobalConstants.CAL3) : "";
                CAL4.MyText = GlobalConstants.CAL4 >= 0 ? string.Format("{0:F2}", GlobalConstants.CAL4) : "";
                CAL5.MyText = GlobalConstants.CAL5 > 0 ? string.Format("{0:F2}", GlobalConstants.CAL5) : "";
                CAL6.MyText = GlobalConstants.CAL6 > 0 ? string.Format("{0:F2}", GlobalConstants.CAL6) : "";



                CAL7.MyText = sa102.ToList()[0].CAL7;
                CAL8.MyText = sa102.ToList()[0].CAL8;
                CAL9.MyText = sa102.ToList()[0].CAL9;
                if (sa102.ToList()[0].CAL10 == "yes")
                {
                    CAL10.Checked = true;
                }
                CAL11.MyText = sa102.ToList()[0].CAL11;
                CAL12.MyText = sa102.ToList()[0].CAL12;
                CAL13.MyText = sa102.ToList()[0].CAL13;
                CAL14.MyText = sa102.ToList()[0].CAL14;
                CAL15.MyText = sa102.ToList()[0].CAL15;
                CAL16.MyText = sa102.ToList()[0].CAL16;
                CAL17.Text   = sa102.ToList()[0].CAL17;
            }
        }