Esempio n. 1
0
        public JsonResult UpdateAuditer(Libraries.CommonLibrary.CBE.TransactionCBE transaction)
        {
            JsonResult result = new JsonResult();

            try
            {
                transaction.TMSId       = Libraries.CommonLibrary.Constants.GetCurrentTMSId();
                transaction.PlazaId     = Libraries.CommonLibrary.Constants.GetCurrentPlazaId();
                transaction.AuditDate   = DateTime.Now;
                transaction.AuditorId   = Convert.ToInt32(Session["LoggedUserId"].ToString());
                transaction.AuditStatus = (int)Libraries.CommonLibrary.Constants.AuditStatus.Reviewed;
                Libraries.CommonLibrary.BLL.TransactionBLL.UpdateAuditSection(transaction);
                result.Data = "Sucess";
            }
            catch (Exception ex)
            {
                result.Data = "Failure";
                HelperClass.LogMessage("Failed To Post Transaction List" + ex);
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public JsonResult JoinTransactions(string[] AssociatedTransactionIds, string TransactionId, string VehRegNo, string vehicleClassID)
        {
            JsonResult    result                 = new JsonResult();
            int           vehicleClassId         = Convert.ToInt32(vehicleClassID);//Get by Audited
            DateTime      transactionDatetime    = DateTime.Now;
            int           isBalanceUpdated       = 0;
            long          childOneTranasactionId = 0;
            long          childTwoTranasactionId = 0;
            StringBuilder returnMessage          = new StringBuilder();
            String        message                = "";

            //get Parent Transaction Data
            Libraries.CommonLibrary.CBE.TransactionCBE transaction = new Libraries.CommonLibrary.CBE.TransactionCBE();
            transaction.TransactionId = Convert.ToInt32(TransactionId);
            DataTable parentTransaction = new DataTable();

            parentTransaction = Libraries.CommonLibrary.BLL.TransactionBLL.Transaction_GetById(transaction);

            if (parentTransaction != null && parentTransaction.Rows != null && parentTransaction.Rows.Count > 0)
            {
                if (parentTransaction.Rows[0]["IS_BALANCE_UPDATED"].ToString() == "1")
                {
                    isBalanceUpdated = 1;
                }
                transaction.LaneId  = Convert.ToInt32(parentTransaction.Rows[0]["LANE_ID"].ToString());
                transactionDatetime = Convert.ToDateTime(parentTransaction.Rows[0]["TRANSACTION_DATETIME"].ToString());
            }
            if (AssociatedTransactionIds != null)
            {
                //Check Reviewer Selected One Child
                if (AssociatedTransactionIds.Length > 0)
                {
                    childOneTranasactionId = Convert.ToInt64(AssociatedTransactionIds[0]);
                }
                if (AssociatedTransactionIds.Length > 1)
                {
                    childTwoTranasactionId = Convert.ToInt64(AssociatedTransactionIds[1]);
                }
            }
            transaction.IsBalanceUpdated    = isBalanceUpdated;
            transaction.TransactionDateTime = transactionDatetime;
            transaction.ModifierId          = Convert.ToInt32(Session["LoggedUserId"].ToString());
            transaction.ModificationDate    = DateTime.Now;
            transaction.TMSId   = Libraries.CommonLibrary.Constants.GetCurrentTMSId();
            transaction.PlazaId = Libraries.CommonLibrary.Constants.GetCurrentPlazaId();
            #region Financial and Notification By Manual Review
            if (isBalanceUpdated != 1)
            {
                //Charging and Notification Logics
                //get Customer Vehicle from customer VRN
                Libraries.CommonLibrary.CBE.CustomerVehicleCBE customerVehicleInfo = new Libraries.CommonLibrary.CBE.CustomerVehicleCBE();
                customerVehicleInfo.VehRegNo       = VehRegNo;
                customerVehicleInfo                = Libraries.CommonLibrary.BLL.CustomerVehicleBLL.GetCustomerVehicleByVehRegNo(customerVehicleInfo);
                customerVehicleInfo.VehicleClassId = vehicleClassId;

                //get customer account info from customer VRN
                Libraries.CommonLibrary.CBE.CustomerAccountCBE customerAccountInfo = new Libraries.CommonLibrary.CBE.CustomerAccountCBE();
                customerAccountInfo.AccountId = customerVehicleInfo.AccountId;
                customerAccountInfo.TmsId     = 1;
                customerAccountInfo           = Libraries.CommonLibrary.BLL.CustomerAccountBLL.GetCustomerById(customerAccountInfo);

                //financial operation here
                FinancialProcessing(customerVehicleInfo, customerAccountInfo, transaction);
                //Update Is Blanace Updated =1
                isBalanceUpdated = 1;
                HelperClass.LogMessage("Financial processing has been done.");
                //notification operation here
                //NotificationProcessing(customerVehicleInfo, customerAccountInfo, transaction);
                message = "SucessFully Audited and Join Transaction";
            }
            else
            {
                returnMessage.Append("Balance not Deducted as Balance already deducted for this Transaction");
                message = "Balance not Deducted as Balance already deducted for this Transaction";
            }
            #endregion
            //In this region i have to call new package
            #region Join and Audit Section of Transactions
            //Call Function UpdateAuditJoinTransaction Here
            Libraries.CommonLibrary.BLL.TransactionBLL.JoinAuditTransaction(transaction.TransactionId, childOneTranasactionId, childTwoTranasactionId, VehRegNo, vehicleClassId, Convert.ToInt32(Session["LoggedUserId"].ToString()));
            #endregion
            //returnMessage.Append("SucessFully Audited and Join Transaction");
            //result.Data = returnMessage;
            result.Data = message;
            return(Json(result));
        }
Esempio n. 3
0
        public ActionResult AssociatedTransaction(string transactionId, string TransactionCategoryId)
        {
            DateTime transactiondatetime = DateTime.Now;
            string   strTransactionTime  = string.Empty;
            int      ctEntryId           = 0;
            int      nffrontEntryId      = 0;
            int      nfRearEntryId       = 0;

            string strfilter = " WHERE 1=1 ";

            strfilter += " AND T.TRANSACTION_ID = " + transactionId;
            Libraries.CommonLibrary.CBE.TransactionCBE transaction = new Libraries.CommonLibrary.CBE.TransactionCBE();

            transaction.TransactionId = Convert.ToInt32(transactionId);
            //Get TransactionTime from Transaction Id
            DataTable transactiondata = Libraries.CommonLibrary.BLL.TransactionBLL.GetDataTableFilteredRecords(strfilter);

            if (transactiondata != null && transactiondata.Rows != null && transactiondata.Rows.Count > 0)
            {
                transactiondatetime = Convert.ToDateTime(transactiondata.Rows[0]["TRANSACTION_DATETIME"].ToString());
                strTransactionTime  = transactiondatetime.ToString("dd/MM/yyyy HH:mm:ss");

                ViewBag.TransactionId   = transactionId;
                ViewBag.TransactionTime = strTransactionTime;
                ViewBag.CrossTalkVRN    = transactiondata.Rows[0]["CTP_VRN"].ToString();
                ViewBag.Class           = transactiondata.Rows[0]["CTP_VEHICLE_CLASS_NAME"].ToString();
                ViewBag.NFRear          = transactiondata.Rows[0]["REAR_IMAGE"].ToString();
                ViewBag.NFFront         = transactiondata.Rows[0]["FRONT_IMAGE"].ToString();
                ViewBag.NFFrontVideo    = transactiondata.Rows[0]["FRONT_VIDEO_URL"].ToString();
                ViewBag.NFRearVideo     = transactiondata.Rows[0]["REAR_VIDEO_URL"].ToString();
                ViewBag.VehicleSpeed    = transactiondata.Rows[0]["VEHICLESPEED"].ToString();

                //check CT_Entry_ID exists if yes we will not fetch CT_entry_ID associated transaction
                if (transactiondata.Rows[0]["CT_ENTRY_ID"].ToString() != null && transactiondata.Rows[0]["CT_ENTRY_ID"].ToString() != "")
                {
                    ctEntryId = Convert.ToInt32(transactiondata.Rows[0]["CT_ENTRY_ID"].ToString());
                }
                //check NFFrontEntryID exists if yes we will not fetch NFFrontEntryID associated transaction
                if (transactiondata.Rows[0]["NF_ENTRY_ID_FRONT"].ToString() != null && transactiondata.Rows[0]["NF_ENTRY_ID_FRONT"].ToString() != "")
                {
                    nffrontEntryId = Convert.ToInt32(transactiondata.Rows[0]["NF_ENTRY_ID_FRONT"].ToString());
                }
                //check NFREAREntryID exists if yes we will not fetch NFREAREntryID associated transaction
                if (transactiondata.Rows[0]["NF_ENTRY_ID_REAR"].ToString() != null && transactiondata.Rows[0]["NF_ENTRY_ID_REAR"].ToString() != "")
                {
                    nfRearEntryId = Convert.ToInt32(transactiondata.Rows[0]["NF_ENTRY_ID_REAR"].ToString());
                }
                #region Vehicle Class Dropdown
                List <SelectListItem> vehicleClass = new List <SelectListItem>();
                List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.VehicleClassCBE> vehicle = VaaaN.MLFF.Libraries.CommonLibrary.BLL.VehicleClassBLL.GetAll();

                vehicleClass.Add(new SelectListItem()
                {
                    Text = "--Select All--", Value = "0"
                });
                foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.VehicleClassCBE vc in vehicle)
                {
                    vehicleClass.Add(new SelectListItem()
                    {
                        Text = vc.Name, Value = System.Convert.ToString(vc.Id)
                    });
                }

                ViewBag.AuditorVehicleClass = vehicleClass;

                #endregion
            }

            string strQuery = " WHERE 1=1 ";
            strQuery += " AND T.TRANSACTION_ID <> " + transactionId;
            strQuery += " AND  TRANSACTION_DATETIME BETWEEN TO_DATE('" + strTransactionTime + "','DD/MM/YYYY HH24:MI:SS') - INTERVAL '1' MINUTE AND  TO_DATE('" + strTransactionTime + "','DD/MM/YYYY HH24:MI:SS')  + INTERVAL '1' MINUTE";
            if (Convert.ToInt32(TransactionCategoryId) == 0)
            {
                //Case 1 Cross Talk entry Id Exists and Nodeflux Front Entry Id Exists and Nodeflux Rear Entry Id Exists
                if (ctEntryId != 0 && nffrontEntryId != 0 && nfRearEntryId == 0)
                {
                    //Return No Transaction
                }
                //Case 2 Cross Talk entry Id Exists and Nodeflux Front Entry Id Exists and Nodeflux Rear Entry Id not Exists
                else if (ctEntryId != 0 && nffrontEntryId != 0 && nfRearEntryId == 0)
                {
                    strQuery += " AND T.NF_ENTRY_ID_REAR IS NOT NULL";
                }
                //Case 3 Cross Talk entry Id Exists and Nodeflux Front Entry Id Not Exists and Nodeflux Rear Entry Id Exists
                else if (ctEntryId != 0 && nffrontEntryId == 0 && nfRearEntryId != 0)
                {
                    strQuery += " AND T.NF_ENTRY_ID_FRONT IS NOT NULL";
                }
                //Case 4 Cross Talk entry Id Exists and Nodeflux Front Entry Id Not Exists and Nodeflux Rear Entry Id NOT Exists
                else if (ctEntryId != 0 && nffrontEntryId == 0 && nfRearEntryId == 0)
                {
                    strQuery += " AND (T.NF_ENTRY_ID_FRONT IS NOT NULL OR T.NF_ENTRY_ID_REAR IS NOT NULL)";
                }
                //Case 5 Cross Talk entry Id Not Exists and Nodeflux Front Entry Id  Exists and Nodeflux Rear Entry Id Exists
                else if (ctEntryId == 0 && nffrontEntryId != 0 && nfRearEntryId != 0)
                {
                    strQuery += " AND T.CT_ENTRY_ID IS NOT NULL ";
                }
                //Case 6 Cross Talk entry Id Not Exists and Nodeflux Front Entry Id  Exists and Nodeflux Rear Entry Id NOT Exists
                else if (ctEntryId == 0 && nffrontEntryId != 0 && nfRearEntryId == 0)
                {
                    strQuery += " AND (T.CT_ENTRY_ID IS NOT NULL OR T.NF_ENTRY_ID_REAR IS NOT NULL) ";
                }
                //Case 7 Cross Talk entry Id Not Exists and Nodeflux Front Entry Id  Not Exists and Nodeflux Rear Entry Id Exists
                else if (ctEntryId == 0 && nffrontEntryId == 0 && nfRearEntryId != 0)
                {
                    strQuery += " AND (T.CT_ENTRY_ID IS NOT NULL OR T.NF_ENTRY_ID_FRONT IS NOT NULL) ";
                }
            }
            else if (Convert.ToInt32(TransactionCategoryId) == 1)
            {
                strQuery += " AND  NVL(T.CT_ENTRY_ID,0)  = 0  AND ((NVL(T.NF_ENTRY_ID_FRONT, 0) > 0 AND LOWER(NFPF.PLATE_NUMBER)<>'unidentified') OR (NVL(T.NF_ENTRY_ID_REAR, 0) > 0 AND LOWER(NFPR.PLATE_NUMBER) <> 'unidentified')) AND NVL(IS_BALANCE_UPDATED,0) <> 1 ";
            }
            else if (Convert.ToInt32(TransactionCategoryId) == 2)
            {
                strQuery += " AND  NVL(T.CT_ENTRY_ID,0)  = 0  AND NVL(T.NF_ENTRY_ID_FRONT, 0)= 0 AND NVL(T.NF_ENTRY_ID_REAR,0)>0  AND LOWER(NFPR.PLATE_NUMBER)<>'unidentified' AND NVL(IS_BALANCE_UPDATED,0) <> 1 ";
            }
            else if (Convert.ToInt32(TransactionCategoryId) == 3)
            {
                strQuery += " AND  NVL(T.CT_ENTRY_ID,0)  = 0  AND NVL(T.NF_ENTRY_ID_FRONT,0)>0  AND LOWER(NFPF.PLATE_NUMBER)<>'unidentified' AND NVL(IS_BALANCE_UPDATED,0) <> 1 ";
            }
            else if (Convert.ToInt32(TransactionCategoryId) == 4)
            {
                strQuery += " AND  NVL(T.NF_ENTRY_ID_FRONT,0)  = 0  AND (NVL(T.CT_ENTRY_ID,0)>0  OR (NVL(T.NF_ENTRY_ID_REAR,0)>0 AND LOWER(NFPR.PLATE_NUMBER)<>'unidentified'))  AND NVL(IS_BALANCE_UPDATED,0) <> 1 ";
            }
            else if (Convert.ToInt32(TransactionCategoryId) == 5)
            {
                strQuery += " AND  NVL(T.NF_ENTRY_ID_REAR,0)  = 0  AND (NVL(T.CT_ENTRY_ID,0)>0  OR (NVL(T.NF_ENTRY_ID_FRONT,0)>0 AND LOWER(NFPF.PLATE_NUMBER)<>'unidentified')) AND NVL(IS_BALANCE_UPDATED,0) <> 1 ";
            }
            else if (Convert.ToInt32(TransactionCategoryId) == 6)
            {
                strQuery += " AND  NVL(T.CT_ENTRY_ID,0)  > 0  AND NVL(IS_BALANCE_UPDATED,0) <> 1 ";
            }
            else if (Convert.ToInt32(TransactionCategoryId) == 7)
            {
                strQuery += " AND (LOWER(NFPR.PLATE_NUMBER)='unidentified'  OR  NVL(T.CT_ENTRY_ID,0)  > 0 ) AND NVL(IS_BALANCE_UPDATED,0) <> 1 ";
            }
            else if (Convert.ToInt32(TransactionCategoryId) == 8)
            {
                strQuery += " AND (LOWER(NFPF.PLATE_NUMBER)='unidentified'  OR  NVL(T.CT_ENTRY_ID,0)  > 0 ) AND NVL(IS_BALANCE_UPDATED,0) <> 1 ";
            }


            DataTable dt = new DataTable();
            dt = VaaaN.MLFF.Libraries.CommonLibrary.BLL.TransactionBLL.GetDataTableFilteredRecords(strQuery);
            ViewData["apiPath"] = HelperClass.GetAPIUrl();
            return(PartialView("_AssociatedTimeTransaction", dt));
        }
Esempio n. 4
0
        public string GetTransactionData(Libraries.CommonLibrary.CBE.TransactionCBE transaction)
        {
            string Det = JsonConvert.SerializeObject(VaaaN.MLFF.Libraries.CommonLibrary.BLL.TransactionBLL.Transaction_GetById(transaction), Formatting.Indented);

            return(Det.Replace("\r", "").Replace("\n", ""));
        }