Beispiel #1
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);
            }
        }
Beispiel #2
0
 public static List <vw_BatchList> GetBatchList(int clientId, int branchId)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return(ve.vw_BatchList.Where(bt => bt.ClientId == clientId && bt.BranchId == branchId).ToList());
     }
 }
Beispiel #3
0
 public static List <vw_BatchList> GetBatchList()
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return(ve.vw_BatchList.ToList());
     }
 }
Beispiel #4
0
 public static Batches GetBatchDetailsById(int id)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return(ve.Batches.FirstOrDefault(b => b.Id == id));
     }
 }
Beispiel #5
0
 public static List <vw_CourseBrands> GetCourseBrands(int clientId, int?branchId)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             if (branchId != null)
             {
                 // Course List of Selected school
                 return((from courseBrands in ve.vw_CourseBrands
                         where courseBrands.ClientId == clientId && courseBrands.BranchId == (int)branchId
                         select courseBrands).ToList());
             }
             else
             {
                 // Course List of all schools
                 return((from courseBrands in ve.vw_CourseBrands
                         where courseBrands.ClientId == clientId
                         select courseBrands).ToList());
             }
         }
     }
     catch
     {
         return(null);
     }
 }
Beispiel #6
0
 public static List <vw_Users_Lists> GetUsersList()
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return(ve.vw_Users_Lists.ToList());
     }
 }
Beispiel #7
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);
 }
Beispiel #8
0
 public static List <vw_Users_Lists> GetUsersList(int clientId, int zoneId, int regionId)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return(ve.vw_Users_Lists.Where(ul => ul.ClientId == clientId && ul.ZoneId == zoneId && ul.RegionId == regionId).ToList());
     }
 }
Beispiel #9
0
        public static List <SearchedEmployees> GetSearchedEmployeesList(string searchText)
        {
            using (VedantaEntities ve = new VedantaEntities())
            {
                List <SearchedEmployees> empAll =
                    (from empls in ve.vw_Employees
                     where (
                         empls.EmployeeId.StartsWith(searchText) ||
                         empls.FirstName.StartsWith(searchText) ||
                         empls.LastName.StartsWith(searchText) ||
                         empls.City.StartsWith(searchText) ||
                         empls.BranchName.StartsWith(searchText) ||
                         empls.BranchCode.StartsWith(searchText) ||
                         empls.RankName.StartsWith(searchText) ||
                         empls.State.StartsWith(searchText)
                         )
                     select new SearchedEmployees
                {
                    Name = (empls.FirstName + " " + (empls.MiddleName ?? string.Empty) + " " + (empls.LastName ?? string.Empty)),
                    Id = empls.EmployeeId,
                    City = empls.City,
                    State = empls.State,
                    Branch = empls.BranchName,
                    Designation = empls.RankName
                }).ToList();

                return(empAll);
            }
        }
Beispiel #10
0
 public static vw_Users_Lists GetUserDetailsByUserName(string usrName)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return(ve.vw_Users_Lists.FirstOrDefault(u => u.UserName.Equals(usrName, StringComparison.OrdinalIgnoreCase)));
     }
 }
Beispiel #11
0
 public static List <vw_Courses> GetCourses(int clientId, int courseBrandId, int?schoolId)
 {
     try
     {
         using (VedantaEntities islObject = new VedantaEntities())
         {
             if (schoolId != null)
             {
                 // Course List of Selected school
                 return((from courses in islObject.vw_Courses
                         where courses.ClientId == clientId && courses.CourseBrandId == courseBrandId && courses.BranchId == (int)schoolId
                         select courses).ToList());
             }
             else
             {
                 // Course List of all schools
                 return((from courses in islObject.vw_Courses
                         where courses.ClientId == clientId && courses.CourseBrandId == courseBrandId
                         select courses).ToList());
             }
         }
     }
     catch
     {
         return(null);
     }
 }
Beispiel #12
0
        public static List <vw_PaymentList> GetPaymentList(int clinetId, int branchId, int paymentType, bool isBranchSession = false)
        {
            using (VedantaEntities deo = new VedantaEntities())
            {
                bool           canSeeFrenchisesRecord = false;
                ClientSettings clientSettings         = deo.ClientSettings.FirstOrDefault(cs => cs.ClientId == clinetId);
                if (clientSettings != null)
                {
                    canSeeFrenchisesRecord = clientSettings.CanSeeFrenchisesAccount ?? true;
                }

                if (isBranchSession == true || canSeeFrenchisesRecord == true)
                {
                    return((from payment in deo.vw_PaymentList
                            where payment.ClientId == clinetId && payment.LedgerTypeId == paymentType &&
                            payment.BranchId == branchId
                            select payment).ToList());
                }
                else
                {
                    return((from payment in deo.vw_PaymentList
                            where payment.ClientId == clinetId && payment.LedgerTypeId == paymentType &&
                            payment.BranchId == branchId && payment.BranchTypeId == 1
                            select payment).ToList());
                }
            }
        }
