/// <summary>
 /// Deprecated Method for adding a new object to the Loans EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLoans(Loan loan)
 {
     base.AddObject("Loans", loan);
 }
 /// <summary>
 /// Create a new Loan object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="user_id">Initial value of the user_id property.</param>
 /// <param name="loantype_id">Initial value of the loantype_id property.</param>
 /// <param name="amoutn">Initial value of the amoutn property.</param>
 /// <param name="intrest">Initial value of the intrest property.</param>
 /// <param name="status">Initial value of the status property.</param>
 /// <param name="startdate">Initial value of the startdate property.</param>
 /// <param name="enddate">Initial value of the enddate property.</param>
 public static Loan CreateLoan(global::System.Int32 id, global::System.Int32 user_id, global::System.Int32 loantype_id, global::System.Int32 amoutn, global::System.Int32 intrest, global::System.Boolean status, global::System.DateTime startdate, global::System.DateTime enddate)
 {
     Loan loan = new Loan();
     loan.id = id;
     loan.user_id = user_id;
     loan.loantype_id = loantype_id;
     loan.amoutn = amoutn;
     loan.intrest = intrest;
     loan.status = status;
     loan.startdate = startdate;
     loan.enddate = enddate;
     return loan;
 }
 public static void saveLoan(int user_id,
     int authrized_user_id,
     int surity_id,
     int intrest,
     int amount,
     bool status,
     int loan_type,
     DateTime startdate,
     DateTime enddate,
     int period = 0,
     DateTime duedate = new DateTime())
 {
     Loan loan = new Loan();
     loan.intrest = intrest;
     loan.amoutn = amount;
     loan.status = status;
     loan.user_id = user_id;
     loan.approved = authrized_user_id;
     loan.startdate = startdate;
     loan.enddate = enddate;
     loan.loantype_id = loan_type;
     entity.AddToLoans(loan);
     if (loan_type == 1)
     {
         DailyIntrest dailyIntrest = new DailyIntrest();
         dailyIntrest.loan_id = loan.id;
         dailyIntrest.surety = surity_id;
         entity.AddToDailyIntrests(dailyIntrest);
     }
     else
     {
         Finance finance = new Finance();
         finance.duedate = duedate;
         finance.loan_id = loan.id;
         finance.period = period;
         entity.AddToFinances(finance);
     }
     entity.SaveChanges();
 }