/// <summary>
 /// Deprecated Method for adding a new object to the DailyIntrests EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDailyIntrests(DailyIntrest dailyIntrest)
 {
     base.AddObject("DailyIntrests", dailyIntrest);
 }
 /// <summary>
 /// Create a new DailyIntrest object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="loan_id">Initial value of the loan_id property.</param>
 public static DailyIntrest CreateDailyIntrest(global::System.Int32 id, global::System.Int32 loan_id)
 {
     DailyIntrest dailyIntrest = new DailyIntrest();
     dailyIntrest.id = id;
     dailyIntrest.loan_id = loan_id;
     return dailyIntrest;
 }
 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();
 }