Beispiel #13
0
        public static SelectList GetRoleList(string[] rolesToHide)
        {
            using (VedantaEntities ve = new VedantaEntities())
            {
                // string showAdmin = System.Web.Configuration.WebConfigurationManager.AppSettings["ShowAdminRole"];

                List <UserRoles> rolesList = new List <UserRoles>();
                if (rolesToHide != null && rolesToHide.Count() > 0)
                {
                    rolesList = (from roles in ve.aspnet_Roles
                                 where !rolesToHide.Contains(roles.LoweredRoleName)
                                 select new UserRoles {
                        RoleId = roles.RoleId, UserRole = roles.RoleName
                    }
                                 ).ToList();
                }
                else
                {
                    rolesList = (from roles in ve.aspnet_Roles
                                 select new UserRoles {
                        RoleId = roles.RoleId, UserRole = roles.RoleName
                    }
                                 ).ToList();
                }
                return(new SelectList(rolesList, "roleId", "UserRole"));
            }
        }
Beispiel #14
0
 public static EXPENSESHEAD GetLedgerDetailsByLedgerId(int expId)
 {
     using (VedantaEntities deo = new VedantaEntities())
     {
         return(deo.EXPENSESHEAD.FirstOrDefault(exp => exp.Id == expId));
     }
 }
Beispiel #15
0
        public static List <vw_PaymentList> GetHeadWisePaymentList(int clinetId, int paymentType, int headId, DateTime fromDate, DateTime DateTo)
        {
            using (VedantaEntities deo = new VedantaEntities())
            {
                bool           canSeeFrenchisesRecord = false;
                ClientSettings clientSettings         = deo.ClientSettings.FirstOrDefault(cs => cs.ClientId == clinetId);
                if (clientSettings != null)
                {
                    canSeeFrenchisesRecord = clientSettings.CanSeeFrenchisesAccount ?? true;
                }

                if (canSeeFrenchisesRecord == false)
                {
                    return((from payment in deo.vw_PaymentList
                            where payment.ClientId == clinetId && payment.LedgerTypeId == paymentType && payment.ExpenseHeadId == headId &&
                            (payment.BranchId == null || (payment.BranchId != null && payment.BranchTypeId == 1)) &&
                            payment.Date >= fromDate.Date &&
                            payment.Date <= DateTo.Date
                            select payment).ToList());
                }
                else
                {
                    return((from payment in deo.vw_PaymentList
                            where payment.ClientId == clinetId && payment.LedgerTypeId == paymentType && payment.ExpenseHeadId == headId &&
                            payment.Date >= fromDate.Date &&
                            payment.Date <= DateTo.Date
                            select payment).ToList());
                }
            }
        }
Beispiel #16
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);
 }
Beispiel #17
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);
         }
     }
 }
Beispiel #18
0
 public static List <vw_PaymentList> GetExpenseSummary(int clinetId, int branchId, int paymentType)
 {
     using (VedantaEntities deo = new VedantaEntities())
     {
         //   return deo.vw_PaymentList.Where(pl => pl.ClientId == clinetId && pl.BranchId == branchId && pl.LedgerTypeId == paymentType).GroupBy(p => new { p.Date, p.ExpenseHeadName }).ToList();
     }
     return(null);
 }
Beispiel #19
0
 public static List <vw_ExpenseHeads> GetLedgerMasterList()
 {
     using (VedantaEntities deo = new VedantaEntities())
     {
         return((from ledger in deo.vw_ExpenseHeads
                 select ledger).OrderBy(ld => ld.LedgerType).ToList());
     }
 }
Beispiel #20
0
 public static List <vw_Student_Lists> GetStudentsList()
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return((from stds in ve.vw_Student_Lists
                 select stds).ToList());
     }
 }
Beispiel #21
0
 public static int PayStudentFees(FeeCollections newFees)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         ve.AddToFeeCollections(newFees);
         return(ve.SaveChanges());
     }
 }
