Exemplo n.º 1
0
        public Response Login(Login Lg)
        {
            BankAppEntities DB  = new BankAppEntities();
            var             Obj = DB.Usp_Login(Lg.UserName, Lg.Password).ToList <Usp_Login_Result>().FirstOrDefault();

            if (Obj.Status == 0)
            {
                return new Response {
                           Status = "Invalid", Message = "Invalid User."
                }
            }
            ;
            if (Obj.Status == -1)
            {
                return new Response {
                           Status = "Inactive", Message = "User Inactive."
                }
            }
            ;
            else
            {
                return new Response {
                           Status = "Success", Message = Lg.UserName
                }
            };
        }
Exemplo n.º 2
0
        public Response UpdateCustomerBalance(UserDetails ud)
        {
            using (var ctx = new BankAppEntities())
            {
                var temp1 = (from c in ctx.CustomerCredentials
                             join cr in ctx.CustomerRequestAccounts on c.CustomerId equals cr.CustomerId
                             where c.UserId == ud.userid
                             select new CustomerRequestAccountTemp()
                {
                    CustomerId = c.CustomerId,
                    CustomerBalance = cr.CustomerBalance
                }).FirstOrDefault();

                if (Convert.ToInt32(temp1.CustomerBalance) > Convert.ToInt32(ud.balance))
                {
                    var std = ctx.CustomerRequestAccounts.FirstOrDefault(x => x.CustomerId == temp1.CustomerId);
                    std.CustomerBalance = (Convert.ToInt32(temp1.CustomerBalance) - Convert.ToInt32(ud.balance)).ToString();
                    ctx.SaveChanges();

                    return(new Response
                    {
                        Status = "Success", Message = "SuccessFully Saved."
                    });
                }

                else
                {
                    return(new Response
                    {
                        Status = "Insufficient Balance", Message = "Transaction Failed."
                    });
                }
            }
        }
Exemplo n.º 3
0
        public Dictionary <string, string> GetCustomerAccountDetails(int userid)
        {
            using (var ctx = new BankAppEntities())
            {
                var         map = new Dictionary <string, string>();
                UserDetails us  = new UserDetails();
                us.userid = userid;
                var temp1 = (from c in ctx.CustomerCredentials
                             join cr in ctx.CustomerRequestAccounts on c.CustomerId equals cr.CustomerId
                             where c.UserId == us.userid
                             select new CustomerRequestAccountTemp()
                {
                    CustomerId = c.CustomerId,
                    CustomerName = cr.CustomerName,
                    BankBranch = cr.BankBranch,
                    CustomerMobileNumber = cr.CustomerMobileNumber,
                    AccountNumber = c.AccountNumber,
                    BranchIFSC = cr.BranchIFSC,
                    CustomerBalance = cr.CustomerBalance
                }).FirstOrDefault();

                map.Add("accno", temp1.AccountNumber);
                map.Add("bn", temp1.BankBranch);
                map.Add("ifsc", temp1.BranchIFSC);
                map.Add("branch", temp1.BankBranch);
                map.Add("mobileno", temp1.CustomerMobileNumber.ToString());
                map.Add("amount", temp1.CustomerBalance);
                map.Add("name", temp1.CustomerName);
                return(map);
            }
        }
Exemplo n.º 4
0
        public Dictionary <string, string> GetCustomerAccountNumber(UserDetails us)
        {
            using (var ctx = new BankAppEntities())
            {
                var map = new Dictionary <string, string>();

                var temp1 = (from c in ctx.CustomerCredentials
                             where c.UserId == us.userid
                             select new CustomerRequestAccountTemp()
                {
                    CustomerId = c.CustomerId,
                    AccountNumber = c.AccountNumber
                }).FirstOrDefault();

                map.Add("body", temp1.AccountNumber);

                return(map);
            }
        }
Exemplo n.º 5
0
        public Dictionary <string, string> GetCustomerName(UserDetails us)
        {
            using (var ctx = new BankAppEntities())
            {
                var map = new Dictionary <string, string>();

                var temp1 = (from c in ctx.CustomerCredentials
                             join cr in ctx.CustomerRequestAccounts on c.CustomerId equals cr.CustomerId
                             where c.UserId == us.userid
                             select new CustomerRequestAccountTemp()
                {
                    CustomerId = c.CustomerId,
                    CustomerName = cr.CustomerName
                }).FirstOrDefault();

                map.Add("body", temp1.CustomerName);

                return(map);
            }
        }
Exemplo n.º 6
0
 public object RegisterCustomer(Registration Lvm)
 {
     try
     {
         BankAppEntities        db = new BankAppEntities();
         CustomerRequestAccount Em = new CustomerRequestAccount();
         if (Em.CustomerId == 0)
         {
             Em.AccountType              = Lvm.AccountType;
             Em.BankState                = Lvm.BankState;
             Em.BankCity                 = Lvm.BankCity;
             Em.BankBranch               = Lvm.BankBranch;
             Em.BranchIFSC               = Lvm.BranchIFSC;
             Em.CustomerName             = Lvm.CustomerName;
             Em.CustomerGender           = Lvm.CustomerGender;
             Em.CustomerDOB              = Lvm.CustomerDOB;
             Em.CustomerMobileNumber     = Lvm.CustomerMobileNumber;
             Em.CustomerBalance          = Lvm.CustomerBalance;
             Em.CustomerAadharCardNumber = Lvm.CustomerAadharCardNumber;
             Em.CustomerEmailId          = Lvm.CustomerEmailId;
             Em.CustomerAddress          = Lvm.CustomerAddress;
             Em.CustomerState            = Lvm.CustomerState;
             Em.CustomerCity             = Lvm.CustomerCity;
             Em.CustomerPIN              = Lvm.CustomerPIN;
             db.CustomerRequestAccounts.Add(Em);
             db.SaveChanges();
             return(new Response
             {
                 Status = "Success", Message = "SuccessFully Saved."
             });
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     return(new Response
     {
         Status = "Error", Message = "Invalid Data."
     });
 }
Exemplo n.º 7
0
        public object UpdateBalanceFundTransferInc(UserDetails ud)
        {
            using (var ctx = new BankAppEntities())
            {
                var temp1 = (from c in ctx.CustomerCredentials
                             join cr in ctx.CustomerRequestAccounts on c.CustomerId equals cr.CustomerId
                             where c.AccountNumber == ud.AccountNumber
                             select new CustomerRequestAccountTemp()
                {
                    CustomerId = c.CustomerId,
                    CustomerBalance = cr.CustomerBalance
                }).FirstOrDefault();


                var std = ctx.CustomerRequestAccounts.FirstOrDefault(x => x.CustomerId == temp1.CustomerId);
                std.CustomerBalance = (Convert.ToInt32(temp1.CustomerBalance) + Convert.ToInt32(ud.Amount)).ToString();
                ctx.SaveChanges();

                return(new Response
                {
                    Status = "Success", Message = "Transaction success."
                });
            }
        }