Beispiel #1
0
 /// <summary>
 /// TMSs the person roles mapping duplication check bal.
 /// </summary>
 /// <param name="_objPersonRoles">The object person roles.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_PersonRolesMapping_DuplicationCheckBAL(PersonRolesMapping _objPersonRoles) => DAL.TMS_PersonRolesMapping_DuplicationCheckDAL(_objPersonRoles);
Beispiel #2
0
 /// <summary>
 /// TMSs the person roles mapping delete bal.
 /// </summary>
 /// <param name="_objPersonRoles">The object person roles.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_PersonRolesMapping_DeleteBAL(PersonRolesMapping _objPersonRoles) => DAL.TMS_PersonRolesMapping_DeleteDAL(_objPersonRoles);
Beispiel #3
0
 /// <summary>
 /// TMSs the person roles mapping create bal.
 /// </summary>
 /// <param name="_objPersonRoles">The object person roles.</param>
 /// <returns>System.Int64.</returns>
 public long TMS_PersonintoUser_CreateBAL(PersonRolesMapping _objPersonRoles) => DAL.TMS_PersonintoUser_CreateDAL(_objPersonRoles);
Beispiel #4
0
        public ActionResult ManageRoles_Destroy([DataSourceRequest] DataSourceRequest request, PersonRolesMapping _objPersonRoles)
        {
            if (ModelState.IsValid)
            {
                _objPersonRoles.UpdatedBy   = CurrentUser.NameIdentifierInt64;
                _objPersonRoles.UpdatedDate = DateTime.Now;
                //if (_objPersonRoles.RoleID == 2)
                //{

                //}
                var    result = _PersonBAL.TMS_PersonRolesMapping_DeleteBAL(_objPersonRoles);
                string ip     = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (string.IsNullOrEmpty(ip))
                {
                    ip = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                }
                _objConfigurationBAL.Audit_CreateBAL(ip, DateTime.Now, CurrentUser.CompanyID, CurrentUser.NameIdentifierInt64, EventType.Delete, System.Web.HttpContext.Current.Request.Browser.Browser);

                if (result == -1)
                {
                    ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                }
            }
            var resultData = new[] { _objPersonRoles };

            return(Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState)));
        }
Beispiel #5
0
        public ActionResult ManageRoles_Update([DataSourceRequest] DataSourceRequest request, PersonRolesMapping _objPersonRoles)
        {
            if (ModelState.IsValid)
            {
                _objPersonRoles.UpdatedBy   = CurrentUser.NameIdentifierInt64;
                _objPersonRoles.UpdatedDate = DateTime.Now;
                var person = _PersonBAL.Person_GetAllByIdBAL(Convert.ToString(_objPersonRoles.PersonID));

                if (_objPersonRoles.IsLogin == true && _objPersonRoles.Password != null)
                {
                    if (_UserBAL.LoginUsers_DuplicationCheckBAL(new LoginUsers {
                        Email = person.Email
                    }) > 0)
                    {
                        ModelState.AddModelError(lr.UsersTitle, lr.UserEmailAlreadyExist);
                        if (_PersonBAL.TMS_PersonRolesMapping_DuplicationCheckBAL(_objPersonRoles) > 0)
                        {
                            ModelState.AddModelError(lr.VenueName, lr.VenueDuplicationCheck);
                        }
                        else
                        {
                            var    result = _PersonBAL.TMS_PersonRolesMapping_UpdateBAL(_objPersonRoles);
                            string ip     = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                            if (string.IsNullOrEmpty(ip))
                            {
                                ip = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                            }
                            _objConfigurationBAL.Audit_CreateBAL(ip, DateTime.Now, CurrentUser.CompanyID, CurrentUser.NameIdentifierInt64, EventType.Update, System.Web.HttpContext.Current.Request.Browser.Browser);

                            if (result == -1)
                            {
                                ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                            }
                        }
                    }
                    else
                    {
                        _objPersonRoles.Password = Crypto.CreatePasswordHash(_objPersonRoles.Password);
                        _PersonBAL.TMS_PersonintoUser_CreateBAL(_objPersonRoles);
                        string ip = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                        if (string.IsNullOrEmpty(ip))
                        {
                            ip = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                        }
                        _objConfigurationBAL.Audit_CreateBAL(ip, DateTime.Now, CurrentUser.CompanyID, CurrentUser.NameIdentifierInt64, EventType.Create, System.Web.HttpContext.Current.Request.Browser.Browser);

                        if (_PersonBAL.TMS_PersonRolesMapping_DuplicationCheckBAL(_objPersonRoles) > 0)
                        {
                            ModelState.AddModelError(lr.VenueName, lr.VenueDuplicationCheck);
                        }
                        else
                        {
                            var result = _PersonBAL.TMS_PersonRolesMapping_UpdateBAL(_objPersonRoles);
                            if (result == -1)
                            {
                                ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                            }
                        }
                    }
                }
                else
                {
                    if (_PersonBAL.TMS_PersonRolesMapping_DuplicationCheckBAL(_objPersonRoles) > 0)
                    {
                        ModelState.AddModelError(lr.VenueName, lr.VenueDuplicationCheck);
                    }
                    else
                    {
                        var result = _PersonBAL.TMS_PersonRolesMapping_UpdateBAL(_objPersonRoles);
                        if (result == -1)
                        {
                            ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                        }
                    }
                }
                //
                //if (_PersonBAL.TMS_PersonRolesMapping_DuplicationCheckBAL(_objPersonRoles) > 0)
                //{
                //    ModelState.AddModelError(lr.VenueName, lr.VenueDuplicationCheck);
                //}
                //else
                //{
                //    var result = _PersonBAL.TMS_PersonRolesMapping_UpdateBAL(_objPersonRoles);
                //    if (result == -1)
                //    {
                //        ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                //    }
                //}
            }
            var resultData = new[] { _objPersonRoles };

            return(Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState)));
        }
