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();
                }
            }
        }
Beispiel #2
0
        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));
        }