internal ApiResult SaveSystemUser(SystemUser systemUser) { ApiResult apiResult = new ApiResult(); try { if (!systemUser.IsValid()) { apiResult.SetFailuresAsStatusInResponseFields(systemUser.StatusDesc); return(apiResult); } SystemUser old = SystemUser.QueryWithStoredProc("GetSystemUserByID", systemUser.Username).FirstOrDefault(); systemUser.Id = old != null ? old.Id : systemUser.Id; systemUser.Save(); apiResult.SetSuccessAsStatusInResponseFields(); } catch (Exception ex) { HandleError(nameof(AttachSystemAffectedToChangeRequest), "EXCEPTION", ex.Message); apiResult.SetFailuresAsStatusInResponseFields(ex.Message); } return(apiResult); }
public Result SaveSystemUser(SystemUser req) { Result result = new Result(); if (!req.IsValid()) { result.StatusCode = Globals.FAILURE_STATUS_CODE; result.StatusDesc = req.StatusDesc; return(result); } DataTable dt = dh.ExecuteDataSet("SaveSystemUser", new string[] { req.CompanyCode, req.UserId, req.Password, req.Name, req.UserType, req.ModifiedBy, req.IsActive, req.Email }).Tables[0]; if (dt.Rows.Count <= 0) { result.StatusCode = Globals.FAILURE_STATUS_CODE; result.StatusDesc = "FAILED: SALE NOT SAVED"; return(result); } result.StatusCode = Globals.SUCCESS_STATUS_CODE; result.StatusDesc = Globals.SUCCESS_STATUS_TEXT; result.PegPayID = dt.Rows[0][0].ToString(); return(result); }
internal TimeBoundAccessRequest CheckForValidTimeBoundAccessRequest(SystemUser user) { TimeBoundAccessRequest tbar = new TimeBoundAccessRequest(); try { if (!user.IsValid()) { tbar.SetFailuresAsStatusInResponseFields(user.StatusDesc); return(tbar); } TimeBoundAccessRequest[] all = TimeBoundAccessRequest.QueryWithStoredProc("GetTimeBoundRequestByUserId", user.Username); if (all.Count() <= 0) { tbar.StatusCode = Globals.FAILURE_STATUS_CODE; tbar.StatusDesc = $"NO APPROVED TIME BOUND ACCESS REQUEST FOUND"; return(tbar); } tbar = all[0]; tbar.SetSuccessAsStatusInResponseFields(); } catch (Exception ex) { HandleError(nameof(AttachSystemAffectedToChangeRequest), "EXCEPTION", ex.Message); tbar.SetFailuresAsStatusInResponseFields(ex.Message); } return(tbar); }
public Result SaveSystemUser(SystemUser user) { Result result = new Result(); if (!user.IsValid()) { result.StatusCode = Globals.FAILURE_STATUS_CODE; result.StatusDesc = user.StatusDesc; return(result); } DataTable dt = dh.ExecuteDataSet("SaveSystemUser", user.CompanyCode, user.UserId, user.Password, user.Name, user.RoleCode, user.ModifiedBy, user.IsActive, user.Email).Tables[0]; if (dt.Rows.Count <= 0) { result.StatusCode = Globals.FAILURE_STATUS_CODE; result.StatusDesc = "USER WITH ID [" + user.UserId + "] NOT SAVED"; return(result); } result.StatusCode = Globals.SUCCESS_STATUS_CODE; result.StatusDesc = Globals.SUCCESS_STATUS_TEXT; result.LoanID = dt.Rows[0][0].ToString(); return(result); }