Esempio n. 1
0
        private void ConfirmRecords(Boolean SelectAll)//-----------------------------------------------Confirm All Records------------------------------------------------//
        {
            try
            {
                //Int32 RecCount = GetUnreceiptedCount();

                //if (RecCount > 499)
                //{
                //    call_error_msg(true);
                //    lblResult.Text = "Please Run the relavant receipt batch and do the other confirmations...!";
                //    return;
                //}

                CommonCLS.IBTBatches IBTBatch = new CommonCLS.IBTBatches();
                String BatchNo = IBTBatch.GetBatchNo("BATCH_NO");


                if (GrdIBTConfirmation.Rows.Count > 0)
                {
                    using (OracleConnection OraCon = new OracleConnection(ConfigurationManager.ConnectionStrings["ORAWF"].ToString()))
                    {
                        OraCon.Open();
                        OracleCommand     command = OraCon.CreateCommand();
                        OracleTransaction transaction;

                        // Start a local transaction
                        transaction = OraCon.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
                        // Assign transaction object for a pending local transaction
                        command.Transaction = transaction;

                        try
                        {
                            DataTable Dt = (DataTable)Session["ConfirmedData"];

                            //when user select all the records to be confirmed
                            if (SelectAll)
                            {
                                Int16 Count = 0;

                                foreach (DataRow item in Dt.Rows)
                                {
                                    //if (Count == 500)
                                    //{
                                    //    call_error_msg(true);
                                    //    lblResult.Text = "Please Run the relavant receipt batch and do the other confirmations...!";
                                    //    break;
                                    //}

                                    OracleCommand cmd = OraCon.CreateCommand();
                                    cmd.CommandText = "SP_FAS_IBT_CONFIRMATION";
                                    cmd.CommandType = CommandType.StoredProcedure;
                                    cmd.Parameters.Add("vPolicyNo", OracleType.VarChar).Value  = item["POLICY_NO"].ToString();
                                    cmd.Parameters.Add("vProduct", OracleType.VarChar).Value   = item["VALUE"].ToString();
                                    cmd.Parameters.Add("vAmount", OracleType.Number).Value     = item["CREDIT"].ToString();
                                    cmd.Parameters.Add("vID", OracleType.Number).Value         = Convert.ToInt64(item["ID"].ToString());
                                    cmd.Parameters.Add("vCreatedBy", OracleType.VarChar).Value = usrName;
                                    cmd.Parameters.Add("vBatchNo", OracleType.VarChar).Value   = BatchNo;

                                    cmd.Transaction = transaction;

                                    cmd.ExecuteNonQuery();    //***********************************************************************************************Test

                                    Count++;
                                }
                            }
                            else
                            {
                                foreach (GridViewRow row in GrdIBTConfirmation.Rows)//Selected Records
                                {
                                    CheckBox     chk       = (row.Cells[0].FindControl("chkboxselect") as CheckBox);
                                    DropDownList Commision = row.Cells[1].FindControl("ddlCommision") as DropDownList;


                                    if ((chk != null && chk.Checked) || SelectAll)
                                    {
                                        OracleCommand cmd = OraCon.CreateCommand();
                                        cmd.CommandText = "SP_FAS_IBT_CONFIRMATION";
                                        cmd.CommandType = CommandType.StoredProcedure;
                                        cmd.Parameters.Add("vPolicyNo", OracleType.VarChar).Value  = row.Cells[6].Text.ToString();
                                        cmd.Parameters.Add("vProduct", OracleType.VarChar).Value   = row.Cells[9].Text.ToString();
                                        cmd.Parameters.Add("vAmount", OracleType.Number).Value     = Convert.ToDouble(row.Cells[7].Text);
                                        cmd.Parameters.Add("vID", OracleType.Number).Value         = Convert.ToInt64(row.Cells[1].Text);
                                        cmd.Parameters.Add("vCreatedBy", OracleType.VarChar).Value = usrName;
                                        cmd.Parameters.Add("vBatchNo", OracleType.VarChar).Value   = BatchNo;

                                        cmd.Transaction = transaction;

                                        cmd.ExecuteNonQuery();//***********************************************************************************************Test

                                        //--------Send Data To TCS for Receipting---------
                                        // Exess
                                        // Partial
                                        // When Two Debit Returns
                                        // When PPW Cancelled
                                        //------------------------------------------------
                                    }
                                }
                            }



                            transaction.Commit();
                            OraCon.Close();

                            GrdIBTConfirmation.DataSource = null;
                            GrdIBTConfirmation.DataBind();



                            //--------Load New business and renewal system detected exeptions---------
                            LoadExeptionData();

                            //------------------------------------------------------------------------



                            call_error_msg(true);
                            lblResult.Text = "Confirmation Successfull...!";
                            CommonCLS.CommonFunctions.Logger(System.Web.VirtualPathUtility.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath), System.Reflection.MethodBase.GetCurrentMethod().Name, "----IBT Confirmation Successfull ---- Active User: "******"~/IBTLogFiles/Log.txt"));

                            //LoadData();
                        }

                        catch (Exception ex)
                        {
                            CommonCLS.CommonFunctions.Logger(System.Web.VirtualPathUtility.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath), System.Reflection.MethodBase.GetCurrentMethod().Name, ex.InnerException.ToString(), Server.MapPath("~/IBTLogFiles/Log.txt"));
                            call_error_msg(false);
                            lblResult.Text = ex.InnerException.ToString();
                        }
                    }
                }

                else
                {
                    call_error_msg(false);
                    lblResult.Text = "No Matching Records Available!";
                }
            }

            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        private void LoadData(String CatID)//----------------------------------------------------------Load Data To Grid View---------------------------------------------//
        {
            try
            {
                OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["ORAWF"].ToString());
                conn.Open();

                String Where = "";


                if (Session["IBT_Company"] == null)
                {
                    return;
                }


                //Life General Bifurcation according to the logged user.
                if (Session["IBT_Company"].ToString() == "GENERAL")
                {
                    Where = " AND (P.VALUE = 1 or P.VALUE = 3)";
                }

                if (Session["IBT_Company"].ToString() == "LIFE")
                {
                    Where = " AND (P.VALUE = 2 or P.VALUE = 4)";
                }

                if (Session["IBT_Company"].ToString() == "ALL")
                {
                    Where = "";
                    //Where = " AND P.VALUE = -1";
                }

                Where = Where + " AND T.DEPARTMENT = " + CatID;

                //OracleCommand cmd = new OracleCommand(" SELECT T.ID, T.ACCOUNT_NO,T.SERIAL_NO,to_char(T.TRANSACTION_DATE, 'DD/MM/RRRR') AS TRAN_DATE,T.DESCRIPTION,T.POLICY_NO,T.CREDIT,P.PRODUCT_DESCRIPTION,P.VALUE " +
                //                      " FROM FAS_IBT_UPLOADED_DTL T INNER JOIN FAS_IBT_PRODUCTS P ON " +
                //                      " P.VALUE = T.PRODUCT  WHERE T.MATCHING_STATUS = 2 AND T.DEPARTMENT <> 1 " + Where, conn);


                OracleCommand cmd = new OracleCommand(" SELECT T.ID, T.ACCOUNT_NO,T.SERIAL_NO,to_char(T.TRANSACTION_DATE, 'DD/MM/RRRR') AS TRAN_DATE,T.DESCRIPTION,T.POLICY_NO,T.CREDIT,P.PRODUCT_DESCRIPTION,P.VALUE " +
                                                      " FROM FAS_IBT_UPLOADED_DTL T INNER JOIN FAS_IBT_PRODUCTS P ON " +
                                                      " P.VALUE = T.PRODUCT  WHERE T.MATCHING_STATUS = 2 AND t.effective_end_date is null AND T.DEPARTMENT <> 1" + Where, conn);

                OracleDataAdapter oda = new OracleDataAdapter(cmd);
                DataTable         dt  = new DataTable();
                oda.Fill(dt);

                //Session["Dt"]

                //call_error_msg(true);
                lblReceiptStatus.Text = "     - Total Records - " + Convert.ToString(dt.Rows.Count);

                GrdIBTConfirmation.DataSource = dt;
                GrdIBTConfirmation.DataBind();

                Session["ConfirmedData"] = dt;

                conn.Close();
            }
            catch (Exception)
            {
                throw;
            }
        }