private void LoadYA()
        {
            DataTable dtData = null;

            switch (strFormType)
            {
            case "C":
            case "R":
                EFilingDAL dal = new EFilingDAL();
                dtData = dal.GetYA();
                break;

            case "B":
            case "BE":
            case "M":
                EFilingDALB dalB = new EFilingDALB();
                dtData = dalB.GetYA();
                break;

            case "P":
                EFilingDALB dalP = new EFilingDALB();
                dtData = dalP.GetYA();
                break;

            //PANYW CP204
            case "CP204":
                EFilingDALCP204 dalCP204 = new EFilingDALCP204();
                dtData = dalCP204.GetYA();
                break;

            //PANYW CP204 END
            //NGOHCS CP204A
            case "CP204A":
                EFilingDALCP204A dalCP204A = new EFilingDALCP204A();
                dtData = dalCP204A.GetYA();
                break;

            //NGOHCS CP204A END
            default:
                EFilingDAL dalC = new EFilingDAL();
                dtData = dalC.GetYA();
                break;
            }
            toolStripCboYA.Items.Clear();
            foreach (DataRow drData in dtData.Rows)
            {
                toolStripCboYA.Items.Add(drData[0].ToString());
            }
        }
示例#2
0
        private void GetData2008()
        {
            EFilingDALB dalB = new EFilingDALB(strTaxPayer, strYA, "");

            if (strFormType == "B" || strFormType == "BE")
            {
                dsData = dalB.GetFormDataB("B2008Page12");
            }
            else if (strFormType == "M")
            {
                dsData = dalB.GetFormDataM("M2008Page11");
            }
            dalB.CloseConn();

            if (strFormType == "B" || strFormType == "BE")
            {
                if (dsData.Tables["P12_HK6_MASTER"].Rows.Count > 0)
                {
                    dgEFHK6.DataSource = dsData.Tables["P12_HK6_MASTER"];
                }
                else
                {
                    this.Text = "No HK-3 record found";
                }
            }
            else if (strFormType == "M")
            {
                if (dsData.Tables["P11_HK6_MASTER"].Rows.Count > 0)
                {
                    dgEFHK6.DataSource = dsData.Tables["P11_HK6_MASTER"];
                }
                else
                {
                    this.Text = "No HK-3 record found";
                }
            }
        }
