/// <summary> /// Assembles the entity. /// </summary> /// <param name="employee">The employee.</param> /// <returns></returns> private EmployeeEntity AssembleEntity(EM_Employee employee) { EmployeeEntity entity = new EmployeeEntity(); entity.Address = employee.Address; entity.Email = employee.Email; entity.FirstName = employee.FirstName; entity.LastName = employee.LastName; entity.Phone = employee.Phone; entity.ExternalId = employee.ExternalId; return entity; }
public static void SaveEmployee(EM_Employee employee) { try { GetSynegyRMSInstance().AddToEM_Employee(employee); GetSynegyRMSInstance().SaveChanges(); } catch (Exception) { throw; } }
public static void UpdateEmployee(EM_Employee employess) { try { int rowsAffected = GetSynegyRMSInstance().SaveChanges(); } catch (Exception) { throw; } }
//* public ActionResult NewUser(FormCollection form) { try { //bool status = true; MembershipCreateStatus createStatus; var newuser = Membership.CreateUser(form["txtusername"].ToString(), form["txtpwd"].ToString(), form["txtemail"].ToString(), "PasswordQuestion", "PasswordQuestionAnswer", true, out createStatus); PM_MaxUserEfforts userEffort = new PM_MaxUserEfforts(); userEffort.aspnet_Users = SynergyService.GetUserByName(newuser.UserName); if (form["txteffort"].ToString() == "") { userEffort.MaxEffort = 0; } userEffort.MaxEffort =Convert.ToDecimal(form["txteffort"].ToString()); SynergyService.SaveUserEffort(userEffort); if (createStatus == MembershipCreateStatus.Success) { Roles.AddUserToRole(newuser.UserName, form["ddRoles"].ToString()); var profile = ProfileBase.Create(newuser.UserName); profile.SetPropertyValue("FirstName", form["txtfirstname"].ToString()); profile.SetPropertyValue("LastName", form["txtlastname"].ToString()); profile.SetPropertyValue("Phone", form["txtphone"].ToString()); profile.Save(); List<string> ResourceInfo = new List<string>(); ResourceInfo.Add(form["txtfirstname"].ToString()); ResourceInfo.Add(form["txtusername"].ToString()); ResourceInfo.Add(form["txtpwd"].ToString()); ResourceInfo.Add(form["txtemail"].ToString()); ResourceInfo.Add(form["ddRoles"].ToString()); SendNotificationWhenAccountCreated(newuser.Email, ResourceInfo); ResourceInfo = null; if (!SynergyService.IsEmployeeSystemExternal()) { try { EM_Employee employee = new EM_Employee(); employee.Email = form["txtemail"].ToString(); employee.ExternalId = form["txtnic"].ToString(); employee.FirstName = form["txtfirstname"].ToString(); employee.LastName = form["txtfirstname"].ToString(); employee.Phone = form["txtphone"].ToString(); string departmentId = form["ddlDepartments"].ToString(); employee.aspnet_Users = SynergyService.GetUserByName(newuser.UserName); employee.EM_Departments = SynergyService.GetDepartmentbyId(Convert.ToInt32(departmentId)); SynergyService.UpdateEmployee(employee); } catch { } } ViewData["status"] = "Success"; ViewData["msg"] = "New User Successfully Created."; } else { ViewData["status"] = "Error"; ViewData["msg"] = createStatus.ToString(); //ViewData["msg"] = "Error in User Creation."; } } catch (MembershipCreateUserException ex) { ViewData["status"] = "Error"; ViewData["msg"] = ex.Message; } catch { } ViewData["RoleList"] = GetAllRoles(); ViewData["DepartmentList"] = GetDepartmentList(); return View("Index"); }