Esempio n. 1
0
        public int CreateRequisition(TblRequisition tblRequisition)
        {
            tblRequisition.IsActive               = true;
            tblRequisition.CreatedDate            = DateTime.Now;
            tblRequisition.CreatedBy              = CurrentContext.EmployeeID;
            tblRequisition.Status                 = RequisitionStatus.Open;
            tblRequisition.ManagerEmployeeId      = dbContext.TblEmployees.AsNoTracking().Where(r => r.EmployeeId == CurrentContext.EmployeeID).FirstOrDefault().ReportingManagerId;
            tblRequisition.CurrentOwner           = dbContext.TblEmployees.AsNoTracking().Where(r => r.EmployeeId == tblRequisition.ManagerEmployeeId).FirstOrDefault().EmployeeName;
            dbContext.Entry(tblRequisition).State = EntityState.Added;
            dbContext.TblRequisition.Add(tblRequisition);
            int result = dbContext.SaveChanges();

            dbContext.Entry(tblRequisition).State = EntityState.Detached;
            foreach (TblRequisitionSkillMapping mapping in tblRequisition.TblRequisitionSkillMapping)
            {
                mapping.RequisitionId = tblRequisition.RequistionId;
                dbContext.TblRequisitionSkillMapping.Add(mapping);
            }
            dbContext.SaveChanges();
            var obj = dbContext.TblRequisition.AsNoTracking().Where(r => r.RequistionId == tblRequisition.RequistionId).Include(r => r.Department).Include(r => r.Designation).Include(r => r.TblRequisitionSkillMapping).FirstOrDefault();

            if (result > 0)
            {
                SendRequisitionRaisedMail(obj);
            }
            dbContext.Entry(obj).State = EntityState.Detached;
            return(result);
        }
Esempio n. 2
0
        public int CreateDepartment(TblDepartmentMaster tblDepartment)
        {
            if (dbContext.TblDepartmentMaster.Where(r => r.Department.ToUpper() == tblDepartment.Department.ToUpper() && r.IsActive == true).Count() > 0)
            {
                return(-1);
            }
            tblDepartment.IsActive = true;
            dbContext.Entry(tblDepartment).State = EntityState.Added;
            dbContext.TblDepartmentMaster.Add(tblDepartment);
            int result = dbContext.SaveChanges();

            dbContext.Entry(tblDepartment).State = EntityState.Detached;
            return(result);
        }
Esempio n. 3
0
        public int CreateApplicants(TblApplicants tblApplicants)
        {
            if (dbContext.TblApplicants.Where(r => r.PanNo.ToUpper() == tblApplicants.PanNo.ToUpper() && r.EmailAddress.ToUpper() == tblApplicants.EmailAddress.ToUpper() && r.Dob == tblApplicants.Dob).Count() > 0)
            {
                return(-1);
            }
            dbContext.Entry(tblApplicants).State = EntityState.Added;
            dbContext.TblApplicants.Add(tblApplicants);
            int result = dbContext.SaveChanges();

            dbContext.Entry(tblApplicants).State = EntityState.Detached;
            return(result);
        }
Esempio n. 4
0
        public int CreateApplicants(TblApplicants tblApplicants)
        {
            dbContext.Entry(tblApplicants).State = EntityState.Added;
            dbContext.TblApplicants.Add(tblApplicants);
            int result = dbContext.SaveChanges();

            dbContext.Entry(tblApplicants).State = EntityState.Detached;
            return(result);
        }