示例#3
0
        private void tsbtnFill_Click(object sender, EventArgs e)
        {
            SHDocVw.ShellWindows swTemp = new SHDocVw.ShellWindows();
            Boolean     boolTargetFound = false;
            Boolean     boolTargetReady = false;
            EFilingDALB dalB            = new EFilingDALB();

            string[] strData = new string[10];

            if (dgEFHK6.SelectedRows.Count > 0)
            {
                DateTime dtTemp1 = DateTime.Parse(dgEFHK6.SelectedRows[0].Cells[7].Value.ToString());
                strData[0] = dgEFHK6.SelectedRows[0].Cells[0].Value.ToString();
                strData[1] = dgEFHK6.SelectedRows[0].Cells[1].Value.ToString();
                strData[2] = dgEFHK6.SelectedRows[0].Cells[2].Value.ToString();
                strData[3] = dgEFHK6.SelectedRows[0].Cells[3].Value.ToString();
                strData[4] = dgEFHK6.SelectedRows[0].Cells[4].Value.ToString();
                strData[5] = dgEFHK6.SelectedRows[0].Cells[5].Value.ToString();
                strData[6] = dgEFHK6.SelectedRows[0].Cells[6].Value.ToString();
                strData[7] = dtTemp1.ToString("ddMMyyyy");
                strData[8] = dgEFHK6.SelectedRows[0].Cells[8].Value.ToString();
                strData[9] = dgEFHK6.SelectedRows[0].Cells[9].Value.ToString();

                //   strData[8] = dgEFHK6.SelectedRows[0].Cells[8].Value.ToString();
            }
            else
            {
                MessageBox.Show("No record found for E-Filling!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            try
            {
                foreach (SHDocVw.InternetExplorer ieTemp in swTemp)
                {
                    string strDocName = dalB.GetDocName(ieTemp.LocationURL.ToString().ToLower(), strYA, strFormType);
                    //testing
                    //MessageBox.Show(strDocName.ToString());
                    //if (strDocName == "")
                    //    MessageBox.Show("strDocName is empty");
                    //    strDocName = "BE2010Page3";
                    //endtesting
                    if (strDocName.Length > 0)
                    {
                        boolTargetFound = true;
                        if (ieTemp.ReadyState.Equals(SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE))
                        {
                            boolTargetReady = true;
                            if (typeof(mshtml.HTMLDocumentClass).IsAssignableFrom(ieTemp.Document.GetType()))
                            {
                                mshtml.HTMLDocument htmlDoc           = ieTemp.Document as mshtml.HTMLDocument;
                                EFilingProcessHK6   dalProcessFormHK6 = new EFilingProcessHK6(strData, this.strYA);
                                dalProcessFormHK6.ProcessDocument(htmlDoc);
                                //ProcessDocument(htmlDoc);
                            }
                        }
                    }
                }
                if (boolTargetFound == false)
                {
                    MessageBox.Show("No relevant document is found for E-Filling!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else if (boolTargetFound == true && boolTargetReady == false)
                {
                    MessageBox.Show("Document is not ready, please try again!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            { MessageBox.Show(ex.ToString()); }
        }
示例#4
0
        private void PopulateTaxPayer()
        {
            dgTaxPayer.DataSource = null;

            switch (cboForm.Text)
            {
            case "C":
            case "R":
                EFilingDAL dal = new EFilingDAL();
                //dgTaxPayer.DataSource = dal.GetTaxPayer(cboYA.Text);
                if (toolStripCboBy.Text == "Reference No" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dal.GetTaxPayer(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "Name" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dal.GetTaxPayerName(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "-All Record-")
                {
                    dgTaxPayer.DataSource = dal.GetTaxPayerAll(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                break;

            case "B":
            case "BE":
                EFilingDALB dalB = new EFilingDALB();
                if (toolStripCboBy.Text == "Reference No" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalB.GetTaxPayerB(toolStripTxtText.Text.ToString());   //dalB.GetTaxPayerB(cboYA.Text);
                }
                if (toolStripCboBy.Text == "Name" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalB.GetTaxPayerBName(toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "-All Record-")
                {
                    dgTaxPayer.DataSource = dalB.GetTaxPayerBAll(toolStripTxtText.Text.ToString());
                }
                break;

            case "M":
                EFilingDALB dalM = new EFilingDALB();
                //dgTaxPayer.DataSource = dalM.GetTaxPayerM(cboYA.Text);
                if (toolStripCboBy.Text == "Reference No" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalM.GetTaxPayerM(toolStripTxtText.Text.ToString());   //dalB.GetTaxPayerB(cboYA.Text);
                }
                if (toolStripCboBy.Text == "Name" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalM.GetTaxPayerMName(toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "-All Record-")
                {
                    dgTaxPayer.DataSource = dalM.GetTaxPayerMAll(toolStripTxtText.Text.ToString());
                }
                break;

            case "P":
                EFilingDALP dalP = new EFilingDALP();
                //dgTaxPayer.DataSource = dalP.GetTaxPayer();
                if (toolStripCboBy.Text == "Reference No" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalP.GetTaxPayer(toolStripTxtText.Text.ToString());   //dalB.GetTaxPayerB(cboYA.Text);
                }
                if (toolStripCboBy.Text == "Name" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalP.GetTaxPayerName(toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "-All Record-")
                {
                    dgTaxPayer.DataSource = dalP.GetTaxPayerAll(toolStripTxtText.Text.ToString());
                }
                break;

            //PANYW CP204
            case "CP204":
                EFilingDALCP204 dalCP204 = new EFilingDALCP204();
                if (toolStripCboBy.Text == "Reference No" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalCP204.GetCP204TaxPayer(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "Name" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalCP204.GetCP204TaxPayerName(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "-All Record-")
                {
                    dgTaxPayer.DataSource = dalCP204.GetCP204TaxPayerAll(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                break;

            //PANYW CP204
            case "CP204A":
                EFilingDALCP204A dalCP204A = new EFilingDALCP204A();
                if (toolStripCboBy.Text == "Reference No" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalCP204A.GetCP204ATaxPayer(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "Name" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalCP204A.GetCP204ATaxPayerName(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "-All Record-")
                {
                    dgTaxPayer.DataSource = dalCP204A.GetCP204ATaxPayerAll(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                break;

            default:
                EFilingDAL dalC = new EFilingDAL();
                //dgTaxPayer.DataSource = dalC.GetTaxPayer(cboYA.Text);
                if (toolStripCboBy.Text == "Reference No" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalC.GetTaxPayer(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "Name" && toolStripTxtText.Text != "")
                {
                    dgTaxPayer.DataSource = dalC.GetTaxPayerName(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                if (toolStripCboBy.Text == "-All Record-")
                {
                    dgTaxPayer.DataSource = dalC.GetTaxPayerAll(cboYA.Text, toolStripTxtText.Text.ToString());
                }
                break;
            }
        }
示例#5
0
        private void LoadData()
        {
            DataTable dtData = new DataTable();

            cboAuditor.Items.Clear();
            cboTaxAgent.Items.Clear();

            switch (cboForm.Text)
            {
            case "C":
                EFilingDAL dal = new EFilingDAL();
                dtData = dal.GetAuditor();
                foreach (DataRow drData in dtData.Rows)
                {
                    cboAuditor.Items.Add(drData[0].ToString());
                }
                dtData = dal.GetTaxAgent();
                foreach (DataRow drData in dtData.Rows)
                {
                    cboTaxAgent.Items.Add(drData[0].ToString());
                }
                dtData = dal.GetYA();
                break;

            case "R":
                EFilingDAL dalR = new EFilingDAL();
                dtData = dalR.GetAuditor();
                foreach (DataRow drData in dtData.Rows)
                {
                    cboAuditor.Items.Add(drData[0].ToString());
                }
                dtData = dalR.GetYA();
                break;

            case "B":
            case "BE":
            case "M":
                EFilingDALB dalB = new EFilingDALB();
                dtData = dalB.GetTaxAgent();
                foreach (DataRow drData in dtData.Rows)
                {
                    cboTaxAgent.Items.Add(drData[0].ToString());
                }
                dtData = dalB.GetYA();
                break;

            case "P":
                EFilingDALB dalP = new EFilingDALB();
                dtData = dalP.GetTaxAgent();
                foreach (DataRow drData in dtData.Rows)
                {
                    cboTaxAgent.Items.Add(drData[0].ToString());
                }
                dtData = dalP.GetYA();
                break;

            //PANYW CP204
            case "CP204":
                EFilingDALCP204 dalCP204 = new EFilingDALCP204();
                dtData = dalCP204.GetTaxAgent();
                foreach (DataRow drData in dtData.Rows)
                {
                    cboTaxAgent.Items.Add(drData[0].ToString());
                }
                dtData = dalCP204.GetYA();
                break;

            //PANYW CP204 END
            default:
                EFilingDAL dalC = new EFilingDAL();
                dtData = dalC.GetAuditor();
                foreach (DataRow drData in dtData.Rows)
                {
                    cboAuditor.Items.Add(drData[0].ToString());
                }
                dtData = dalC.GetTaxAgent();
                foreach (DataRow drData in dtData.Rows)
                {
                    cboTaxAgent.Items.Add(drData[0].ToString());
                }
                dtData = dalC.GetYA();
                break;
            }
            if (cboTaxAgent.Items.Count > 0)
            {
                cboTaxAgent.SelectedIndex = 0;
            }
            cboYA.Items.Clear();
            foreach (DataRow drData in dtData.Rows)
            {
                cboYA.Items.Add(drData[0].ToString());
                toolStripCboYA.Items.Add(drData[0].ToString());
            }
            //azham change ========================= 16-mar-2016
            if (cboForm.Text == "C")
            {
                toolStripCboYA.Text = "2017";
                cboYA.Text          = "2017";
            }
            else if (cboForm.Text == "R")
            {
                toolStripCboYA.Text = "2017";
                cboYA.Text          = "2017";
            }
            else
            {
                toolStripCboYA.Text = "2016";
                cboYA.Text          = "2016";
            }
            //   toolStripCboYA.Text = string.Format(Date.Now, "yyyy");
            //  cboYA.Text = string.Format(Date.Now, "yyyy");
            //azham change ========================= 16-mar-2016


            if (cboAuditor.Items.Count > 0)
            {
                cboAuditor.SelectedIndex = 0;
            }
        }
        public void PopulateDG()
        {
            dgEFURL.DataSource = null;
            switch (strFormType)
            {
            case "C":
            case "R":
                EFilingDAL dal = new EFilingDAL();
                //PANYW CP204  **Due to CP204
                String[] strArrayCR = new string[2];
                strArrayCR[0]      = "C";
                strArrayCR[1]      = "R";
                dgEFURL.DataSource = dal.LoadAllURL(strArrayCR, toolStripCboYA.Text);
                //PANYW CP204 END
                break;

            case "B":
                EFilingDALB dalB = new EFilingDALB();
                dgEFURL.DataSource = dalB.LoadAllURL("B", toolStripCboYA.Text);
                break;

            case "BE":
                EFilingDALB dalBE = new EFilingDALB();
                dgEFURL.DataSource = dalBE.LoadAllURL("BE", toolStripCboYA.Text);
                break;

            case "M":
                EFilingDALB dalM = new EFilingDALB();
                dgEFURL.DataSource = dalM.LoadAllURL("M", toolStripCboYA.Text);
                break;

            case "P":
                EFilingDALP dalP = new EFilingDALP();
                dgEFURL.DataSource = dalP.LoadAllURL(toolStripCboYA.Text);
                break;

            //PANYW CP204
            case "CP204":
                String[] strArrayCP204 = new string[1];
                strArrayCP204[0] = "CP204";
                EFilingDALCP204 dalCP204 = new EFilingDALCP204();
                dgEFURL.DataSource = dalCP204.LoadAllURL(strArrayCP204, toolStripCboYA.Text);
                break;

            //PANYW CP204
            //NGOHCS CP204A
            case "CP204A":
                String[] strArrayCP204A = new string[1];
                strArrayCP204A[0] = "CP204A";
                EFilingDALCP204A dalCP204A = new EFilingDALCP204A();
                dgEFURL.DataSource = dalCP204A.LoadAllURL(strArrayCP204A, toolStripCboYA.Text);
                break;

            //NGOHCS CP204A
            default:
                EFilingDAL dalC = new EFilingDAL();
                dgEFURL.DataSource = dalC.LoadAllURL(toolStripCboYA.Text);
                break;
            }
            dgEFURL.Refresh();
        }
        private void tsbtnDeleteAll_Click(object sender, EventArgs e)
        {
            DialogResult dialogResponse;

            dialogResponse = MessageBox.Show("Delete all record?", "TAXcom E-Filing", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dialogResponse == DialogResult.Yes)
            {
                string[] strData = new string[2];
                switch (strFormType)
                {
                case "BE":
                case "B":
                case "M":
                    EFilingDALB dalB = new EFilingDALB();
                    strData[0] = toolStripCboYA.Text;
                    strData[1] = strFormType;
                    if (dalB.Execute(strData, "DELALL") > 0)
                    {
                        MessageBox.Show("URL deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        PopulateDG();
                    }
                    else
                    {
                        MessageBox.Show("Deletes of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;

                case "C":
                case "R":
                    EFilingDAL dal = new EFilingDAL();
                    strData[0] = toolStripCboYA.Text;
                    strData[1] = strFormType;
                    if (dal.Execute(strData, "DELALL") > 0)
                    {
                        MessageBox.Show("URL for Form C deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        PopulateDG();
                    }
                    if (dal.Execute(strData, "DELALLR") > 0)
                    {
                        MessageBox.Show("URL for Form R deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        PopulateDG();
                    }
                    else
                    {
                        MessageBox.Show("Deletes of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;

                case "P":
                    EFilingDALP dalP = new EFilingDALP();
                    strData[0] = toolStripCboYA.Text;
                    strData[1] = strFormType;
                    if (dalP.Execute(strData, "DELALL") > 0)
                    {
                        MessageBox.Show("URL deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        PopulateDG();
                    }
                    else
                    {
                        MessageBox.Show("Deletes of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;

                case "CP204":
                    EFilingDALCP204 dalCP204 = new EFilingDALCP204();
                    strData[0] = toolStripCboYA.Text;
                    strData[1] = strFormType;
                    if (dalCP204.Execute(strData, "DELALL") > 0)
                    {
                        MessageBox.Show("URL deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        PopulateDG();
                    }
                    else
                    {
                        MessageBox.Show("Deletes of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;

                case "CP204A":
                    EFilingDALCP204A dalCP204A = new EFilingDALCP204A();
                    strData[0] = toolStripCboYA.Text;
                    strData[1] = strFormType;
                    if (dalCP204A.Execute(strData, "DELALL") > 0)
                    {
                        MessageBox.Show("URL deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        PopulateDG();
                    }
                    else
                    {
                        MessageBox.Show("Deletes of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;
                }
            }
        }
        private void tsbtnDelete_Click(object sender, EventArgs e)
        {
            if (dgEFURL.SelectedRows.Count > 0)
            {
                DialogResult dialogResponse;
                dialogResponse = MessageBox.Show("Delete selected record?", "TAXcom E-Filing", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResponse == DialogResult.Yes)
                {
                    string[] strData = new string[1];
                    switch (strFormType)
                    {
                    case "C":
                    case "R":
                        EFilingDAL dal = new EFilingDAL();
                        strData[0] = dgEFURL.SelectedRows[0].Cells[2].Value.ToString();
                        if (dal.Execute(strData, "DEL") > 0)
                        {
                            MessageBox.Show("URL deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            PopulateDG();
                        }
                        else
                        {
                            MessageBox.Show("Deletes of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        break;

                    case "B":
                    case "BE":
                    case "M":
                        EFilingDALB dalB = new EFilingDALB();
                        strData[0] = dgEFURL.SelectedRows[0].Cells[2].Value.ToString();
                        if (dalB.Execute(strData, "DEL") > 0)
                        {
                            MessageBox.Show("URL deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            PopulateDG();
                        }
                        else
                        {
                            MessageBox.Show("Deletes of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        break;

                    case "P":
                        EFilingDALP dalP = new EFilingDALP();
                        strData[0] = dgEFURL.SelectedRows[0].Cells[2].Value.ToString();
                        if (dalP.Execute(strData, "DEL") > 0)
                        {
                            MessageBox.Show("URL deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            PopulateDG();
                        }
                        else
                        {
                            MessageBox.Show("Deletes of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        break;

                    //PANYW CP204
                    case "CP204":
                        EFilingDALCP204 dalCP204 = new EFilingDALCP204();
                        strData[0] = dgEFURL.SelectedRows[0].Cells[2].Value.ToString();
                        if (dalCP204.Execute(strData, "DEL") > 0)
                        {
                            MessageBox.Show("URL deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            PopulateDG();
                        }
                        else
                        {
                            MessageBox.Show("Deletes of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        break;

                    //PANYW CP204 END
                    //NGOHCS CP204A
                    case "CP204A":
                        EFilingDALCP204A dalCP204A = new EFilingDALCP204A();
                        strData[0] = dgEFURL.SelectedRows[0].Cells[2].Value.ToString();
                        if (dalCP204A.Execute(strData, "DEL") > 0)
                        {
                            MessageBox.Show("URL deleted!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            PopulateDG();
                        }
                        else
                        {
                            MessageBox.Show("Deletes of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        break;
                        //NGOHCS CP204A END
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select a record to delete!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#9
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtURL.Text.Trim().Length > 0 && cboYA.Text.Trim().Length > 0 && cboForm.Text.Length > 0)
            {
                switch (cboForm.Text)
                {
                case "C":
                case "R":
                    EFilingDAL dal = new EFilingDAL();
                    if (dal.VerifyYA(cboYA.Text) == true)
                    {
                        int intStatus;
                        if (boolEditMode)
                        {
                            string[] strData = new string[2];
                            strData[0] = txtURL.Text.Trim().ToLower();
                            strData[1] = strIndex;
                            intStatus  = dal.Execute(strData, "UPD");
                        }
                        else
                        {
                            if (dal.VerifyURL(txtURL.Text.Trim(), cboYA.Text, cboForm.Text) == false)
                            {
                                int      intCount     = int.Parse(dal.GetRecCount(cboYA.Text, cboForm.Text)) + 1;
                                string   strPageIndex = cboForm.Text + cboYA.Text + "Page" + intCount.ToString();
                                string[] strData      = new string[4];
                                strData[0] = txtURL.Text.Trim().ToLower();
                                strData[1] = cboYA.Text;
                                strData[2] = strPageIndex;
                                strData[3] = cboForm.Text;
                                intStatus  = dal.Execute(strData, "ADD");
                            }
                            else
                            {
                                MessageBox.Show("URL existed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }
                        }

                        if (intStatus > 0)
                        {
                            if (boolEditMode)
                            {
                                MessageBox.Show("URL updated!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("URL added!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            frmParent.PopulateDG();
                            this.Close();
                        }
                        else
                        {
                            if (boolEditMode)
                            {
                                MessageBox.Show("Updates of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            else
                            {
                                MessageBox.Show("Adding of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid Year of Assessment!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;

                //PANYW CP204
                case "CP204":
                    EFilingDALCP204 dalCP204 = new EFilingDALCP204();
                    if (dalCP204.VerifyYA(cboYA.Text) == true)
                    {
                        int intStatus;
                        if (boolEditMode)
                        {
                            string[] strData = new string[2];
                            strData[0] = txtURL.Text.Trim().ToLower();
                            strData[1] = strIndex;
                            intStatus  = dalCP204.Execute(strData, "UPD");
                        }
                        else
                        {
                            if (dalCP204.VerifyURL(txtURL.Text.Trim(), cboYA.Text, cboForm.Text) == false)
                            {
                                int      intCount     = int.Parse(dalCP204.GetRecCount(cboYA.Text, cboForm.Text)) + 1;
                                string   strPageIndex = cboForm.Text + cboYA.Text + "Page" + intCount.ToString();
                                string[] strData      = new string[4];
                                strData[0] = txtURL.Text.Trim().ToLower();
                                strData[1] = cboYA.Text;
                                strData[2] = strPageIndex;
                                strData[3] = cboForm.Text;
                                intStatus  = dalCP204.Execute(strData, "ADD");
                            }
                            else
                            {
                                MessageBox.Show("URL existed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }
                        }

                        if (intStatus > 0)
                        {
                            if (boolEditMode)
                            {
                                MessageBox.Show("URL updated!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("URL added!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            frmParent.PopulateDG();
                            this.Close();
                        }
                        else
                        {
                            if (boolEditMode)
                            {
                                MessageBox.Show("Updates of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            else
                            {
                                MessageBox.Show("Adding of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid Year of Assessment!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;

                //PANYW CP204 END
                case "CP204A":
                    EFilingDALCP204A dalCP204A = new EFilingDALCP204A();
                    if (dalCP204A.VerifyYA(cboYA.Text) == true)
                    {
                        int intStatus;
                        if (boolEditMode)
                        {
                            string[] strData = new string[2];
                            strData[0] = txtURL.Text.Trim().ToLower();
                            strData[1] = strIndex;
                            intStatus  = dalCP204A.Execute(strData, "UPD");
                        }
                        else
                        {
                            if (dalCP204A.VerifyURL(txtURL.Text.Trim(), cboYA.Text, cboForm.Text) == false)
                            {
                                int      intCount     = int.Parse(dalCP204A.GetRecCount(cboYA.Text, cboForm.Text)) + 1;
                                string   strPageIndex = cboForm.Text + cboYA.Text + "Page" + intCount.ToString();
                                string[] strData      = new string[4];
                                strData[0] = txtURL.Text.Trim().ToLower();
                                strData[1] = cboYA.Text;
                                strData[2] = strPageIndex;
                                strData[3] = cboForm.Text;
                                intStatus  = dalCP204A.Execute(strData, "ADD");
                            }
                            else
                            {
                                MessageBox.Show("URL existed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }
                        }

                        if (intStatus > 0)
                        {
                            if (boolEditMode)
                            {
                                MessageBox.Show("URL updated!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("URL added!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            frmParent.PopulateDG();
                            this.Close();
                        }
                        else
                        {
                            if (boolEditMode)
                            {
                                MessageBox.Show("Updates of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            else
                            {
                                MessageBox.Show("Adding of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid Year of Assessment!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;

                case "B":
                case "BE":
                case "M":
                    EFilingDALB dalB = new EFilingDALB();
                    if (dalB.VerifyYA(cboYA.Text) == true)
                    {
                        int intStatus;
                        if (boolEditMode)
                        {
                            string[] strData = new string[2];
                            strData[0] = txtURL.Text.Trim().ToLower();
                            strData[1] = strIndex;
                            intStatus  = dalB.Execute(strData, "UPD");
                        }
                        else
                        {
                            if (dalB.VerifyURL(txtURL.Text.Trim(), cboYA.Text, cboForm.Text) == false)
                            {
                                int      intCount     = int.Parse(dalB.GetRecCount(cboYA.Text, cboForm.Text)) + 1;
                                string   strPageIndex = cboForm.Text + cboYA.Text + "Page" + intCount.ToString();
                                string[] strData      = new string[4];
                                strData[0] = txtURL.Text.Trim().ToLower();
                                strData[1] = cboYA.Text;
                                strData[2] = strPageIndex;
                                strData[3] = cboForm.Text;
                                intStatus  = dalB.Execute(strData, "ADD");
                            }
                            else
                            {
                                MessageBox.Show("URL existed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }
                        }

                        if (intStatus > 0)
                        {
                            if (boolEditMode)
                            {
                                MessageBox.Show("URL updated!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("URL added!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            frmParent.PopulateDG();
                            this.Close();
                        }
                        else
                        {
                            if (boolEditMode)
                            {
                                MessageBox.Show("Updates of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            else
                            {
                                MessageBox.Show("Adding of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid Year of Assessment!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;

                case "P":
                    EFilingDALP dalP  = new EFilingDALP();
                    EFilingDALB dalB2 = new EFilingDALB();
                    if (dalB2.VerifyYA(cboYA.Text) == true)
                    {
                        int intStatus;
                        if (boolEditMode)
                        {
                            string[] strData = new string[2];
                            strData[0] = txtURL.Text.Trim().ToLower();
                            strData[1] = strIndex;
                            intStatus  = dalP.Execute(strData, "UPD");
                        }
                        else
                        {
                            if (dalP.VerifyURL(txtURL.Text.Trim(), cboYA.Text, cboForm.Text) == false)
                            {
                                int      intCount     = int.Parse(dalP.GetRecCount(cboYA.Text, cboForm.Text)) + 1;
                                string   strPageIndex = cboForm.Text + cboYA.Text + "Page" + intCount.ToString();
                                string[] strData      = new string[4];
                                strData[0] = txtURL.Text.Trim().ToLower();
                                strData[1] = cboYA.Text;
                                strData[2] = strPageIndex;
                                strData[3] = cboForm.Text;
                                intStatus  = dalP.Execute(strData, "ADD");
                            }
                            else
                            {
                                MessageBox.Show("URL existed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }
                        }

                        if (intStatus > 0)
                        {
                            if (boolEditMode)
                            {
                                MessageBox.Show("URL updated!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("URL added!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            frmParent.PopulateDG();
                            this.Close();
                        }
                        else
                        {
                            if (boolEditMode)
                            {
                                MessageBox.Show("Updates of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            else
                            {
                                MessageBox.Show("Adding of URL failed!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid Year of Assessment!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;
                }
            }
            else
            {
                MessageBox.Show("Please complete all the fields!", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }