Exemple #1
0
        public ActionResult Login(EmpMaster empMaster)
        {
            empMaster = common.concatAndHashTempMaster(empMaster);//name and password concat and converting sha256

            if (common.validUser(empMaster))
            {
                empMaster = ObjectAssignAndSave.getObjectDatabaseEmpMaster(empMaster, "get_login_field");
                //assign session value
                Session["id"]   = empMaster.id;
                Session["name"] = empMaster.email;
                Session["type"] = empMaster.empMasterType;
                //end
                if (empMaster.empMasterType == 1)
                {
                    return(RedirectToAction("Administrator", "Home"));
                }
                else
                {
                    return(RedirectToAction("AddDetils", "Home"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Home"));
            }
        }
Exemple #2
0
        public RepositoryResponse LoadEmpNominationDetails(long ID, string nominationID, string empNum)
        {
            baseModel = new RepositoryResponse();
            try
            {
                using (objSOMEntities = new SOMEntities())
                    using (objIPEntities = new IntranetPortalEntities())
                    {
                        EmpMaster  a = new EmpMaster();
                        Nomination c = new Nomination();

                        var _NomDetails = (from em in objIPEntities.EmpMasters.AsEnumerable()
                                           join nom in objSOMEntities.Nominations.AsEnumerable() on em.EmployeeNumber equals nom.EmployeeNumber.ToString()
                                           where nom.IsActive == true && nom.NominationId == nominationID && em.EmployeeNumber == empNum
                                           select new { em, nom }).OrderByDescending(r => r.nom.ID).FirstOrDefault();

                        var             _data = objSOMEntities.Evaluations.Where(r => r.ID == ID && r.IsActive == true).FirstOrDefault();
                        EvaluationModel model = ConvertEvaluation_DB2Model(_NomDetails.em, _data, _NomDetails.nom, 1);
                        baseModel = new RepositoryResponse {
                            success = true, message = "Get Evaluation details Successfully", Data = model
                        };
                    }
            }
            catch (Exception ex)
            {
                baseModel = new RepositoryResponse {
                    success = false, message = ex.ToString()
                };
            }
            return(baseModel);
        }
Exemple #3
0
 public ActionResult AddDetils(EmpMaster empMaster)
 {
     if (Session["id"] != null)
     {
         int id = Convert.ToInt32(Session["id"]);
         var PreviousTimeUpdatedcheck = db.empMasters.Where(d => d.id == id).FirstOrDefault();
         id = 0;
         if (PreviousTimeUpdatedcheck.mobile == null && PreviousTimeUpdatedcheck.address == null)//previous Enter Data Not Update Back end check
         {
             //current Object Value Assign
             empMaster.email     = PreviousTimeUpdatedcheck.email;
             empMaster.position  = PreviousTimeUpdatedcheck.position;
             empMaster.salary    = PreviousTimeUpdatedcheck.salary;
             empMaster.id        = PreviousTimeUpdatedcheck.id;
             empMaster.enterDate = DateTime.Now;
             empMaster           = common.concatAndHashTempMaster(empMaster);
             //end
             ObjectAssignAndSave.UpdateObject(empMaster);
         }
         return(RedirectToAction("AddDetils", "Home"));
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            EmpMaster empMaster = db.Employees.Find(id);

            db.Employees.Remove(empMaster);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public static void SaveObject(EmpMaster empMaster)           //admin object save database
 {
     using (UniTechTestContext db = new UniTechTestContext()) // database object using DataAccessLayer , we define using becouse still runing project change database value show
     {
         db.empMasters.Add(empMaster);
         db.SaveChanges();
     }
 }
        // This is the static method that controls the access to the singleton

        public static EmpMaster GetInstanceEmpMaster()// Get instance object admin
        {
            if (_empMaster == null)
            {
                _empMaster = new EmpMaster();
            }
            return(_empMaster);
        }
 public static void UpdateObject(EmpMaster empMaster)         //admin object save database
 {
     using (UniTechTestContext db = new UniTechTestContext()) // database object using DataAccessLayer , we define using becouse still runing project change database value show
     {
         db.empMasters.Attach(empMaster);
         db.Entry(empMaster).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
 public ActionResult Edit([Bind(Include = "id,name,Education,age,technical_exp,Last_co_worked")] EmpMaster empMaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(empMaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(empMaster));
 }
        public EmpMaster EditEmployee(EmpMaster employee)
        {
            if (employee == null || employee.Name == null)
            {
                return(null);
            }
            var empResultSet = _employee.UpdateEmployee(employee);

            return(empResultSet);
        }
 public static EmpMaster getObjectDatabaseEmpMaster(EmpMaster tempmaster, string condition) //admin object save database
 {
     using (UniTechTestContext db = new UniTechTestContext())                               // database object using DataAccessLayer , we define using becouse still runing project change database value show
     {
         if (condition == "get_login_field")
         {
             tempmaster = db.empMasters.Where(d => d.email == tempmaster.email && d.password == tempmaster.password && d.confirmPassword == tempmaster.confirmPassword).FirstOrDefault();
         }
     }
     return(tempmaster);
 }
Exemple #11
0
        private UniTechTestContext db = new UniTechTestContext();//create object my db;

        public static EmpMaster concatAndHashTempMaster(EmpMaster tempmaster)
        {
            string hash = tempmaster.email + tempmaster.password;

            tempmaster.password = SHA.GenerateSHA256String(hash);

            hash = tempmaster.email + tempmaster.password;
            tempmaster.confirmPassword = SHA.GenerateSHA256String(hash);

            return(tempmaster);
        }
        public ActionResult Create([Bind(Include = "id,name,Education,age,technical_exp,Last_co_worked")] EmpMaster empMaster)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(empMaster);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(empMaster));
        }
 public EmpMaster AddEmployee(EmpMaster employee)
 {
     if (employee == null)
     {
         return(null);
     }
     employee.Id = 0;
     _dbContext.EmpMaster.Add(employee);
     _dbContext.SaveChanges();
     return(employee);
 }
Exemple #14
0
        public EmpMaster GetEmployeeByID(int?id)
        {
            EmpMaster objEmployee = null;

            try
            {
                objEmployee = objEmpService.GetEmployeeByID(id);
            }
            catch (Exception e)
            {
                e.ToString();
            }
            return(objEmployee);
        }
        // GET: Employee/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmpMaster empMaster = db.Employees.Find(id);

            if (empMaster == null)
            {
                return(HttpNotFound());
            }
            return(View(empMaster));
        }
Exemple #16
0
        public static Boolean validUser(EmpMaster tempmaster)
        {
            Boolean checkvalid = false;

            using (UniTechTestContext db = new UniTechTestContext())// database object using DataAccessLayer , we define using becouse still runing project change database value show
            {
                tempmaster = ObjectAssignAndSave.getObjectDatabaseEmpMaster(tempmaster, "get_login_field");
                if (tempmaster != null)
                {
                    checkvalid = true;
                }
            }

            return(checkvalid);
        }
        public EmpMaster UpdateEmployee(EmpMaster employee)
        {
            var getEmp = _dbContext.EmpMaster.FirstOrDefault(x => x.Id == employee.Id);

            if (getEmp == null)
            {
                return(null);
            }
            getEmp.Name  = employee.Name;
            getEmp.City  = employee.City;
            getEmp.Phone = employee.Phone;
            getEmp.Email = employee.Email;
            _dbContext.Entry(getEmp).State = EntityState.Modified;
            _dbContext.SaveChanges();
            return(getEmp);
        }
Exemple #18
0
        public HttpResponseMessage UpdateCustomer(EmpMaster model)
        {
            int result = 0;

            try
            {
                result = objEmpService.UpdateEmployee(model);
            }
            catch (Exception e)
            {
                e.ToString();
                result = -0;
            }

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Exemple #19
0
 public ActionResult Administrator(EmpMaster empMaster)
 {
     if (Session["id"] != null && Convert.ToInt32(Session["type"]) == 1)
     {
         if (empMaster != null)
         {
             empMaster.enterDate     = DateTime.Now;
             empMaster.empMasterType = 0;
             empMaster = common.concatAndHashTempMaster(empMaster);
             ObjectAssignAndSave.SaveObject(empMaster);
         }
         return(RedirectToAction("Administrator", "Home"));
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
Exemple #20
0
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int SaveEmployee(EmpMaster model)
        {
            int result = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("EmpName", model.EmpName);

                string spQuery = "[Set_Customer]";
                result = GenericFactoryFor_Emp.ExecuteCommand(spQuery, ht);
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(result);
        }
Exemple #21
0
        /// <summary>
        /// Get Data From Database
        /// <para>Use it when to retive single data through a stored procedure</para>
        /// </summary>
        public EmpMaster GetEmployeeByID(int?id)
        {
            EmpMaster objEmployee = null;
            string    spQuery     = string.Empty;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("EmpMasterID", id);

                spQuery     = "[Get_EmployeeSingle]";
                objEmployee = GenericFactoryFor_Emp.ExecuteQuerySingle(spQuery, ht);
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(objEmployee);
        }
Exemple #22
0
 public RepositoryResponse LoadEvaluationDataByID(long ID)
 {
     baseModel = new RepositoryResponse();
     try
     {
         using (objSOMEntities = new SOMEntities())
         {
             EmpMaster       a     = new EmpMaster();
             Nomination      c     = new Nomination();
             var             _data = objSOMEntities.Evaluations.Where(r => r.ID == ID && r.IsActive == true).FirstOrDefault();
             EvaluationModel model = ConvertEvaluation_DB2Model(a, _data, c, 1);
             baseModel = new RepositoryResponse {
                 success = true, message = "Get Evaluation details Successfully", Data = model
             };
         }
     }
     catch (Exception ex)
     {
         baseModel = new RepositoryResponse {
             success = false, message = ex.ToString()
         };
     }
     return(baseModel);
 }
Exemple #23
0
        public int GetSOMEmployeeRoleByUser(EmpMaster usr)
        {
            using (objSOMEntities = new SOMEntities())
                using (objIPEntities = new IntranetPortalEntities())
                {
                    int empNumber = Convert.ToInt32(usr.EmployeeNumber);
                    var rptPerson = objIPEntities.EmpMasters.Where(r => r.ReportingPersonId == empNumber && r.IsActive == true).FirstOrDefault();
                    var _nom      = objSOMEntities.Configurations.Where(r => r.Type == "NominationUserGrades" && r.IsActive == true).FirstOrDefault();
                    var _eva      = objSOMEntities.Configurations.Where(r => r.Type == "EvaluationUserGrades" && r.IsActive == true).FirstOrDefault();

                    var tqCHead = objSOMEntities.TQCHeads.Where(r => r.EmployeeNumber == usr.EmployeeNumber && r.IsActive == true).FirstOrDefault();
                    if (tqCHead != null)
                    {
                        return((int)SOMEmpRole.TQCHead); //3001
                    }

                    else if (usr.UserRole == 102 && (string.IsNullOrEmpty(usr.Grade) && rptPerson == null))
                    {
                        return((int)SOMEmpRole.Admin); //3002
                    }

                    else if (usr.UserRole == 102 && (string.IsNullOrEmpty(usr.Grade) && rptPerson != null))
                    {
                        return((int)SOMEmpRole.AdminHoD); //3007
                    }

                    else if (usr.UserRole == 102 && (!string.IsNullOrEmpty(usr.Grade) && rptPerson != null))
                    {
                        if (_nom.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.AdminHoDNomination); //3015
                        }
                        else if (_eva.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.AdminHoDEvaluation); //3014
                        }

                        else if (_eva.Value.ToLower().Contains(usr.Grade.ToLower()) && _nom.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.AdminHoDEvaluationNomination); //3016
                        }
                    }

                    else if (usr.UserRole == 102 && (!string.IsNullOrEmpty(usr.Grade) && rptPerson == null))
                    {
                        if (_nom.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.AdminNomination); //3009
                        }
                        else if (_eva.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.AdminEvaluation); //3008
                        }

                        else if (_eva.Value.ToLower().Contains(usr.Grade.ToLower()) && _nom.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.AdminEvaluationNomination); //3010
                        }
                    }

                    else if (usr.UserRole == 101 && (!string.IsNullOrEmpty(usr.Grade) && rptPerson != null))
                    {
                        if (_nom.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.HoDNomination); //3012
                        }
                        else if (_eva.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.HoDEvaluation); //3011
                        }

                        else if (_eva.Value.ToLower().Contains(usr.Grade.ToLower()) && _nom.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.HoDEvaluationNomination); //3013
                        }
                    }

                    else if (usr.UserRole == 101 && (!string.IsNullOrEmpty(usr.Grade) && rptPerson == null))
                    {
                        if (_nom.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.Nomination); //3005
                        }
                        else if (_eva.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.Evaluation); //3004
                        }

                        else if (_eva.Value.ToLower().Contains(usr.Grade.ToLower()) && _nom.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.EvaluationNomination); //3006
                        }
                    }

                    else if (usr.UserRole == 101 && (string.IsNullOrEmpty(usr.Grade) && rptPerson != null))
                    {
                        if (_nom.Value.ToLower().Contains(usr.Grade.ToLower()))
                        {
                            return((int)SOMEmpRole.HoD); //3003
                        }
                    }
                }
            return(-1);
        }
