public bool SaveLogin(LicenseInputModel user) { #region update existing Login record List <LICENSE_LOG_HISTORY> lst = context.LICENSE_LOG_HISTORY. Where(t => t.Product_Key == user.Product_Key && t.LOGIN_ID == user.Login_ID && t.IP_ADDRESS == user.IPAddress && t.DEVICE_TYPE == user.DeviceType && t.BROWSER_INFO == user.BrowserInfo && t.LOGOFFTIME == null).ToList(); if (lst != null && lst.Count > 0) { foreach (LICENSE_LOG_HISTORY l_log in lst) { l_log.LOGOFFTIME = DateTime.Now; } context.SaveChanges(); } #endregion LICENSE_LOG_HISTORY l_logHistory = new LICENSE_LOG_HISTORY(); l_logHistory.LOGIN_ID = user.Login_ID; l_logHistory.IP_ADDRESS = user.IPAddress; l_logHistory.DEVICE_TYPE = user.DeviceType; l_logHistory.BROWSER_INFO = user.BrowserInfo; l_logHistory.Product_Key = user.Product_Key; l_logHistory.LOGINTIME = DateTime.Now; l_logHistory.SESSION_RENEW = DateTime.Now; context.LICENSE_LOG_HISTORY.Add(l_logHistory); context.Entry(l_logHistory).State = EntityState.Added; context.SaveChanges(); return(true); }
public object Login(LicenseInputModel licenseInputModel) { l_repo = new LicenseRepository(licenseInputModel.Product_Key); string ErrMsg = string.Empty; if (l_repo.ProductKey != "") { if (validateCrdential(licenseInputModel.Login_ID, licenseInputModel.Password, out ErrMsg)) { if (validateLicense(licenseInputModel, out ErrMsg)) { l_repo.SaveLogin(licenseInputModel); response.status_Description = "Successfully Logged In"; response.status_code = "1"; } else { response.status_Description = ErrMsg; response.status_code = "0"; } } else { response.status_Description = ErrMsg; response.status_code = "0"; } } else { response.status_Description = "Invalid Product Key"; response.status_code = "0"; } return(Result(response)); }
public ActionResult Update([DataSourceRequest]DataSourceRequest request, LicenseInputModel license) { if (this.ModelState.IsValid) { this.licenses.Update(license.Id, license.Name, license.Description, license.Url); } var licenseToDisplay = this.licenses .GetAll() .To<ListedLicenseViewModel>() .FirstOrDefault(x => x.Id == license.Id); return this.Json(new[] { licenseToDisplay }.ToDataSourceResult(request, this.ModelState)); }
public bool KeepAlive(LicenseInputModel user) { var existing_data = context.LICENSE_LOG_HISTORY. Where(t => t.Product_Key == user.Product_Key && t.LOGIN_ID == user.Login_ID && t.IP_ADDRESS == user.IPAddress && t.DEVICE_TYPE == user.DeviceType && t.BROWSER_INFO == user.BrowserInfo && t.LOGOFFTIME == null).FirstOrDefault <LICENSE_LOG_HISTORY>(); if (existing_data != null) { existing_data.LOGINTIME = DateTime.Now; context.SaveChanges(); } return(true); }
public object KeepAlive(LicenseInputModel licenseInputModel) { string ErrMsg = string.Empty; l_repo = new LicenseRepository(licenseInputModel.Product_Key); if (l_repo.ProductKey != "") { l_repo.LogOff(licenseInputModel); response.status_Description = "Successfuly Session Extended"; response.status_code = "1"; } else { response.status_Description = "Invalid Product Key"; response.status_code = "0"; } return(Result(response)); }
private bool validateLicense(LicenseInputModel licenseInputModel, out string ErrorMsg) { ErrorMsg = string.Empty; List <LICENSE_LOG_HISTORY> lst = new List <LICENSE_LOG_HISTORY>(); lst = l_repo.GetAllLoggedUser(licenseInputModel); if (lst.Count < l_repo.LicenseNoOfUsers) { if (l_repo.ISMULTI_lOGGIN == "N") { //neee to check } return(true); } else { ErrorMsg = "Total number of logged users reached License. Kindly contact admin."; return(false); } }
public object KeepAlive([FromBody] LicenseInputModel licenseInputModel) { var result = l_services.KeepAlive(licenseInputModel); return(result); }
public object LogOff([FromBody] LicenseInputModel licenseInputModel) { var result = l_services.LogOff(licenseInputModel); return(result); }
//Get All user except current login user public List <LICENSE_LOG_HISTORY> GetAllLoggedUser(LicenseInputModel user) { return(context.LICENSE_LOG_HISTORY.Where(r => r.Product_Key == ProductKey && r.LOGOFFTIME == null && user.Login_ID != r.LOGIN_ID).ToList()); }