public ActionResult Edit([Bind(Include = "Id,Code,Name,DepartmentGroupId,CreatedBy,CreateDate,UpdatedBy,UpdateDate,Status")] Department department)
        {
            if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
            {
                List <DepartmentGroup> groupList = new List <DepartmentGroup>();
                groupList = db.DepartmentGroup.Where(i => i.Status == true).ToList();
                if (db.Department.Where(i => i.Id == department.Id).Select(i => i.Code).FirstOrDefault() != department.Code && department.Code != null)
                {
                    if (db.Department.Where(i => i.Code == department.Code).ToList().Count < 1)
                    {
                        department.UpdatedBy       = Convert.ToInt32(Session["ADMINID"]);
                        department.UpdateDate      = DateTime.Now;
                        db.Entry(department).State = EntityState.Modified;
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Code Exist!");
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Enter a Code!");
                }

                ViewBag.DepartmentGroupId = new SelectList(db.DepartmentGroup, "Id", "Name", department.DepartmentGroupId);
                return(View(department));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Exemple #2
0
        public ActionResult Create([Bind(Include = "Id,EmployeeId,FromDesignationId,ToDesignationId,TransferDate")] DepartmentTransfer departmentTransfer)
        {
            if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
            {
                if (ModelState.IsValid)
                {
                    int fromDesignationId = db.Employee.Where(i => i.Id == departmentTransfer.EmployeeId).Select(i => i.DesignationId).FirstOrDefault();
                    int toDesigantionId   = Convert.ToInt32(Request["ToDesignationId"]);
                    departmentTransfer.FromDesignationId = fromDesignationId;
                    departmentTransfer.ToDesignationId   = toDesigantionId;
                    departmentTransfer.TransferDate      = DateTime.Now;
                    db.DepartmentTransfer.Add(departmentTransfer);
                    db.SaveChanges();

                    Employee emp = db.Employee.Find(departmentTransfer.EmployeeId);
                    emp.DesignationId   = toDesigantionId;
                    db.Entry(emp).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                List <Employee> employee = new List <Employee>();
                employee = db.Employee.Where(i => i.Status == true).ToList();
                List <Designation> designation = new List <Designation>();
                designation             = db.Designation.Where(i => i.Status == true).ToList();
                ViewBag.EmployeeId      = new SelectList(employee, "Id", "Name");
                ViewBag.ToDesignationId = new SelectList(designation, "Id", "Name");
                return(View(departmentTransfer));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Exemple #3
0
        public ActionResult Create([Bind(Include = "Id,EmployeeId,FromBranchId,ToBranchId,TransferDate")] BranchTransfer branchTransfer)
        {
            if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
            {
                if (ModelState.IsValid)
                {
                    int fromBranchId = db.Employee.Where(i => i.BranchId == branchTransfer.EmployeeId).Select(x => x.BranchId).FirstOrDefault();
                    int toBranchId   = Convert.ToInt32(Request["ToBranchId"]);
                    branchTransfer.FromBranchId = fromBranchId;
                    branchTransfer.ToBranchId   = toBranchId;
                    db.BranchTransfer.Add(branchTransfer);
                    db.SaveChanges();

                    Employee employee = db.Employee.Find(branchTransfer.EmployeeId);
                    employee.BranchId        = toBranchId;
                    db.Entry(employee).State = EntityState.Modified;
                    db.SaveChanges();
                    TempData["Message"] = "Creation Success!";
                    return(RedirectToAction("Index"));
                }

                List <Branch> branchList = new List <Branch>();
                branchList         = db.Branch.Where(i => i.Status == true).ToList();
                ViewBag.ToBranchId = new SelectList(branchList, "Id", "Name");
                List <Employee> employeelist = new List <Employee>();
                employeelist       = db.Employee.Where(i => i.Status == true).ToList();
                ViewBag.EmployeeId = new SelectList(employeelist, "Id", "Name");
                return(View(branchTransfer));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
 public ActionResult Edit([Bind(Include = "Id,Code,Name,FathersName,MothersName,Gender,PresentAddress,PermanentAddress,Mobile,Email,NIDorBirthCirtificate,DrivingLicence,PassportNumber,DateOfBirth,DateOfJoining,DesignationId,EmployeeTypeId,BranchId,GrossSalary,CreatedBy,CreateDate,UpdatedBy,UpdateDate,IsSystemOrSuperAdmin,Status,ProbationStatus,IsSpecialEmployee,ParmanentDate,EmergencyMobile,RelationEmergencyMobile,BloodGroup,MedicalHistory,Height,Weight,ExtraCurricularActivities")] Employee employee)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         employee.UpdateDate = DateTime.Now;
         employee.UpdatedBy  = Convert.ToInt32(Session["ADMINID"]);
         if (ModelState.IsValid)
         {
             db.Entry(employee).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         List <Branch> branch = new List <Branch>();
         branch           = db.Branch.Where(i => i.Status == true).ToList();
         ViewBag.BranchId = new SelectList(branch, "Id", "Name", employee.BranchId);
         List <Designation> designation = new List <Designation>();
         designation           = db.Designation.Where(i => i.Status == true).ToList();
         ViewBag.DesignationId = new SelectList(designation, "Id", "Name");
         List <EmployeeType> employeeType = new List <EmployeeType>();
         employeeType           = db.EmployeeType.Where(i => i.Status).ToList();
         ViewBag.EmployeeTypeId = new SelectList(employeeType, "Id", "Name");
         return(View(employee));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "Id,Name,Status")] EmployeeType employeeType)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             db.Entry(employeeType).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(employeeType));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Address,OpeningTime,EndingTime,IsLateCalculated,LateConsiderationTime,LateConsiderationDay,LateDeductionPercentage,IsOvertimeCalculated,OvertimeConsiderationTime,OvertimePaymentPercentage,Status")] Branch branch)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         branch.Status = true;
         if (ModelState.IsValid)
         {
             db.Entry(branch).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(branch));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
 public ActionResult Edit([Bind(Include = "Id,Code,Name,CreatedBy,CreateDate,UpdatedBy,UpdateDate,Status")] DepartmentGroup departmentGroup)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         departmentGroup.UpdatedBy  = Convert.ToInt32(Session["ADMINID"]);
         departmentGroup.UpdateDate = DateTime.Now;
         if (ModelState.IsValid)
         {
             db.Entry(departmentGroup).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.CreatedBy = new SelectList(db.Employee, "Id", "Code", departmentGroup.CreatedBy);
         ViewBag.UpdatedBy = new SelectList(db.Employee, "Id", "Code", departmentGroup.UpdatedBy);
         return(View(departmentGroup));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
Exemple #8
0
 public ActionResult Edit([Bind(Include = "Id,Code,Name,DepartmentId,RoleName,CreatedBy,CreateDate,UpdatedBy,UpdateDate,Status")] Designation designation)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             designation.UpdatedBy       = Convert.ToInt32(Session["ADMINID"]);
             designation.UpdateDate      = DateTime.Now;
             db.Entry(designation).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         List <Department> department = new List <Department>();
         department           = db.Department.Where(i => i.Status == true).ToList();
         ViewBag.DepartmentId = new SelectList(department, "Id", "Name", designation.DepartmentId);
         return(View(designation));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
 public ActionResult Edit([Bind(Include = "Id,EmployeeId,LeaveTypeId,CreateDate,FromDate,ToDate,Day,Cause,UpdatedBy,UpdateDate,Status,Remarks,IsSeen")] LeaveHistory leaveHistory)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             leaveHistory.UpdatedBy       = Convert.ToInt32(Session["ADMINID"]);
             leaveHistory.UpdateDate      = DateTime.Now;
             db.Entry(leaveHistory).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         List <Employee> employee = new List <Employee>();
         employee            = db.Employee.Where(i => i.Status == true).ToList();
         ViewBag.LeaveTypeId = new SelectList(db.LeaveType, "Id", "Name");
         ViewBag.UpdatedBy   = new SelectList(employee, "Id", "Name");
         return(View(leaveHistory));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
Exemple #10
0
 public ActionResult Edit([Bind(Include = "Id,ResignDate,Reason,Suggestion,Status,CreateDate,UpdatedBy,UpdateDate,Remarks,EmployeeId,IsSeen")] Resignation resignation)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             db.Entry(resignation).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.EmployeeId = new SelectList(db.Employee, "Id", "Name", resignation.EmployeeId);
         return(View(resignation));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
        public ActionResult Edit([Bind(Include = "Id,Code,Name,FathersName,MothersName,Gender,PresentAddress,PermanentAddress,Mobile,Email,Password")] Admin admin)
        {
            if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
            {
                if (ModelState.IsValid)
                {
                    db.Entry(admin).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                return(View(admin));
            }

            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Exemple #12
0
 public ActionResult Edit([Bind(Include = "Id,InstituteName,InstituteAddress,Website,Phone,Designation,FromDate,ToDate,EmployeeId")] Experience experience)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             db.Entry(experience).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.EmployeeId = new SelectList(db.Employee, "Id", "Name", experience.EmployeeId);
         return(View(experience));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
 public ActionResult Edit([Bind(Include = "Id,Image,EmployeeId")] Images images)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             db.Entry(images).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.EmployeeId = new SelectList(db.Employee, "Id", "Name", images.EmployeeId);
         return(View(images));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
 public ActionResult Edit([Bind(Include = "Id,Rating,Date,EmployeeId,PerformanceIssueId")] PerformanceRating performanceRating)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             db.Entry(performanceRating).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.EmployeeId         = new SelectList(db.Employee, "Id", "Name", performanceRating.EmployeeId);
         ViewBag.PerformanceIssueId = new SelectList(db.PerformanceIssue, "Id", "Name", performanceRating.PerformanceIssueId);
         return(View(performanceRating));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
 public ActionResult Edit([Bind(Include = "Id,EmployeeId,EarnLeaveDays,WithoutPayLeaveDays")] EmployeeLeaveCountHistory employeeLeaveCountHistory)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             db.Entry(employeeLeaveCountHistory).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         List <Employee> employee = db.Employee.Where(i => i.Status == true).ToList();
         ViewBag.EmployeeId = new SelectList(employee, "Id", "Name");
         return(View(employeeLeaveCountHistory));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
 public ActionResult Edit([Bind(Include = "Id,InstituteName,Program,Board,Result,FromDate,ToDate,EmployeeId")] Education education)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             db.Entry(education).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         List <Employee> employee = new List <Employee>();
         employee           = db.Employee.Where(i => i.Status == true).ToList();
         ViewBag.EmployeeId = new SelectList(employee, "Id", "Name", education.EmployeeId);
         return(View(education));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
 public ActionResult Edit([Bind(Include = "Id,EmployeeId,DisciplinaryActionTypeId,Date,Remarks")] DisciplinaryAction disciplinaryAction)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             disciplinaryAction.Date            = DateTime.Now;
             db.Entry(disciplinaryAction).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.DisciplinaryActionTypeId = new SelectList(db.DisciplinaryActionTypes, "Id", "Name", disciplinaryAction.DisciplinaryActionTypeId);
         ViewBag.EmployeeId = new SelectList(db.Employee, "Id", "Name", disciplinaryAction.EmployeeId);
         return(View(disciplinaryAction));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
Exemple #18
0
 public ActionResult Edit([Bind(Include = "Id,EmployeeId,LeaveTypeId,AvailableDay")] LeaveCount leaveCount)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             db.Entry(leaveCount).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         List <Employee> employee = new List <Employee>();
         employee            = db.Employee.Where(i => i.Status == true).ToList();
         ViewBag.EmployeeId  = new SelectList(employee, "Id", "Name", leaveCount.EmployeeId);
         ViewBag.LeaveTypeId = new SelectList(db.LeaveType, "Id", "Name", leaveCount.LeaveTypeId);
         return(View(leaveCount));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }