Ejemplo n.º 1
0
        public static int ProocessNewStudentAddmission(Students newStudent, Admissions newAdmission, FeeCollections newFeeCollection)
        {
            using (VedantaEntities ve = new VedantaEntities())
            {
                Students oldStudent = ve.Students.FirstOrDefault(st => st.ID == newStudent.ID);

                int newStudentId = 0; int oldStudentId = 0;
                //Add A New Student Record in DataBase if that student does not exists
                if (oldStudent == null)
                {
                    newStudent.CreatedDate = DateTime.Now.Date;
                    ve.AddToStudents(newStudent);
                    ve.SaveChanges();
                    newStudentId = newStudent.ID;
                }
                else
                {
                    oldStudentId = oldStudent.ID;
                }

                //If Student is already enrolled with us then no need to add new record for same student
                if (newStudentId == 0 && oldStudentId > 0)
                {
                    newStudentId = oldStudentId;
                }

                if (newStudentId > 0)
                {
                    newAdmission.StudentId = newStudentId;

                    Admissions oldAdmission = ve.Admissions.FirstOrDefault(ad => ad.StudentId == newStudentId && ad.CourseId == newAdmission.CourseId);
                    if (oldAdmission == null)
                    {
                        ve.AddToAdmissions(newAdmission);
                        int admResult = ve.SaveChanges();
                        return(admResult);
                        //if (admResult > 0)   //Admission of Student done successfully.
                        //{
                        //    newFeeCollection.AdmissionId = newAdmission.Id;
                        //    ve.AddToFeeCollections(newFeeCollection);
                        //    return ve.SaveChanges(); //Admission Fee Paid successfully.
                        //}
                        //else
                        //    return -2;
                    }
                    else
                    {
                        return(-2); //Student Record Entered but failed to take Admission of student.
                    }
                }
                else
                {
                    return(-1); //Student Record not entered;
                }
            }
        }
Ejemplo n.º 2
0
 public static int EditPayment(Payments payment)
 {
     using (VedantaEntities deo = new VedantaEntities())
     {
         if (payment != null)
         {
             Payments oldPayment = deo.Payments.FirstOrDefault(py => py.Id == payment.Id);
             if (oldPayment != null)
             {
                 Payments existingPayment = deo.Payments.FirstOrDefault(py => py.BranchId == payment.BranchId && py.Id != payment.Id && payment.Date == py.Date && payment.VoucherNo.Equals(py.VoucherNo, StringComparison.OrdinalIgnoreCase));
                 if (existingPayment == null)
                 {
                     oldPayment.Amounts       = payment.Amounts;
                     oldPayment.BANK          = payment.BANK;
                     oldPayment.BranchId      = payment.BranchId;
                     oldPayment.CHQ_DATE      = payment.CHQ_DATE;
                     oldPayment.CHQ_NO        = payment.CHQ_NO;
                     oldPayment.Date          = payment.Date;
                     oldPayment.ExpenseHeadId = payment.ExpenseHeadId;
                     oldPayment.Narration     = payment.Narration;
                     oldPayment.PaidTo        = payment.PaidTo;
                     oldPayment.PaymentModeId = payment.PaymentModeId;
                     oldPayment.Remarks       = payment.Remarks;
                     oldPayment.VoucherNo     = payment.VoucherNo;
                     return(deo.SaveChanges());
                 }
                 else
                 {
                     return(-1);//same voucher number and same date exits for this branch.
                 }
             }
         }
     }
     return(0);
 }
Ejemplo n.º 3
0
 public static int UpdateAsset(int id, Assets asset)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             Assets updated = ve.Assets.FirstOrDefault(jc => jc.Id == id);
             if (updated != null)
             {
                 updated.Code               = asset.Code;
                 updated.Name               = asset.Name;
                 updated.PurchasedDate      = asset.PurchasedDate;
                 updated.LastRepaireDate    = asset.LastRepaireDate;
                 updated.LastAuditDate      = asset.LastAuditDate;
                 updated.IsWorking          = asset.IsWorking;
                 updated.BranchId           = asset.BranchId;
                 updated.WarrantyExpiryDate = asset.WarrantyExpiryDate;
                 updated.AMC_Reporesntative = asset.AMC_Reporesntative;
                 updated.AMC_Phone          = asset.AMC_Phone;
                 updated.AMC_Email          = asset.AMC_Email;
                 updated.AMC_Address        = asset.AMC_Address;
                 return(ve.SaveChanges());
             }
         }
     }
     catch
     {
         return(0);
     }
     return(0);
 }
