Exemple #1
0
        public static int UpdateFeeCollection(FeeCollections newFee)
        {
            using (VedantaEntities ve = new VedantaEntities())
            {
                FeeCollections oldFee = ve.FeeCollections.FirstOrDefault(st => st.Id == newFee.Id);

                if (oldFee == null)
                {
                    return(-1);//Admission record not found.
                }
                newFee.AdmissionId = oldFee.AdmissionId;
                var updatedFee = ve.ApplyCurrentValues(oldFee.GetType().Name, newFee);
                return(ve.SaveChanges());
            }
        }
Exemple #2
0
        public static int UpdateStudentDetails(Students newStudent)
        {
            using (VedantaEntities ve = new VedantaEntities())
            {
                Students oldStudent = ve.Students.FirstOrDefault(st => st.ID == newStudent.ID);

                if (oldStudent == null)
                {
                    return(-1);//Student record not found.
                }
                //Updating Student Details
                //oldStudent.Age = newStudent.Age;
                //oldStudent.Cell = newStudent.Cell;
                //oldStudent.City = newStudent.City;
                //oldStudent.CountryId = newStudent.CountryId;
                //oldStudent.DOB = newStudent.DOB;
                //oldStudent.Email = newStudent.Email;
                //oldStudent.FamilyIncomeSlotId = newStudent.FamilyIncomeSlotId;
                //oldStudent.FatherName = newStudent.FatherName;
                //oldStudent.FirstName = newStudent.FirstName;
                //oldStudent.Gender = newStudent.Gender;
                //oldStudent.LastName = newStudent.LastName;
                //oldStudent.MaritalStatusId = newStudent.MaritalStatusId;
                //oldStudent.MiddleName = newStudent.MiddleName;
                //oldStudent.MotherName = newStudent.MotherName;
                //oldStudent.Mothertoungue = newStudent.Mothertoungue;
                //oldStudent.Nationality = newStudent.Nationality;
                //oldStudent.OccupationId = newStudent.OccupationId;
                //oldStudent.PAN = newStudent.PAN;
                //oldStudent.PassportNo = newStudent.PassportNo;
                //oldStudent.Phone = newStudent.Phone;
                //oldStudent.QualificationId = newStudent.QualificationId;
                //oldStudent.Religion = newStudent.Religion;
                //oldStudent.StateId = newStudent.StateId;
                //oldStudent.Street = newStudent.Street;
                //oldStudent.Street2 = newStudent.Street2;
                //oldStudent.UIDNo = newStudent.UIDNo;
                //oldStudent.Zip = newStudent.Zip;

                var updatedStudents = ve.ApplyCurrentValues(oldStudent.GetType().Name, newStudent);
                return(ve.SaveChanges());
                //return 1;
                //return ve.AcceptAllChanges(oldStudent.GetType().Name, newStudent);
            }
        }
Exemple #3
0
 public static int UpdateEmployee(Employees emp)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         if (emp != null)
         {
             var oldEmp = ve.Employees.FirstOrDefault(e => emp.EmployeeId.Equals(e.EmployeeId));
             if (oldEmp != null)
             {
                 if (emp.IsActive == null)
                 {
                     emp.IsActive    = oldEmp.IsActive;
                     emp.LastUpdated = DateTime.Now.Date;
                 }
                 ve.ApplyCurrentValues(oldEmp.GetType().Name, emp);
                 return(ve.SaveChanges());
             }
             //var clientWithNewValue = entity.Clients.FirstOrDefault(c => c.Id == oldClient.Id);
         }
         return(0);
     }
 }
Exemple #4
0
 public static int UpdateAdmissionDetails(Admissions newAdmission)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         Admissions oldAdmission = ve.Admissions.FirstOrDefault(st => st.Id == newAdmission.Id);
         if (oldAdmission == null)
         {
             return(-1);//Admission record not found.
         }
         FeeCollections fee = ve.FeeCollections.FirstOrDefault(fe => fe.AdmissionId == newAdmission.Id && fe.ManualreceiptNumber.Equals(oldAdmission.ManualReceiptNumber, StringComparison.OrdinalIgnoreCase));
         if (fee != null)
         {
             fee.Amount        = newAdmission.DownPayment;
             fee.Description   = newAdmission.Description;
             fee.TotalReceived = newAdmission.DownPayment;
             fee.PaymentDate   = newAdmission.AdmissionDate;
             fee.PaymentHeadId = 1;
             fee.PaymentModeId = newAdmission.PaymentModeId;
         }
         newAdmission.StudentId = oldAdmission.StudentId;
         var updatedAdmission = ve.ApplyCurrentValues(oldAdmission.GetType().Name, newAdmission);
         return(ve.SaveChanges());
     }
 }