Beispiel #22
0
 public static List <vw_Branches> GetBranchesList()
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return((from br in ve.vw_Branches
                 select br).ToList());
     }
 }
Beispiel #23
0
 public static List <vw_FeeCollections> GetStudentsPaidFeesByAdmissionId(int admissionId)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return((from stds in ve.vw_FeeCollections
                 where stds.AdmissionId == admissionId
                 select stds).ToList());
     }
 }
Beispiel #24
0
 public static List <vw_Admissions> GetStudentsListByCourseId(int courseId)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return((from stds in ve.vw_Admissions
                 where stds.CourseId == courseId
                 select stds).ToList());
     }
 }
Beispiel #25
0
 public static List <vw_Student_Lists> GetClientStudentsList(int clientId)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return((from stds in ve.vw_Student_Lists
                 where stds.ClientId == clientId
                 select stds).ToList());
     }
 }
Beispiel #26
0
 public static List <vw_Branches> GetBranchesList(int clientId)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return((from br in ve.vw_Branches
                 where br.ClientId == clientId
                 select br).ToList());
     }
 }
Beispiel #27
0
        public static int IndiaCountryCode = GetDefaultCountryCode(); //for India;

        public static int GetDefaultCountryCode()
        {
            using (VedantaEntities islObject = new VedantaEntities())
            {
                int defaultCountryCode = 0;
                defaultCountryCode = islObject.Countries.FirstOrDefault(cn => cn.Name == "India").Id;
                return(defaultCountryCode);
            }
        }
Beispiel #28
0
        public static List <vw_Employees> GetEmployeesList(string searchText, int?clientId, int?branchId)
        {
            using (VedantaEntities ve = new VedantaEntities())
            {
                List <vw_Employees> evar = new List <vw_Employees>();

                if (clientId == null && branchId == null)
                {
                    evar = (from empls in ve.vw_Employees
                            where (empls.EmployeeId.StartsWith(searchText) ||
                                   empls.FirstName.StartsWith(searchText) ||
                                   empls.LastName.StartsWith(searchText) ||
                                   empls.City.StartsWith(searchText) ||
                                   empls.BranchName.StartsWith(searchText) ||
                                   empls.BranchCode.StartsWith(searchText) ||
                                   empls.RankName.StartsWith(searchText) ||
                                   empls.State.StartsWith(searchText)
                                   )
                            select empls).ToList();
                }
                else
                {
                    if (branchId == null)
                    {
                        evar = (from empls in ve.vw_Employees
                                where empls.ClientId == clientId &&
                                (empls.EmployeeId.StartsWith(searchText) ||
                                 empls.FirstName.StartsWith(searchText) ||
                                 empls.LastName.StartsWith(searchText) ||
                                 empls.City.StartsWith(searchText) ||
                                 empls.BranchName.StartsWith(searchText) ||
                                 empls.BranchCode.StartsWith(searchText) ||
                                 empls.RankName.StartsWith(searchText) ||
                                 empls.State.StartsWith(searchText)
                                )
                                select empls).ToList();
                    }
                    else
                    {
                        evar = (from empls in ve.vw_Employees
                                where empls.ClientId == clientId && empls.BranchId == branchId &&
                                (empls.EmployeeId.StartsWith(searchText) ||
                                 empls.FirstName.StartsWith(searchText) ||
                                 empls.LastName.StartsWith(searchText) ||
                                 empls.City.StartsWith(searchText) ||
                                 empls.BranchName.StartsWith(searchText) ||
                                 empls.BranchCode.StartsWith(searchText) ||
                                 empls.RankName.StartsWith(searchText) ||
                                 empls.State.StartsWith(searchText)
                                )
                                select empls).ToList();
                    }
                }

                return(evar);
            }
        }
Beispiel #29
0
 public static int GetRegionZoneId(int regionId)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         RegionalOffices rn     = ve.RegionalOffices.FirstOrDefault(br => br.Id == regionId);
         int             zoneId = (rn != null ? rn.ZonalOfficeId.Value : 0);
         return(zoneId);
     }
 }
Beispiel #30
0
 public static List <vw_Employees> GetEmployeesList(int clientId, int branchId)
 {
     using (VedantaEntities ve = new VedantaEntities())
     {
         return((from empl in ve.vw_Employees
                 where empl.IsActive == true && empl.ClientId == clientId && empl.BranchId == branchId
                 select empl).ToList());
     }
 }