Ejemplo n.º 4
0
        public static int UpdateBatch(Batches batch)
        {
            using (VedantaEntities ve = new VedantaEntities())
            {
                //Batches oldBatch = ve.Batches.FirstOrDefault(bt => bt.Id != batch.Id && !bt.BatchCode.Equals(batch.BatchCode, StringComparison.OrdinalIgnoreCase));
                //if (oldBatch == null)
                //{
                Batches currentBatch = ve.Batches.FirstOrDefault(bt => bt.Id == batch.Id);
                if (currentBatch != null)
                {
                    currentBatch.BatchCode       = batch.BatchCode;
                    currentBatch.BatchStartTime  = batch.BatchStartTime;
                    currentBatch.BatchEndTime    = batch.BatchEndTime;
                    currentBatch.BatchName       = batch.BatchName;
                    currentBatch.StudentStrength = batch.StudentStrength;
                    int result = ve.SaveChanges();
                    if (result > 0)
                    {
                        return(result);
                    }
                }

                //}
                return(0);
            }
        }
Ejemplo n.º 5
0
 public static int AddEmployee(Employees emp)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         Employees oldEmp = ve.Employees.FirstOrDefault(e => emp.EmployeeId.Equals(e.EmployeeId));
         if (oldEmp == null)
         {
             if (emp.BranchId != null)
             {
                 Utilities.BranchRegionZones brz = Utilities.GetRegionAndZoneByBranchId(emp.BranchId.Value);
                 if (brz != null && brz.ZoneId > 0 && brz.RegionId > 0)
                 {
                     emp.RegionId = brz.RegionId;
                     emp.ZoneId   = brz.ZoneId;
                 }
             }
             if (emp.RegionId != null)
             {
                 emp.ZoneId = Utilities.GetRegionZoneId(emp.RegionId.Value);
             }
             emp.IsActive    = true;
             emp.CreatedDate = DateTime.Now.Date;
             ve.AddToEmployees(emp);
             return(ve.SaveChanges());
         }
         else
         {
             return(-1);
         }
     }
 }
Ejemplo n.º 6
0
 public static int UpdateCourse(int id, Courses course)
 {
     try
     {
         using (VedantaEntities islObject = new VedantaEntities())
         {
             Courses updated = islObject.Courses.FirstOrDefault(jc => jc.Id == id);
             if (updated != null)
             {
                 updated.CourseName                  = course.CourseName;
                 updated.Duration_In_Months          = course.Duration_In_Months;
                 updated.FastTrackDuration           = course.FastTrackDuration;
                 updated.CourseFees                  = course.CourseFees;
                 updated.MinimumDownPayment          = course.MinimumDownPayment;
                 updated.MaximumDiscountAmount       = course.MaximumDiscountAmount;
                 updated.MaximumNumberOfInstallments = course.MaximumNumberOfInstallments;
                 updated.InstallmentAmount           = course.InstallmentAmount;
                 updated.CourseCode                  = course.CourseCode;
                 updated.TotalInstallmentAmount      = course.TotalInstallmentAmount;
                 return(islObject.SaveChanges());
             }
         }
     }
     catch
     {
         return(0);
     }
     return(0);
 }
Ejemplo n.º 7
0
 public static int PayStudentFees(FeeCollections newFees)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         ve.AddToFeeCollections(newFees);
         return(ve.SaveChanges());
     }
 }
