コード例 #1
0
        public void Validate_Teller_Transaction(string transactionType, string tellerAccount, double transactionAmount, bool interTellerTransaction = false)
        {
            if (ValueConverters.IsStringEmpty(tellerAccount))
            {
                _validationDictionary.AddError("TransactionAmount", "You do not have a Valid Teller Account  !");
                _validationDictionary.AddError("PaidTo", "You do not have a Valid Teller Account  !");
                _validationDictionary.AddError("CustomerNo", "You do not have a Valid Teller Account  !");
                return;
            }
            if (transactionAmount <= 0.00)
            {
                _validationDictionary.AddError("TransactionAmount", "Transaction Amount is Zero/Negative");
                _validationDictionary.AddError("GlCredit", "Transaction Amount is Zero/Negative");
                _validationDictionary.AddError("CustomerNo", "Transaction Amount is Zero/Negative");
                _validationDictionary.AddError("PaidTo", "Transaction Amount is Zero/Negative");
            }

            double tellerBalance = TellerAccountBalance(tellerAccount);

            Company companyDetails = companyManager.GetCompanyDetails();

            if (interTellerTransaction || transactionType.ToUpper().In("MISCPAYMENTS", "AGENCYWITHDRAWAL", "CASHWITHDRAWAL"))
            {
                if (tellerBalance - transactionAmount < 0)
                {
                    _validationDictionary.AddError("TransactionAmount", "You Have Insufficient Funds for this Transaction !");
                    _validationDictionary.AddError("CustomerNo", "You Have Insufficient Funds for this Transaction !");
                    _validationDictionary.AddError("TrType", "You Have Insufficient Funds for this Transaction !");
                    _validationDictionary.AddError("PaidTo", "You Have Insufficient Funds for this Transaction !");
                }
            }
            else
            {
                if (!transactionType.ToUpper().In("CHEQUEDEPOSIT"))
                {
                    if ((decimal)tellerBalance > companyDetails.TellerCashInsuranceLimit)
                    {
                        if (transactionType == "PRODUCTREPAYMENTS")
                        {
                            _validationDictionary.AddError("customerDetails.CustomerNo", "Insurance Limit Has been Exceeded !");
                        }
                        else
                        {
                            _validationDictionary.AddError("TransactionAmount", "Insurance Limit Has been Exceeded !");
                            _validationDictionary.AddError("CustomerNo", "Insurance Limit Has been Exceeded !");
                            _validationDictionary.AddError("PaidTo", "You Have Insufficient Funds for this Transaction !");
                        }
                    }
                }
            }

            TellerDayClosed(tellerAccount);
        }
コード例 #2
0
        public static bool ValidateGlAccount_(string value)
        {
            bool isValid = true;

            if (ValueConverters.IsStringEmpty(value) ||
                value.Trim().Length != glAccountMask.Trim().Length)
            {
                isValid = false;
            }

            //ToDo Confirm GlAccount Existence
            if (isValid && value.Trim().Length == glAccountMask.Trim().Length)
            {
                // check existence of account
            }
            return(isValid);
        }
コード例 #3
0
        public string TellerDayClosed(string tellerGlAccountNo)
        {
            string result = string.Empty;

            if (!CustomValidation.ValidateGlAccount_(tellerGlAccountNo))
            {
                result = "You Do Not Have a Valid Teller Account ";
                _validationDictionary.AddError("GLDEBIT", result);
                _validationDictionary.AddError("PaidTo", result);
            }
            else
            {
                try
                {
                    string query = "SELECT top 1 TransactionDate from tbl_Teller_Closing where TellerAccount='" +
                                   tellerGlAccountNo + "' and TransactionDate>='" + ValueConverters.FormatSqlDate(DateTime.Now) + "'";

                    DbDataReader reader = DbConnector.GetSqlReader(query);

                    while (reader.Read())
                    {
                        string closedDate = reader["TransactionDate"].ToString();
                        if (ValueConverters.IsStringEmpty(closedDate) == false)
                        {
                            result = "Closing Already Done for This Teller ";
                            _validationDictionary.AddError("GLDEBIT", result);
                            _validationDictionary.AddError("PaidTo", result);
                            _validationDictionary.AddError("TransactionAmount", result);
                            _validationDictionary.AddError("CustomerNo", result);
                        }
                    }
                    reader.Close();
                }
                catch (Exception ex)
                {
                    Utility.WriteErrorLog(ref ex);
                    result = "Could not Check Account Status";
                    _validationDictionary.AddError("GLDEBIT", result);
                    _validationDictionary.AddError("PaidTo", result);
                }
            }
            return(result);
        }
コード例 #4
0
        public List <CustomerDetailsView> GetCustomerDetails(string customerNo)
        {
            List <CustomerDetailsView> custRecord = null;

            if (ValueConverters.IsStringEmpty(customerNo))
            {
                return(custRecord);
            }
            customerNo = ValueConverters.PADLeft(Int32.Parse(customerNoMask), customerNo.Trim(), '0');

            try
            {
                string sqlCommand = "SELECT SigningInstructions, CustomerNo,coalesce(CustomerIdNo,'') as CustomerIdNo,coalesce(CustomerName,'') as CustomerName,Locked,AccountRemarks,AccountComments,MemberType,Branch," +
                                    " AccountRemarks,AccountComments,DateClosed,coalesce(MobileNo,'') as MobileNo,EmpNumber as EmploymentNo,DateOfBirth,JoiningDate,Coalesce(EmployerCode,'') as EmployerCode," +
                                    " coalesce((select name from BranchSettings where branchcode=tbl_customer.Branch),'') as BranchName, " +
                                    " coalesce((select MembershipName from tbl_MembershipTypes where MembershipCode=tbl_customer.MemberType),'') as MemberTypeName, " +
                                    " coalesce((select DPTNAME from tbl_Departments where DptCode=tbl_customer.EmployerCode),'') as EmployerName " +
                                    " from tbl_customer WHERE CUSTOMERNO ='" + ValueConverters.format_sql_string(customerNo) + "'";

                DbDataReader reader = DbConnector.GetSqlReader(sqlCommand);

                custRecord = Functions.DataReaderMapToList <CustomerDetailsView>(reader);
            }
            catch (Exception ex)
            {
                Utility.WriteErrorLog(ref ex);
            }
            if (custRecord == null || custRecord.Count < 1)
            {
                custRecord = new List <CustomerDetailsView>
                {
                    new CustomerDetailsView()
                };
                custRecord[0].CustomerName = "Customer Record Not Found ";
            }
            return(custRecord);
        }