Beispiel #6
0
        public ActionResult ManageRoles_Create([DataSourceRequest] DataSourceRequest request, PersonRolesMapping _objPersonRoles)
        {
            if (ModelState.IsValid)
            {
                _objPersonRoles.CreatedBy   = CurrentUser.NameIdentifierInt64;
                _objPersonRoles.CreatedDate = DateTime.Now;
                _objPersonRoles.PersonID    = Convert.ToInt64(Request.QueryString["PersonID"]);
                CRM_EnrolmentHistory EnrolmentHistory = new CRM_EnrolmentHistory();
                EnrolmentHistory.CreatedBy = CurrentUser.NameIdentifierInt64;
                EnrolmentHistory.CreatedOn = DateTime.Now;
                EnrolmentHistory.PersonID  = Convert.ToInt64(Request.QueryString["PersonID"]);
                EnrolmentHistory.RoleName  = "Trainee";
                _objPersonRoles.ClientType = ClientType.ClientType_Internal;
                if (_objPersonRoles.IsLogin == true && _objPersonRoles.Password != null)
                {
                    var person = _PersonBAL.Person_GetAllByIdBAL(Convert.ToString(_objPersonRoles.PersonID));

                    if (_UserBAL.LoginUsers_DuplicationCheckBAL(new LoginUsers {
                        Email = person.Email
                    }) > 0)
                    {
                        ModelState.AddModelError(lr.UsersTitle, lr.UserEmailAlreadyExist);
                        if (_PersonBAL.TMS_PersonRolesMapping_DuplicationCheckBAL(_objPersonRoles) > 0)
                        {
                            ModelState.AddModelError(lr.VenueName, lr.VenueDuplicationCheck);
                        }
                        else
                        {
                            _objPersonRoles.ID = _PersonBAL.TMS_PersonRolesMapping_CreateBAL(_objPersonRoles);
                            _PersonBAL.Enrolment_CreateBAL(EnrolmentHistory);
                            string ip = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                            if (string.IsNullOrEmpty(ip))
                            {
                                ip = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                            }
                            _objConfigurationBAL.Audit_CreateBAL(ip, DateTime.Now, CurrentUser.CompanyID, CurrentUser.NameIdentifierInt64, EventType.Create, System.Web.HttpContext.Current.Request.Browser.Browser);
                        }
                    }
                    else
                    {
                        _objPersonRoles.Password = Crypto.CreatePasswordHash(_objPersonRoles.Password);
                        _PersonBAL.TMS_PersonintoUser_CreateBAL(_objPersonRoles);
                        if (_PersonBAL.TMS_PersonRolesMapping_DuplicationCheckBAL(_objPersonRoles) > 0)
                        {
                            ModelState.AddModelError(lr.VenueName, lr.VenueDuplicationCheck);
                        }
                        else
                        {
                            _objPersonRoles.ID = _PersonBAL.TMS_PersonRolesMapping_CreateBAL(_objPersonRoles);
                            _PersonBAL.Enrolment_CreateBAL(EnrolmentHistory);
                        }
                    }
                }
                else
                {
                    if (_PersonBAL.TMS_PersonRolesMapping_DuplicationCheckBAL(_objPersonRoles) > 0)
                    {
                        ModelState.AddModelError(lr.VenueName, lr.VenueDuplicationCheck);
                    }
                    else
                    {
                        _objPersonRoles.ID = _PersonBAL.TMS_PersonRolesMapping_CreateBAL(_objPersonRoles);
                        _PersonBAL.Enrolment_CreateBAL(EnrolmentHistory);
                        string ip = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                        if (string.IsNullOrEmpty(ip))
                        {
                            ip = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                        }
                        _objConfigurationBAL.Audit_CreateBAL(ip, DateTime.Now, CurrentUser.CompanyID, CurrentUser.NameIdentifierInt64, EventType.Create, System.Web.HttpContext.Current.Request.Browser.Browser);
                    }
                }
            }
            var resultData = new[] { _objPersonRoles };

            return(Json(resultData.ToDataSourceResult(request, ModelState)));
        }