public void CreateDesignation() { DesignationServiceClient client = null; try { string userDesignation = Request.Params["ppUserDesignation"]; UserDto currentUser = (UserDto)Session[Constants.SKCURRENTUSER]; DesignationDto designation = new DesignationDto(); designation.DesignationName = userDesignation; designation.CreatedBy = currentUser.UserId; designation.ModifiedBy = currentUser.UserId; client = new DesignationServiceClient(); designation = client.Create(designation, currentUser.UserName); client.Close(); if (designation.Response.HasWarning) { foreach (BusinessWarning businessWarning in designation.Response.BusinessWarnings) { ViewData["Error"] = "Designation Present"; } } else { TempData["GroupSaved"] = "Designation Saved"; } } catch (Exception) { if (client != null && client.State == System.ServiceModel.CommunicationState.Opened) { client.Close(); } } }
public List <DesignationDto> GetUserDesignationList() { DesignationServiceReference.DesignationServiceClient client = new DesignationServiceClient(); List <DesignationDto> designationdtos = client.FindAll().Entities.ToList(); client.Close(); designationdtos.Insert(0, new DesignationDto() { DesignationId = 0, DesignationName = "[Select]" }); return(designationdtos); }
public static List <DesignationDto> GetDesignations() { DesignationServiceReference.DesignationServiceClient Designationclient = new DesignationServiceClient(); List <DesignationDto> Designationdto = Designationclient.FindAll().Entities.ToList(); Designationclient.Close(); Designationdto.Insert(0, new DesignationDto() { DesignationId = 0, DesignationName = "[Select]" }); return(Designationdto); }
public ActionResult CreateNewUserDesignation() { DesignationServiceClient client = null; string Prefix = Request.Params["prefix"]; DesignationModel designationModel = new DesignationModel(Prefix); try { string userDesignation = Request.Params["ppUserDesignation"]; UserDto currentUser = (UserDto)Session[Constants.SKCURRENTUSER]; DesignationDto designation = new DesignationDto(); designation.DesignationName = userDesignation; designation.CreatedBy = currentUser.UserId; designation.ModifiedBy = currentUser.UserId; client = new DesignationServiceClient(); currentUser.ViewOfUserUserGroupRolePermissions = null; designation = client.Create(designation, currentUser.UserName); client.Close(); if (designation.Response.HasWarning) { foreach (BusinessWarning businessWarning in designation.Response.BusinessWarnings) { ViewData["Error"] = "Designation Present"; } } else { TempData["DesignationId"] = designation.DesignationId.ToString(); TempData["GroupSaved"] = "Designation Saved"; } } catch (Exception) { if (client != null && client.State == System.ServiceModel.CommunicationState.Opened) { client.Close(); } } return(PartialView("CBPPopupAddDesignation", designationModel)); }