コード例 #1
0
ファイル: PeopleController.cs プロジェクト: waqasBashir/TMS
        public ActionResult Relation_Update([DataSourceRequest] DataSourceRequest request, PersonRelation _objPersonRelation)
        {
            if (ModelState.IsValid)
            {
                _objPersonRelation.UpdatedBy   = CurrentUser.NameIdentifierInt64;
                _objPersonRelation.UpdatedDate = DateTime.Now;

                if (_PersonBAL.PersonRelationToPerson_DuplicationCheckBAL(_objPersonRelation) == 0)
                {
                    var    result = _PersonBAL.PersonRelationToPerson_UpdateBAL(_objPersonRelation);
                    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
                {
                    ModelState.AddModelError(lr.PersonRelationToField, lr.PersonRelationDuplicationMessage);
                }
            }
            var resultData = new[] { _objPersonRelation };

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