Example #1
0
        private void SbnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

                switch (Program.intCode)
                {
                case 13:    //Akwa Ibom state
                    break;

                case 20:    //Delta state
                    using (var reconcilation = new CentralDetla.CollectionManager())
                    {
                        dts = reconcilation.ReconcilliationReclassificationCheckApproved(dtsoff);
                    }
                    break;

                case 32:    //kogi state
                    break;

                case 37:    //ogun state
                    using (var receiptsserv = new Centralogun.CollectionManager())
                    {
                        dts = receiptsserv.ReconcilliationReclassificationCheckApproved(dtsoff);
                    }
                    break;

                case 40:    //oyo state
                    using (var reconciliationoyo = new Centraloyo.CollectionManager())
                    {
                        dts = reconciliationoyo.ReconcilliationReclassificationCheckApproved(dtsoff);
                    }
                    break;

                default:
                    break;
                }



                if (dts != null)
                {
                    //tableTrans = new DataTable();

                    foreach (DataRow dr in dts.Tables[0].Rows)
                    {
                        for (int rowHandle = 0; rowHandle < gridView1.RowCount; rowHandle++)
                        {
                            var periodID = gridView1.GetRowCellValue(rowHandle, gridView1.Columns["ID"]);

                            if (Convert.ToInt32(dr["OfflineUniqueID"].ToString()) == Convert.ToInt32(periodID.ToString()))
                            {
                                bool?approvalStatus = null;
                                if (dr["isApproved"] != null && dr["isApproved"] != DBNull.Value)
                                {
                                    approvalStatus = Convert.ToBoolean(dr["isApproved"]);
                                }

                                if (approvalStatus == null)
                                {
                                    gridView1.SetRowCellValue(rowHandle, gridView1.Columns["Status"], "Awaiting Approval");
                                }
                                else if (approvalStatus == true)
                                {
                                    gridView1.SetRowCellValue(rowHandle, gridView1.Columns["Status"], "Approved");
                                    //get approved offlineid
                                    tableTrans.Rows.Add(new object[] { Convert.ToInt32(dr["OfflineUniqueID"].ToString()), dr["ApprovedBY"].ToString(), Convert.ToDateTime(dr["ApprovedDate"]) });
                                }
                                else if (approvalStatus == false)
                                {
                                    gridView1.SetRowCellValue(rowHandle, gridView1.Columns["Status"], "Disapproved");
                                }
                            }
                        }
                    }
                }

                //check for approved record before processing
                if (tableTrans != null && tableTrans.Rows.Count > 0)
                {
                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("doReclassifiedProcess", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        _command.Parameters.Add(new SqlParameter("@pTransaction", SqlDbType.Structured)).Value = tableTrans;
                        _command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value          = Program.UserID;

                        _command.CommandTimeout = 0;

                        using (System.Data.DataSet ds = new System.Data.DataSet())
                        {
                            ds.Clear();
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(ds);
                            connect.Close();

                            if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);
                                return;
                            }
                            else
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                using (FrmReclassifiedResult frmreport = new FrmReclassifiedResult(ds))
                                {
                                    frmreport.ShowDialog();
                                }
                            }
                        }
                    }
                }
                else
                {
                    Common.setMessageBox("No Approved Record Found to Reclassified!", "Reclassification", 2); return;
                }
            }
            catch (Exception ex)
            {
                Tripous.Sys.ErrorBox(ex.Message); return;
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
Example #2
0
        void btnGet_Click(object sender, EventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

                dts = new System.Data.DataSet();

                dts.Clear();

                switch (Program.intCode)
                {
                case 13:    //Akwa Ibom state
                    using (var receiptAka = new CentralAkwa.CollectionManager())
                    {
                        dts = receiptAka.DelistFetch(txtSearch.Text.Trim().ToString());
                    }

                    break;

                case 20:    //Delta state
                    using (var receiptservic = new CentralDetla.CollectionManager())
                    {
                        dts = receiptservic.DelistFetch(txtSearch.Text.Trim().ToString());
                    }
                    break;

                case 32:    //kogi state
                //using (var receiptservic = new Kogireceiptservice.ReceiptService())
                //{
                //    dataSet = receiptservic.DownloadDataCentral(Program.stateCode);
                //}
                //break;

                case 37:    //ogun state
                    using (var receiptsserv = new Centralogun.CollectionManager())
                    {
                        dts = receiptsserv.DelistFetch(txtSearch.Text.Trim().ToString());
                    }
                    break;

                case 40:    //oyo state

                    using (var receiptsServices = new Centraloyo.CollectionManager())
                    {
                        dts = receiptsServices.DelistFetch(txtSearch.Text.Trim().ToString());
                    }
                    break;

                default:
                    break;
                }
                if (dts.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                {
                    if (dts.Tables[1] != null && dts.Tables[1].Rows.Count > 0)
                    {
                        gridControl2.DataSource = dts.Tables[1];

                        gridView2.Columns["Provider"].Visible          = false; gridView2.Columns["Channel"].Visible = false;
                        gridView2.Columns["DepositSlipNumber"].Visible = false; gridView2.Columns["PaymentMethod"].Visible = false; gridView2.Columns["AgencyName"].Visible = false; gridView2.Columns["AgencyCode"].Visible = false; gridView2.Columns["BankCode"].Visible = false; gridView2.Columns["BankName"].Visible = false;
                        gridView2.Columns["BranchCode"].Visible        = false; gridView2.Columns["BranchName"].Visible = false;
                        gridView2.Columns["ReceiptNo"].Visible         = false; gridView2.Columns["ReceiptDate"].Visible = false; gridView2.Columns["TelephoneNumber"].Visible = false; gridView2.Columns["AmountWords"].Visible = false; gridView2.Columns["RevenueCode"].Visible = false; gridView2.Columns["RevenueName"].Visible = false; gridView2.Columns["ChequeNumber"].Visible = false; gridView2.Columns["ChequeValueDate"].Visible = false; gridView2.Columns["ChequeBankCodeListID"].Visible = false; gridView2.Columns["ChequeBankCodeName"].Visible = false;
                        gridView2.Columns["ChequeStatus"].Visible      = false; gridView2.Columns["DateChequeReturned"].Visible = false; gridView2.Columns["TownName"].Visible = false; gridView2.Columns["PaymentMethod"].Visible = false; gridView2.Columns["PayerAddress"].Visible = false; gridView2.Columns["PayerName"].Visible = false; gridView2.Columns["PayerID"].Visible = false; gridView2.Columns["EReceipts"].Visible = false;
                        gridView2.Columns["EReceiptsDate"].Visible     = false; gridView2.Columns["GeneratedBy"].Visible = false;
                        gridView2.Columns["ControlNumber"].Visible     = false; gridView2.Columns["Status"].Visible = false;
                        gridView2.Columns["PrintedDate"].Visible       = false; gridView2.Columns["PrintedBy"].Visible = false;
                        gridView2.Columns["StationCode"].Visible       = false; gridView2.Columns["PayerAddress"].Visible = false;
                        gridView2.Columns["TownListID"].Visible        = false; gridView2.Columns["ICMAeReceipts"].Visible = false;
                        gridView2.Columns["PostedBy"].Visible          = false; gridView2.Columns["ReceiptDownloadStatus"].Visible = false;

                        gridView2.Columns["Amount"].DisplayFormat.FormatType        = FormatType.Numeric;
                        gridView2.Columns["Amount"].DisplayFormat.FormatString      = "n2";
                        gridView2.Columns["PaymentDate"].DisplayFormat.FormatType   = FormatType.DateTime;
                        gridView2.Columns["PaymentDate"].DisplayFormat.FormatString = "dd/MM/yyyy";

                        if (isSeconGrid)
                        {
                            selection2 = new GridCheckMarksSelection(gridView2, ref lblSelect2);
                            selection2.CheckMarkColumn.VisibleIndex = 0;
                            isSeconGrid = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Tripous.Sys.ErrorBox(ex.Message + ex.StackTrace.ToString(), Program.ApplicationName); return;
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
Example #3
0
        void btnUpdate_Click(object sender, EventArgs e)
        {
            if (selection.SelectedCount == 0)
            {
                Common.setMessageBox("No Selection Made for Printing of Receipts", Program.ApplicationName, 3);
                return;
            }
            else if (selection2.SelectedCount == 0)
            {
                Common.setMessageBox("No Selection Made for Printing of Receipts", Program.ApplicationName, 3);
                return;
            }
            else if (selection.SelectedCount != selection.SelectedCount)
            {
                Common.setMessageBox("Number of Delist Transaction Record not equall", Program.ApplicationName, 3);
                return;
            }
            else
            {
                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    for (int j = 0; j < selection2.SelectedCount; j++)
                    {
                        string _values  = String.Format("'{0}'", (selection.GetSelectedRow(i) as DataRowView)["Amount"]);
                        string _values2 = string.Format("'{0}'", (selection2.GetSelectedRow(j) as DataRowView)["Amount"]);

                        if (_values.CompareTo(_values2) == 0)
                        {
                            ///add code here for true
                            temTable.Rows.Add(new object[] { j, String.Format("{0}", (selection2.GetSelectedRow(j) as DataRowView)["PaymentRefNumber"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]), Program.UserID });
                        }
                        else
                        {
                            Common.setMessageBox("Selected Amount Not Equall", Program.ApplicationName, 3);
                            return;
                        }
                    }
                }

                if (temTable != null && temTable.Rows.Count > 0)
                {
                    dataSet = new DataSet("table");

                    dataSet.Tables.Add(temTable);

                    switch (Program.intCode)
                    {
                    case 13:    //Akwa Ibom state
                        using (var receiptAka = new CentralAkwa.CollectionManager())
                        {
                            dts = receiptAka.DelistUpdate(dataSet);
                        }

                        using (var tempState = new StateAkwa.CollectionManager())
                        {
                            dts2 = tempState.DelistUpdate(dataSet);
                        }
                        break;

                    case 20:    //Delta state
                        using (var tempCentral = new CentralDetla.CollectionManager())
                        {
                            dts = tempCentral.DelistUpdate(dataSet);
                        }
                        using (var tempState = new StateDelta.CollectionManager())
                        {
                            dts2 = tempState.DelistUpdate(dataSet);
                        }
                        break;

                    case 32:    //kogi state
                    //using (var receiptservic = new Kogireceiptservice.ReceiptService())
                    //{
                    //    dataSet = receiptservic.DownloadDataCentral(Program.stateCode);
                    //}
                    //break;

                    case 37:    //ogun state
                        using (var receiptsserv = new Centralogun.CollectionManager())
                        {
                            dts = receiptsserv.DelistUpdate(dataSet);
                        }

                        using (var tempState = new StateOgun.CollectionManager())
                        {
                            dts2 = tempState.DelistUpdate(dataSet);
                        }
                        break;

                    case 40:    //oyo state

                        using (var receiptsServices = new Centraloyo.CollectionManager())
                        {
                            dts = receiptsServices.DelistUpdate(dataSet);
                        }

                        using (var tempState = new StateOyo.CollectionManager())
                        {
                            dts2 = tempState.DelistUpdate(dataSet);
                        }
                        break;

                    default:
                        break;
                    }
                }
                //get return
                //dataSet2.Tables[0].Rows[0]["returnCode"].ToString() == "-1"
                if (dts.Tables[0].Rows[0]["returnCode"].ToString() == "00" && dts2.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                {
                    //insert record local after delist from online

                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        //gridControl1.DataSource = null;
                        connect.Open();

                        _command = new SqlCommand("InsertDelist", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        _command.Parameters.Add(new SqlParameter("@DelistTemp", SqlDbType.Structured)).Value = temTable;
                        _command.CommandTimeout = 0;

                        using (System.Data.DataSet ds = new System.Data.DataSet())
                        {
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(ds, "ViewUnsweptTransaction");
                            //Dts = ds.Tables[0];
                            connect.Close();

                            if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                            {
                                Common.setMessageBox(string.Format("{0}", dts.Tables[0].Rows[0]["returnMessage"]), Program.ApplicationName, 1);
                                gridControl1.DataSource = null;
                                gridControl2.DataSource = null;
                            }
                            else
                            {
                                Tripous.Sys.ErrorBox(String.Format("{0}{1}", ds.Tables[0].Rows[0]["returnCode"].ToString(), ds.Tables[0].Rows[0]["returnMessage"].ToString()));

                                return;
                            }
                        }
                    }
                }
                else
                {
                    Common.setMessageBox(string.Format("{0}...Error Occur During Delist Transaction", dts.Tables[0].Rows[0]["returnMessage"]), Program.ApplicationName, 3);
                    return;
                }
            }
        }
Example #4
0
        void Processwork()
        {
            DataSet dataSet = new DataSet();

            dts = new System.Data.DataSet();

            dts.Clear();

            if (string.IsNullOrEmpty(selection.SelectedCount.ToString()) || selection.SelectedCount == 0)
            {
                Common.setMessageBox("No Record selected", "Reclassification", 1); return;
            }


            string str = string.Format("Do you really want to Approve this ({0}) number(s) of Reclassified Transaction", selection.SelectedCount);

            DialogResult results = MessageBox.Show(str, Program.ApplicationName, MessageBoxButtons.YesNo);

            if (results == DialogResult.Yes)
            {
                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["ID"], (selection.GetSelectedRow(i) as DataRowView)["BSID"], (selection.GetSelectedRow(i) as DataRowView)["TransID"] });
                }

                try
                {
                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("dogetReclassifiedInforequest", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        _command.Parameters.Add(new SqlParameter("@pTransaction", SqlDbType.Structured)).Value = tableTrans;
                        _command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value          = Program.UserID;

                        using (System.Data.DataSet ds = new System.Data.DataSet())
                        {
                            ds.Clear();
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(ds);
                            connect.Close();

                            if (ds != null || ds.Tables[0].Rows.Count > 0)
                            {
                                switch (Program.intCode)
                                {
                                case 13:    //Akwa Ibom state
                                    break;

                                case 20:    //Delta state
                                    using (var reconcilation = new CentralDetla.CollectionManager())
                                    {
                                        dts = reconcilation.ReconcilliationReclassificationRequests(ds);
                                    }
                                    break;

                                case 32:    //kogi state
                                    break;

                                case 37:    //ogun state
                                    //var receiptsserv = /*new Centralogun.CollectionManager*/
                                    using (var receiptsserv = new Centralogun.CollectionManager())
                                    {
                                        dts = receiptsserv.ReconcilliationReclassificationRequests(ds);
                                    }
                                    break;

                                case 40:    //oyo state
                                    using (var reconciliationoyo = new Centraloyo.CollectionManager())
                                    {
                                        dts = reconciliationoyo.ReconcilliationReclassificationRequests(ds);
                                    }
                                    break;

                                default:
                                    break;
                                }

                                if (dts.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                                {
                                    //using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                                    //{
                                    if (ds.Tables[0].Columns.Contains("Narration"))
                                    {
                                        ds.Tables[0].Columns.Remove("Narration");
                                    }

                                    connect.Open();
                                    _command = new SqlCommand("ReclassifiedTransactionLogRequest", connect)
                                    {
                                        CommandType = CommandType.StoredProcedure
                                    };
                                    _command.Parameters.Add(new SqlParameter("@pTransaction", SqlDbType.Structured)).Value = ds.Tables[0];
                                    _command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value          = Program.UserID;

                                    using (System.Data.DataSet ds1 = new System.Data.DataSet())
                                    {
                                        ds1.Clear();
                                        adp = new SqlDataAdapter(_command);
                                        adp.Fill(ds1);
                                        connect.Close();

                                        if (ds1.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                                        {
                                            Common.setMessageBox(ds1.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);
                                            return;
                                        }
                                        else
                                        {
                                            Common.setMessageBox(ds1.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);
                                            setReload();
                                            return;
                                        }
                                    }
                                    //}
                                }
                                else
                                {
                                    Tripous.Sys.ErrorBox(String.Format("{0}", dts.Tables[0].Rows[0]["returnMessage"].ToString()));
                                    return;
                                }
                            }
                            else
                            {
                                return;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Tripous.Sys.ErrorBox(String.Format("{0}{1}", ex.Message, ex.StackTrace)); return;
                }
            }
        }