Exemple #24
0
 public EmpMaster add(EmpMaster emp)
 {
     _context.EmpMaster.Add(emp);
     _context.SaveChanges();
     return(emp);
 }
Exemple #25
0
        private EvaluationModel ConvertEvaluation_DB2Model(EmpMaster a, Evaluation b, Nomination c, int i)
        {
            EvaluationModel model = new EvaluationModel();

            model.SlNo = i;
            if (a != null)
            {
                model.Name           = a.EmployeeName;
                model.EmployeeNumber = a.EmployeeNumber;
                model.Department     = a.Department;
            }
            if (b != null)
            {
                model.AheadOfPlan        = b.AheadOfPlan;
                model.AsPerPlan          = b.AsPerPlan;
                model.BasedOnInstruction = b.BasedOnInstruction;

                model.BreakthroughImprovement         = b.BreakthroughImprovement;
                model.CoordiantionWithInTheDept       = b.CoordiantionWithInTheDept;
                model.CoordinationWithAnotherFunction = b.CoordinationWithAnotherFunction;

                model.CoordinationWithMultipleFunctions = b.CoordinationWithMultipleFunctions;
                model.Delayed = b.Delayed;

                model.EvaluatorID = b.EvaluatorID;
                model.FollowedUp  = b.FollowedUp;
                model.ID          = b.ID;

                model.Implemented = b.Implemented;
                model.ImplementedInAllApplicableAreas = b.ImplementedInAllApplicableAreas;
                model.ImplementedPartially            = b.ImplementedPartially;
                model.ImprovementFromCurrentSituation = b.ImprovementFromCurrentSituation;

                model.IsActive             = (bool)b.IsActive;
                model.Participated         = b.Participated;
                model.PreventionOfaFailure = b.PreventionOfaFailure;

                model.ProactiveIdeaGeneratedBySelf  = b.ProactiveIdeaGeneratedBySelf;
                model.ReactiveIdeaDrivenBySituation = b.ReactiveIdeaDrivenBySituation;
                model.ScopeIdentified = b.ScopeIdentified;

                model.Status     = (NominationStatus)b.Status;
                model.TotalScore = b.TotalScore.ToString();
            }
            if (c != null)
            {
                model.NominationIdentity   = c.ID;
                model.NominationID         = c.NominationId;
                model.SummaryOfAchievement = c.Idea;
                model.SubmittedMonth       = c.SubmittedMonth;
                model.SubmittedYear        = c.SubmittedYear;

                model.Cost  = c.Cost;
                model.Time  = c.Time;
                model.Paper = c.Paper;
                if (!string.IsNullOrEmpty(c.CreatedDate))
                {
                    model.CreatedDateForFilterAsDateTime = Assistant.SOMDbToDateTimePicker(c.CreatedDate.Substring(0, 8));
                }
            }
            return(model);
        }