Ejemplo n.º 1
0
 public int SaveReferenceDetails1(ReferenceDetail ReferenceModel)
 {
     try
     {
         var existscount = dbContext.ReferenceDetails.Where(b => b.PhoneNumber == ReferenceModel.PhoneNumber).FirstOrDefault();
         if (existscount == null)
         {
             dbContext.ReferenceDetails.Add(ReferenceModel);
             dbContext.SaveChanges();
             return(100);
         }
         else
         {
             existscount.Reference1             = ReferenceModel.Reference1;
             existscount.ReferenceName1         = ReferenceModel.ReferenceName1;
             dbContext.Entry(existscount).State = System.Data.Entity.EntityState.Modified;
             dbContext.SaveChanges();
             return(100);
         }
     }
     catch (Exception ex)
     {
         ErrorLogDal objError = new ErrorLogDal();
         ErrorLog    model    = new ErrorLog();
         model.InnerException = ex.InnerException.InnerException.Message.ToString();
         model.Source         = "Save Reference Details";
         int error = objError.InsertError(model);
         return(400);
     }
 }
Ejemplo n.º 2
0
 public int SaveOneTimeFee(OneTimeFee FeeModel)
 {
     try
     {
         var feexists = dbContext.OneTimeFees.Where(o => o.PhoneNumber == FeeModel.PhoneNumber).FirstOrDefault();
         if (feexists == null)
         {
             dbContext.OneTimeFees.Add(FeeModel);
             dbContext.SaveChanges();
             return(100);
         }
         else
         {
             feexists.Fee                    = FeeModel.Fee;
             feexists.Date                   = FeeModel.Date;
             feexists.Status                 = FeeModel.Status;
             feexists.FeeTransactionNo       = FeeModel.FeeTransactionNo;
             dbContext.Entry(feexists).State = System.Data.Entity.EntityState.Modified;
             dbContext.SaveChanges();
             return(100);
         }
     }
     catch (Exception ex)
     {
         ErrorLogDal objError = new ErrorLogDal();
         ErrorLog    model    = new ErrorLog();
         model.InnerException = ex.InnerException.InnerException.Message.ToString();
         model.Source         = "Update One Time Fee";
         int error = objError.InsertError(model);
         return(400);
     }
 }
Ejemplo n.º 3
0
 public int CheckUser(string PhoneNumber)
 {
     try
     {
         var userexists = dbContext.Registers.Where(p => p.PhoneNumber == PhoneNumber).FirstOrDefault();
         if (userexists != null)
         {
             userexists.Status = "Hold";
             dbContext.Entry(userexists).State = System.Data.Entity.EntityState.Modified;
             dbContext.SaveChanges();
             return(200);
         }
         else
         {
             return(300);
         }
     }
     catch (Exception ex)
     {
         ErrorLogDal objError = new ErrorLogDal();
         ErrorLog    model    = new ErrorLog();
         model.InnerException = ex.InnerException.InnerException.Message.ToString();
         model.Source         = "Register-Check User";
         int error = objError.InsertError(model);
         return(400);
     }
 }
Ejemplo n.º 4
0
 public int UpdatePayment(LoanDetail LoanModel)
 {
     try
     {
         var loanexists = dbContext.LoanDetails.Where(l => l.PhoneNumber == LoanModel.PhoneNumber && l.LoanStatus == "Active").FirstOrDefault();
         if (loanexists == null)
         {
             return(300);
         }
         else
         {
             loanexists.PaymentDate            = LoanModel.PaymentDate;
             loanexists.PaymentReferenceNo     = LoanModel.PaymentReferenceNo;
             dbContext.Entry(loanexists).State = System.Data.Entity.EntityState.Modified;
             dbContext.SaveChanges();
             return(100);
         }
     }
     catch (Exception ex)
     {
         ErrorLogDal objError = new ErrorLogDal();
         ErrorLog    model    = new ErrorLog();
         model.InnerException = ex.InnerException.InnerException.Message.ToString();
         model.Source         = "Payment";
         int error = objError.InsertError(model);
         return(400);
     }
 }
Ejemplo n.º 5
0
 internal void UpdateStatus(string phoneNumber, string status)
 {
     try
     {
         GTLOANEntities dbContext = new GTLOANEntities();
         var            query     = dbContext.LoanDetails
                                    .Where(e => e.LoanStatus == "Active")
                                    .FirstOrDefault();
         query.LoanStatus             = status;
         dbContext.Entry(query).State = EntityState.Modified;
         dbContext.SaveChanges();
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Ejemplo n.º 6
0
        internal string Status(string PhoneNumber, string Status)
        {
            try
            {
                GTLOANEntities dbContext = new GTLOANEntities();

                var query = dbContext.OneTimeFees

                            .Where(p => p.PhoneNumber == PhoneNumber).FirstOrDefault();
                query.Status = Status;
                dbContext.Entry(query).State = EntityState.Modified;
                dbContext.SaveChanges();
                return("success");
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        internal string DisApprove(string Phonenumber)
        {
            try
            {
                GTLOANEntities dbContext = new GTLOANEntities();

                var query = dbContext.Registers

                            .Where(p => p.PhoneNumber == Phonenumber).FirstOrDefault();

                query.Status = "rejected";
                dbContext.Entry(query).State = EntityState.Modified;
                dbContext.SaveChanges();
                return("success");
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 8
0
        internal string Approve(string PhoneNumber, string Transaction)
        {
            try
            {
                GTLOANEntities dbContext = new GTLOANEntities();

                var query = dbContext.LoanDetails

                            .Where(p => p.PhoneNumber == PhoneNumber).FirstOrDefault();

                query.LoanStatus             = "Active";
                query.DueDate                = DateTime.Now.AddDays(+14);
                query.LoanTransactionNo      = Transaction;
                dbContext.Entry(query).State = EntityState.Modified;
                dbContext.SaveChanges();
                return("success");
            }
            catch (Exception ex)
            {
                throw;
            }
        }