public ActionResult Create(EmployeeModel model)
        {
            ResponseJson response = new ResponseJson();
              try
              {
            if (!ModelState.IsValid)
            {
              return Json(Globals.SetValidationError(ModelState));
            }

            UpdatedInfoModel updatedInfo = new UpdatedInfoModel() { Comment = "Employee Created", Type = 1, UpdatedTime = DateTime.Now, UserId = CurrentUser.Id };
            using (AppDB db = new AppDB())
            {
              DAL.Employee bundle = new DAL.Employee()
              {
            Id = Guid.NewGuid(),
            Name = model.Name,
            BarCode = Globals.GetBarCode(),
            CreatedBy = CurrentUser.Id,
            UserName = model.UserName,
            Password = Globals.Encrypt(model.Password),
            Phone = model.Phone,
            Email = model.Email,
            IsActive = true,
            Address = model.Address,
            Role = model.Role,
            CreatedAt = DateTime.Now,
            UpdateInfo = new JavaScriptSerializer().Serialize(updatedInfo)
              };
              db.Employees.Add(bundle);
              db.SaveChanges();
              //EmailSender.SendToCHWUser(model.Email, login, login, model.Surname, "Sector Executive Officer");
            }

              }
              catch (Exception ex)
              {
            response.IsError = true;
            response.Id = -6;
              }
              return Json(response);
        }
        public ActionResult SaveChange(EmployeeModel model)
        {
            ResponseJson response = new ResponseJson();
              try
              {
            if (!ModelState.IsValid)
            {
              return Json(Globals.SetValidationError(ModelState));
            }

            UpdatedInfoModel updatedInfo = new UpdatedInfoModel() { Comment = "Update Employee", Type = 2, UpdatedTime = DateTime.Now, UserId = CurrentUser.Id };
            using (AppDB db = new AppDB())
            {
              var bundle = db.Employees.Where(s => s.Id == model.Id).SingleOrDefault();

              if (bundle != null)
              {
            bundle.Name = model.Name;
            bundle.Phone = model.Phone;
            bundle.Email = model.Email;
            bundle.Address = model.Address;
            bundle.Role = model.Role;
            bundle.UpdateInfo += "," + new JavaScriptSerializer().Serialize(updatedInfo);
            db.SaveChanges();
              }
              else
              {
            response.IsError = true;
            response.Id = -3;
              }
              //EmailSender.SendToCHWUser(model.Email, login, login, model.Surname, "Sector Executive Officer");
            }

              }
              catch (Exception ex)
              {
            response.IsError = true;
            response.Id = -6;
              }
              return Json(response);
        }