Ejemplo n.º 8
0
 public static int SaveClientSettings(ClientSettings clientSetting)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             ClientSettings oldSetting = ve.ClientSettings.FirstOrDefault(cl => cl.ClientId == clientSetting.ClientId);
             if (oldSetting != null)
             {
                 //updating the existing settings
                 oldSetting.IsEducationServiceAvailable          = clientSetting.IsEducationServiceAvailable;
                 oldSetting.IsAssetServiceAvailable              = clientSetting.IsAssetServiceAvailable;
                 oldSetting.IsBusServiceAvailable                = clientSetting.IsBusServiceAvailable;
                 oldSetting.IsCerificateServiceAvailable         = clientSetting.IsCerificateServiceAvailable;
                 oldSetting.IsDebtorCreditotsServiceAvailable    = clientSetting.IsDebtorCreditotsServiceAvailable;
                 oldSetting.IsDemoClassServiceAvailable          = clientSetting.IsDemoClassServiceAvailable;
                 oldSetting.IsEnquiryServiceAvailable            = clientSetting.IsEnquiryServiceAvailable;
                 oldSetting.IsHostelServiceAvailable             = clientSetting.IsHostelServiceAvailable;
                 oldSetting.IsJobServiceAvailable                = clientSetting.IsJobServiceAvailable;
                 oldSetting.IsOfficeExpenseServiceAvailable      = clientSetting.IsOfficeExpenseServiceAvailable;
                 oldSetting.IsSMSServiceAvailable                = clientSetting.IsSMSServiceAvailable;
                 oldSetting.IsStudyMaterialServiceAvailable      = clientSetting.IsStudyMaterialServiceAvailable;
                 oldSetting.MaximumNumberOfCourseBrandsPerSchool = clientSetting.MaximumNumberOfCourseBrandsPerSchool;
                 oldSetting.MaximumNumberOfUsersPerSchool        = clientSetting.MaximumNumberOfUsersPerSchool;
                 oldSetting.SMSurl    = clientSetting.SMSurl;
                 oldSetting.SMSUserId = clientSetting.SMSUserId;
                 oldSetting.SMSPwd    = clientSetting.SMSPwd;
                 return(ve.SaveChanges());
             }
             else
             {
                 //create new settings
                 ve.AddToClientSettings(clientSetting);
                 return(ve.SaveChanges());
             }
         }
     }
     catch
     {
         return(0);
     }
 }
Ejemplo n.º 9
0
        //==============================================================


        #region SMS
        public static int SendSMS(SMSNotices newSmsNotice)
        {
            using (VedantaEntities ve = new VedantaEntities())
            {
                if (newSmsNotice != null)
                {
                    ve.AddToSMSNotices(newSmsNotice);
                    return(ve.SaveChanges());
                }
                return(0);
            }
        }
Ejemplo n.º 10
0
 public static int DeletePaymentsById(int id)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         Payments oldPayment = ve.Payments.FirstOrDefault(cs => cs.Id == id);
         if (oldPayment != null)
         {
             ve.DeleteObject(oldPayment);
             return(ve.SaveChanges());
         }
         return(0);
     }
 }
Ejemplo n.º 11
0
 public static int DeleteEmployee(int clientId, string empId)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         Employees oldEmp = ve.Employees.FirstOrDefault(e => empId.Equals(e.EmployeeId, StringComparison.OrdinalIgnoreCase));
         if (oldEmp != null)
         {
             oldEmp.IsActive = false;
             return(ve.SaveChanges());
         }
         return(0);
     }
 }
Ejemplo n.º 12
0
 public static int CreateAsset(Assets asset)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             ve.AddToAssets(asset);
             return(ve.SaveChanges());
         }
     }
     catch (Exception)
     {
         return(0);
     }
 }
Ejemplo n.º 13
0
 public static int CreateNewBatch(Batches newBatch)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             ve.AddToBatches(newBatch);
             return(ve.SaveChanges());
         }
     }
     catch (Exception)
     {
         return(0);
     }
 }
Ejemplo n.º 14
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());
            }
        }
Ejemplo n.º 15
0
 public static int CreateClient(Clients client)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             ve.AddToClients(client);
             return(ve.SaveChanges());
         }
     }
     catch (Exception)
     {
         return(0);
     }
 }
Ejemplo n.º 16
0
 public static int AddBranch(Branches newBr)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         Branches oldBr = ve.Branches.FirstOrDefault(e => e.BranchCode == newBr.BranchCode && e.ClientId == newBr.ClientId);
         if (oldBr == null)
         {
             newBr.IsActive = true;
             ve.AddToBranches(newBr);
             return(ve.SaveChanges());
         }
         else
         {
             return(-1);
         }
     }
 }
Ejemplo n.º 17
0
 public static int DeleteLedgerByLedgerId(int id)
 {
     using (VedantaEntities islObject = new VedantaEntities())
     {
         Payments payment = islObject.Payments.FirstOrDefault(pmt => pmt.ExpenseHeadId == id);
         if (payment == null)
         {
             EXPENSESHEAD ledger = islObject.EXPENSESHEAD.FirstOrDefault(rk => rk.Id == id);
             if (ledger != null)
             {
                 islObject.DeleteObject(ledger);
                 return(islObject.SaveChanges());
             }
         }
         return(0);
     }
 }
Ejemplo n.º 18
0
 public static int ActivateBranch(int id, bool isActivating = false)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         Branches oldBr = ve.Branches.FirstOrDefault(e => e.Id == id);
         if (oldBr != null)
         {
             oldBr.IsActive        = isActivating;
             oldBr.LastUpdatedDate = DateTime.Now.Date;
             return(ve.SaveChanges());
         }
         else
         {
             return(-1);
         }
     }
 }
Ejemplo n.º 19
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);
            }
        }
Ejemplo n.º 20
0
 public static int ActivateClient(int id, bool isActive = false)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             Clients updated = ve.Clients.FirstOrDefault(cl => cl.Id == id);
             if (updated != null)
             {
                 return(ve.SaveChanges());
             }
         }
     }
     catch
     {
         return(0);
     }
     return(0);
 }
Ejemplo n.º 21
0
        public static int UpdateBranchDetails(Branches newBr)
        {
            using (VedantaEntities ve = new VedantaEntities())
            {
                Branches oldBr = ve.Branches.FirstOrDefault(e => e.Id == newBr.Id);
                if (oldBr != null)
                {
                    oldBr.BranchTypeId = newBr.BranchTypeId;
                    oldBr.BranchCode   = newBr.BranchCode;
                    oldBr.BranchName   = newBr.BranchName;
                    oldBr.Address1     = newBr.Address1;
                    oldBr.Address2     = newBr.Address2;
                    oldBr.City         = newBr.City;
                    oldBr.PIN          = newBr.PIN;
                    oldBr.StateId      = newBr.StateId;
                    oldBr.CountryId    = newBr.CountryId;
                    oldBr.Phones       = newBr.Phones;
                    oldBr.Email        = newBr.Email;
                    oldBr.Fax          = newBr.Fax;

                    if (newBr.RegionalOfficeId != null)
                    {
                        oldBr.RegionalOfficeId = newBr.RegionalOfficeId;
                    }
                    if (newBr.ZonalOfficeId != null)
                    {
                        oldBr.ZonalOfficeId = newBr.ZonalOfficeId;
                    }
                    oldBr.CreatedDate     = newBr.CreatedDate;
                    oldBr.IsActive        = newBr.IsActive;
                    oldBr.LastUpdatedDate = DateTime.Now.Date;
                    oldBr.Remarks         = newBr.Remarks;

                    oldBr.Logo        = newBr.Logo;
                    oldBr.ContentType = newBr.ContentType;
                    return(ve.SaveChanges());
                }
                else
                {
                    return(-1);
                }
            }
        }
Ejemplo n.º 22
0
 public static int CloseBranch(Branches newBr)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         Branches oldBr = ve.Branches.FirstOrDefault(e => e.Id == newBr.Id);
         if (oldBr != null)
         {
             oldBr.IsActive        = newBr.IsActive;
             oldBr.LastUpdatedDate = DateTime.Now.Date;
             oldBr.Remarks         = newBr.Remarks;
             oldBr.ClosingDate     = newBr.ClosingDate;
             return(ve.SaveChanges());
         }
         else
         {
             return(-1);
         }
     }
 }
Ejemplo n.º 23
0
 //=====================================================================
 #region Ledgers
 public static int CreateLedger(EXPENSESHEAD ledger)
 {
     using (VedantaEntities deo = new VedantaEntities())
     {
         EXPENSESHEAD oldLedger = deo.EXPENSESHEAD.FirstOrDefault(exp => exp.ClientId == ledger.ClientId && ledger.CODE.Equals(exp.CODE, StringComparison.OrdinalIgnoreCase));
         if (oldLedger != null)
         {
             return(0);
         }
         else
         {
             if (ledger != null)
             {
                 deo.AddToEXPENSESHEAD(ledger);
                 return(deo.SaveChanges());
             }
         }
     }
     return(0);
 }
