Пример #1
0
        private static List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE> ConvertDataTableToListDirect(DataTable dt)
        {
            try
            {
                List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE> customerAccountList = new List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE account = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE();

                    if (dt.Rows[i]["ACCOUNT_ID"] != DBNull.Value)
                    {
                        account.AccountId = Convert.ToInt32(dt.Rows[i]["ACCOUNT_ID"]);
                    }

                    if (dt.Rows[i]["FIRST_NAME"] != DBNull.Value)
                    {
                        account.FirstName = Convert.ToString(dt.Rows[i]["FIRST_NAME"]);
                    }

                    if (dt.Rows[i]["MOB_NUMBER"] != DBNull.Value)
                    {
                        account.MobileNo = Convert.ToString(dt.Rows[i]["MOB_NUMBER"]);
                    }

                    if (dt.Rows[i]["EMAIL_ID"] != DBNull.Value)
                    {
                        account.EmailId = Convert.ToString(dt.Rows[i]["EMAIL_ID"]);
                    }

                    if (dt.Rows[i]["ADDRESS"] != DBNull.Value)
                    {
                        account.Address = Convert.ToString(dt.Rows[i]["ADDRESS"]);
                    }

                    if (dt.Rows[i]["CUSTOMER_IMAGE_PATH"] != DBNull.Value)
                    {
                        account.CustomerImagePath = Convert.ToString(dt.Rows[i]["CUSTOMER_IMAGE_PATH"]);
                    }


                    if (dt.Rows[i]["RESIDENT_ID"] != DBNull.Value)
                    {
                        account.ResidentId = Convert.ToString(dt.Rows[i]["RESIDENT_ID"]);
                    }

                    if (dt.Rows[i]["RESIDENTIDCARDIMAGE"] != DBNull.Value)
                    {
                        account.ResidentidcardImagePath = Convert.ToString(dt.Rows[i]["RESIDENTIDCARDIMAGE"]);
                    }
                    customerAccountList.Add(account);
                }
                return(customerAccountList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public static int Insert(VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE account)
        {
            int entryId = 0;

            try
            {
                string    spName  = VaaaN.MLFF.Libraries.CommonLibrary.Constants.oraclePackagePrefix + "ACCOUNT_INSERT";
                DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName);
                //if (entryId <= 0)
                //{
                //    entryId = GetNextValue();
                //}
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_tms_id", DbType.Int32, account.TmsId, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_account_id", DbType.Int32, entryId, ParameterDirection.Output));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_first_name", DbType.String, account.FirstName.ToUpper(), ParameterDirection.Input, 255));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_last_name", DbType.String, account.LastName, ParameterDirection.Input, 255));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_mob_number", DbType.String, account.MobileNo, ParameterDirection.Input, 255));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_email_id", DbType.String, account.EmailId, ParameterDirection.Input, 255));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_description", DbType.String, account.Description, ParameterDirection.Input, 255));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_address", DbType.String, account.Address, ParameterDirection.Input, 255));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_account_balance", DbType.Decimal, account.AccountBalance, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_creation_date", DbType.DateTime, account.CreationDate, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_customer_image_path", DbType.String, account.CustomerImagePath, ParameterDirection.Input, 255));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_is_doc_verified", DbType.Int32, account.IsDocVerified, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_account_status", DbType.Int32, account.AccountStatus, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_transfer_status", DbType.Int32, account.TransferStatus, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_resident_id", DbType.String, account.ResidentId, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_birth_place", DbType.String, account.BirthPlace, ParameterDirection.Input, 255));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_birth_date", DbType.DateTime, account.BirthDate, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_rt_rw", DbType.String, account.RT_RW, ParameterDirection.Input, 100));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_province_id", DbType.Int32, account.ProvinceId, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_city_id", DbType.Int32, account.CityId, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_district_id", DbType.Int32, account.DistrictId, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_sub_district_id", DbType.Int32, account.SubDistrictId, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_postal_code", DbType.Int32, account.PostalCode, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_nationality", DbType.Int32, account.Nationality, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_gender", DbType.Int32, account.Gender, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_marital_status", DbType.Int32, account.MaritalStatus, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_occupation", DbType.String, account.Occupation, ParameterDirection.Input, 255));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_residentidcardimagepath", DbType.String, account.ResidentidcardImagePath, ParameterDirection.Input, 255));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_valid_until", DbType.DateTime, account.ValidUntil, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_registration_through", DbType.Int32, account.RegistartionThrough, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_userpassword", DbType.String, account.UserPassword, ParameterDirection.Input, 255));
                VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.ExecuteNonQuery(command);
                entryId = Convert.ToInt32(command.Parameters["p_account_id"].Value);
            }
            catch (Exception ex)
            {
                entryId = 0;
                throw ex;
            }

            return(entryId);
        }
