Exemplo n.º 1
0
        public tbl_Customer CustomerDetails(string customerNo)
        {
            tbl_Customer customer = new tbl_Customer();

            if (!string.IsNullOrWhiteSpace(customerNo.ToString()))
            {
                customerNo = ValueConverters.PADLeft(Int32.Parse(this.customerNumberMusk), customerNo, '0');

                customer = mainDb.tbl_Customer
                           .Where(x => x.CustomerNo.Trim() == customerNo.Trim())
                           .Select(x => x)
                           .FirstOrDefault();
            }

            return(customer);
        }
        public HttpResponseMessage TellerDeposit(TellerMobileDeposit tellerDeposit)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
            }

            TellerProductRepaymentsView productRepayments = new TellerProductRepaymentsView();
            TellerProductRepaymentsView custDetails       = new TellerProductRepaymentsView();

            custDetails.CustomerNo = ValueConverters.PADLeft(Int32.Parse(customerNoMask), tellerDeposit.CustomerNo, '0');
            List <RepaymentView> repayments = tellerManager.ReadRepayment(tellerDeposit);

            if (!tellerManager.PostProductRepayment(custDetails, repayments, tellerDeposit.TellerLoginCode, tellerDeposit.DeviceInfo))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, "Transaction posted successfully"));
        }
        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);
        }