Ejemplo n.º 24
0
 public static int CreatePayment(Payments payment)
 {
     using (VedantaEntities deo = new VedantaEntities())
     {
         if (payment != null)
         {
             Payments oldPayments = deo.Payments.FirstOrDefault(py => py.BranchId == payment.BranchId && payment.Date == py.Date && payment.VoucherNo.Equals(py.VoucherNo, StringComparison.OrdinalIgnoreCase));
             if (oldPayments == null)
             {
                 deo.AddToPayments(payment);
                 return(deo.SaveChanges());
             }
             else
             {
                 return(-1);
             }
         }
     }
     return(0);
 }
Ejemplo n.º 25
0
 public static int UpdateClient(int id, Clients client, bool isAdmin = false)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             Clients updated = ve.Clients.FirstOrDefault(cl => cl.Id == id);
             if (updated != null)
             {
                 updated.Name        = client.Name;
                 updated.Lane        = client.Lane;
                 updated.Street      = client.Street;
                 updated.City        = client.City;
                 updated.StateId     = client.StateId;
                 updated.Zip         = client.Zip;
                 updated.Phone1      = client.Phone1;
                 updated.Phone2      = client.Phone2;
                 updated.Cell        = client.Cell;
                 updated.Email       = client.Email;
                 updated.Website     = client.Website;
                 updated.LastUpdated = DateTime.Now;
                 updated.Logo        = client.Logo;
                 updated.ContentType = updated.ContentType;
                 if (isAdmin)
                 {
                     updated.CreateDate        = client.CreateDate;
                     updated.ContractStartDate = client.ContractStartDate;
                     updated.ContractEndDate   = client.ContractEndDate;
                 }
                 return(ve.SaveChanges());
             }
         }
     }
     catch
     {
         return(0);
     }
     return(0);
 }
Ejemplo n.º 26
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);
     }
 }
Ejemplo n.º 27
0
 public static int CreateCourseBrand(CourseBrands courseBrand)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             CourseBrands oldBrand = ve.CourseBrands.FirstOrDefault(cb => cb.BranchId == courseBrand.BranchId && courseBrand.Name.Equals(cb.Name, StringComparison.OrdinalIgnoreCase));
             if (oldBrand == null)
             {
                 ve.AddToCourseBrands(courseBrand);
                 return(ve.SaveChanges());
             }
             else
             {
                 return(0);
             }
         }
     }
     catch (Exception)
     {
         return(0);
     }
 }
Ejemplo n.º 28
0
 public static int CreateCourse(Courses course)
 {
     try
     {
         using (VedantaEntities islObject = new VedantaEntities())
         {
             Courses oldCourse = islObject.Courses.FirstOrDefault(c => c.ClientId == course.ClientId && c.CourseBrandId == course.CourseBrandId && course.CourseCode.Equals(c.CourseCode, StringComparison.OrdinalIgnoreCase));
             if (oldCourse == null)
             {
                 islObject.AddToCourses(course);
                 return(islObject.SaveChanges());
             }
             else
             {
                 return(0);
             }
         }
     }
     catch (Exception)
     {
         return(0);
     }
 }
Ejemplo n.º 29
0
 public static int UpdateLedger(int ledgerId, EXPENSESHEAD newledger)
 {
     using (VedantaEntities deo = new VedantaEntities())
     {
         EXPENSESHEAD oldLedger = deo.EXPENSESHEAD.FirstOrDefault(exp => newledger.CODE.Equals(exp.CODE, StringComparison.OrdinalIgnoreCase));
         if (oldLedger != null)
         {
             EXPENSESHEAD oldledger = deo.EXPENSESHEAD.FirstOrDefault(rk => rk.Id == ledgerId);
             if (oldledger != null && newledger != null)
             {
                 oldledger.CODE         = newledger.CODE;
                 oldledger.NAME         = newledger.NAME;
                 oldledger.LedgerTypeId = newledger.LedgerTypeId;
                 oldledger.OP_BAL       = newledger.OP_BAL;
                 return(deo.SaveChanges());
             }
         }
         else
         {
             return(0);
         }
     }
     return(0);
 }
Ejemplo n.º 30
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());
     }
 }