Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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;
                }
            }
        }
Ejemplo n.º 3
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);
            }
        }