Пример #3
0
 public static void UpdateBalance(VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE account, Decimal amount)
 {
     try
     {
         string    spName  = VaaaN.MLFF.Libraries.CommonLibrary.Constants.oraclePackagePrefix + "ACCOUNT_BALANCEUPDATE";
         DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName);
         command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_tms_id", DbType.Int32, account.TmsId, ParameterDirection.Input));
         command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_account_id", DbType.Int32, account.AccountId, ParameterDirection.Input));
         command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_amount", DbType.Decimal, amount, ParameterDirection.Input));
         VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.ExecuteNonQuery(command);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #4
0
        private void NotificationProcessing(VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerVehicleCBE customerVehicleInfo, VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE customerAccountInfo, VaaaN.MLFF.Libraries.CommonLibrary.CBE.TransactionCBE transaction, Decimal tollToDeduct, Decimal AfterDeduction)
        {
            try
            {
                HelperClass.LogMessage("Trying to push SMS to MSMQ...");

                Message smsMessage = new Message();
                smsMessage.Formatter = new BinaryMessageFormatter();
                VaaaN.MLFF.Libraries.CommonLibrary.Classes.SmsNotification.SMSDetail smsDetail = new Libraries.CommonLibrary.Classes.SmsNotification.SMSDetail();
                CultureInfo culture     = new CultureInfo("id-ID");
                string      RechareDate = transaction.TransactionDateTime.AddDays(4).ToString("dd-MMM-yyyy") + " 23:59:59";
                if (AfterDeduction > 0)
                {
                    smsDetail.SMSMessage = "Pelanggan Yth, telah dilakukan pemotongan senilai Rp " + Decimal.Parse(tollToDeduct.ToString()).ToString("C", culture).Replace("Rp", "") + " terhadap saldo SJBE anda atas transaksi kendaraan " + customerVehicleInfo.VehRegNo + " pada " + transaction.TransactionDateTime.ToString(VaaaN.MLFF.Libraries.CommonLibrary.Constants.DATETIME_FORMAT_WITHOUT_SECONDSForSMS) + " di tempat " + GetPlazaNameById(transaction.PlazaId) + ". Sisa saldo SJBE anda saat ini Rp " + Decimal.Parse(AfterDeduction.ToString()).ToString("C", culture).Replace("Rp", "") + " Ref: [" + transaction.TransactionId.ToString() + "]";
                }
                else
                {
                    smsDetail.SMSMessage = "Pelanggan Yth, Saldo SJBE anda saat ini tidak mencukupi untuk dilakukan pemotongan senilai Rp " + Decimal.Parse(tollToDeduct.ToString()).ToString("C", culture).Replace("Rp", "") + " atas transaksi kendaraan " + customerVehicleInfo.VehRegNo + " pada " + transaction.TransactionDateTime.ToString(VaaaN.MLFF.Libraries.CommonLibrary.Constants.DATETIME_FORMAT_WITHOUT_SECONDSForSMS) + " di Gantry - Medan Merdeka Barat 1. Silahkan melakukan pengisian ulang saldo SJBE anda sebelum " + RechareDate + ". Keterlambatan pengisian ulang saldo akan dikenakan denda sebesar Rp 1.000.000,00. Sisa saldo SJBE anda saat ini Rp " + Decimal.Parse((AfterDeduction + tollToDeduct).ToString()).ToString("C", culture).Replace("Rp", "") + " Ref: [" + transaction.TransactionId.ToString() + "]";
                }

                HelperClass.LogMessage(smsDetail.SMSMessage);
                smsDetail.AccountId          = customerAccountInfo.AccountId;
                smsDetail.CustomerName       = customerAccountInfo.FirstName + " " + customerAccountInfo.LastName;
                smsDetail.SenderMobileNumber = customerAccountInfo.MobileNo;

                smsMessage.Body = smsDetail;

                HelperClass.LogMessage("Detail:" + smsDetail.ToString());
                smsMessageQueue.Send(smsMessage);
                HelperClass.LogMessage("Message pushed successfully to MSMQ.");
            }
            catch (Exception ex)
            {
                HelperClass.LogMessage("Exception in pushing SMS to SMS MSMQ. " + ex.ToString());
            }
        }
Пример #5
0
        private void FinancialProcessing(VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerVehicleCBE customerVehicleInfo, VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE customerAccountInfo, VaaaN.MLFF.Libraries.CommonLibrary.CBE.TransactionCBE transaction)
        {
            #region LaneType and TollRate Section
            decimal tollToDeduct = -1;
            try
            {
                HelperClass.LogMessage("Finding out LaneType and toll rate to deduct...");
                int laneTypeId = GetLaneTypeByLaneId(transaction.LaneId);
                HelperClass.LogMessage("LaneType is: " + laneTypeId);
                tollToDeduct = GetTollRate(Libraries.CommonLibrary.Constants.GetCurrentPlazaId(), laneTypeId, transaction.TransactionDateTime, customerVehicleInfo.VehicleClassId);
                HelperClass.LogMessage("Toll to deduct is (for motorcycle it may be 0.00): " + tollToDeduct);
            }
            catch (Exception ex)
            {
                HelperClass.LogMessage("Exception in finding out lane type and toll to deduct. " + ex.ToString());
                tollToDeduct = -1;
            }
            #endregion

            if (tollToDeduct > -1)
            {
                Decimal CurrentAccountBalance = customerAccountInfo.AccountBalance;
                Decimal AfterDeduction        = CurrentAccountBalance - tollToDeduct;
                if (AfterDeduction > 0)
                {
                    #region Account History Section
                    try
                    {
                        HelperClass.LogMessage("Trying to record in account history table...");
                        VaaaN.MLFF.Libraries.CommonLibrary.CBE.AccountHistoryCBE accountHistory = new Libraries.CommonLibrary.CBE.AccountHistoryCBE();
                        accountHistory.TMSId = transaction.TMSId;
                        //accountHistory.EntryId = 0;//this  is the auto incremented and primery key of table
                        accountHistory.AccountId = customerAccountInfo.AccountId;
                        accountHistory.CustomerVehicleEntryId = customerVehicleInfo.EntryId; //<=============================
                        accountHistory.TransactionTypeId      = (int)VaaaN.MLFF.Libraries.CommonLibrary.Constants.TransactionType.LaneDebit;
                        accountHistory.TransactionId          = transaction.TransactionId;
                        accountHistory.Amount      = tollToDeduct;
                        accountHistory.IsSMSSent   = (int)VaaaN.MLFF.Libraries.CommonLibrary.Constants.SMSSentStatus.Unsent;    //will be updated later on
                        accountHistory.IsEmailSent = (int)VaaaN.MLFF.Libraries.CommonLibrary.Constants.EmailSentStatus.Unsent;; //will be updated later on
                                                                                                                                //accountHistory.ModifierId = 1;//will be updated later on
                        accountHistory.CreationDate     = DateTime.Now;
                        accountHistory.ModificationDate = DateTime.Now;
                        accountHistory.TransferStatus   = (int)VaaaN.MLFF.Libraries.CommonLibrary.Constants.TransferStatus.NotTransferred;
                        VaaaN.MLFF.Libraries.CommonLibrary.BLL.AccountHistoryBLL.Insert(accountHistory);
                        HelperClass.LogMessage("Recorded in account history table successfully.");
                    }
                    catch (Exception ex)
                    {
                        HelperClass.LogMessage("Exception in recording in the Account History table. " + ex.ToString());
                    }
                    #endregion

                    #region Update Balance Section
                    try
                    {
                        HelperClass.LogMessage("Trying to update balance in customer account table...");
                        //should be by by trigger defined in TBL_ACCOUNT_HISTORY
                        VaaaN.MLFF.Libraries.CommonLibrary.BLL.CustomerAccountBLL.UpdateBalance(customerAccountInfo, (-1 * tollToDeduct));
                        HelperClass.LogMessage("Balance updated successfully in the customer account.");
                    }
                    catch (Exception ex)
                    {
                        HelperClass.LogMessage("Exception in updating customer's account balance. " + ex.ToString());
                    }
                    #endregion

                    #region Mark transaction as balance updated
                    try
                    {
                        HelperClass.LogMessage("Trying to update isBalanceUpdated field in transaction table...");
                        VaaaN.MLFF.Libraries.CommonLibrary.BLL.TransactionBLL.MarkAsBalanceUpdated(transaction);
                        HelperClass.LogMessage("Transaction is marked as balance updated.");
                    }
                    catch (Exception ex)
                    {
                        HelperClass.LogMessage("Exception in marking the transaction as balance updated. " + ex.ToString());
                    }
                    #endregion
                }
                else
                {
                    HelperClass.LogMessage("Due to insufficient balance.");
                    NotificationProcessing(customerVehicleInfo, customerAccountInfo, transaction, tollToDeduct, AfterDeduction);
                }
            }
            else
            {
                HelperClass.LogMessage("Toll to deduct is -1.00. There is some error somewhere.");
            }
        }
Пример #6
0
 public static List <CBE.CustomerAccountCBE> ValidateCustomerAccount(VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE customer)
 {
     return(VaaaN.MLFF.Libraries.CommonLibrary.DAL.CustomerAccountDAL.ValidateCustomerAccount(customer));
 }
Пример #7
0
 public static VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE GetCustomerByResidentId(VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE customer)
 {
     return(VaaaN.MLFF.Libraries.CommonLibrary.DAL.CustomerAccountDAL.GetCustomerByResidentId(customer));
 }
Пример #8
0
 public static void UpdateBalance(VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE account, Decimal amount)
 {
     VaaaN.MLFF.Libraries.CommonLibrary.DAL.CustomerAccountDAL.UpdateBalance(account, amount);
 }
Пример #9
0
 public static int Insert(VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE account)
 {
     return(VaaaN.MLFF.Libraries.CommonLibrary.DAL.CustomerAccountDAL.Insert(account));
 }