public HttpResponseMessage UpdateDrive([FromBody] JToken jToken) { string id = jToken.Value <string>("driveId"); Guid driveId = Guid.Parse(id); string driverId = jToken.Value <string>("drivedBy"); Guid drivenBy = Guid.Parse(driverId); Enums.Status state = (Enums.Status)Enum.Parse(typeof(Enums.Status), jToken.Value <string>("state")); Location location = new Location(); location.Address = jToken.Value <string>("destination"); location.X = jToken.Value <double>("destinationX"); location.Y = jToken.Value <double>("destinationY"); double price = Double.Parse(jToken.Value <string>("price")); Drive update = null; Driver driver = null; update = DataRepository._driveRepo.RetriveDriveById(driveId); driver = DataRepository._driverRepo.RetriveDriverById(drivenBy); if (update != null && driver != null) { update.State = state; update.Destination = location; update.Price = price; driver.Occupied = false; DataRepository._driverRepo.DriverOccupation(driver); DataRepository._driveRepo.FinishDrive(update); return(Request.CreateResponse(HttpStatusCode.OK, driver)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } }
public ResponseHelper ChangeStatus(int id, Enums.Status status) { var rh = new ResponseHelper(); try { using (var ctx = _dbContextScopeFactory.Create()) { var originalEntry = _courseRepo.Single(x => x.Id == id); originalEntry.Status = status; _courseRepo.Update(originalEntry); ctx.SaveChanges(); rh.SetResponse(true); } } catch (Exception e) { logger.Error(e.Message); rh.SetResponse(false, e.Message); } return(rh); }
public static bool ProductPendingOrDisabled(Enums.Status status) { var statusList = new List <Enums.Status>(); statusList.Add(Enums.Status.Disabled); statusList.Add(Enums.Status.Disabled); return(statusList.Contains(status)); }
private void OnEnable() { isDead = false; status = Enums.Status.enable; for (int i = 0; i < armorImgs.Length; i++) { armorImgs[i] = armorSprites.GetChild(i).GetComponent <Image>(); } }
private void OnEnable() { isDead = false; status = Enums.Status.enable; if (type == Enums.EnemyType.invisible) { invisible = true; } }
public static bool ProductPendingOrDisabled(Enums.Status status) { var statuslist = new List <Enums.Status> (); //validar el estado en que se encuentra el valor // statuslist.Add(Enums.Status.Disabled); statuslist.Add(Enums.Status.Pending); return(statuslist.Contains(status)); }
/// <summary> /// Gets the user based on User ID. /// </summary> /// <param name="userId">The User ID to be loaded.</param> /// <param name="emailAddress">The email address.</param> /// <param name="password">The password.</param> /// <param name="status">The status.</param> /// <returns>Object of <see cref="User" />.</returns> public User GetUser(int? userId, string emailAddress, string password, Enums.Status status) { using (SqlConnection cn = new SqlConnection(_connectionString)) { using (SqlCommand cmd = SqlHelper.GetSqlCommand(DbConstant.StoreProcedure.usp_GetUser, cn, true)) { SqlParameter paramUserId = new SqlParameter(DbConstant.Parameter.Id, userId); cmd.Parameters.Add(paramUserId); SqlParameter paramEmailAddress = new SqlParameter(DbConstant.Parameter.Email, emailAddress); cmd.Parameters.Add(paramEmailAddress); SqlParameter paramPassword = new SqlParameter(DbConstant.Parameter.Password, password); cmd.Parameters.Add(paramPassword); if (status != Enums.Status.NotDefined) { SqlParameter paramStatus = new SqlParameter(DbConstant.Parameter.Status, status); cmd.Parameters.Add(paramStatus); } User user = null; cn.Open(); using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection)) { if (reader.HasRows) { if (reader.Read()) { user = new User(); user.Id = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.Id]); user.FirstName = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.FirstName]); user.LastName = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.LastName]); user.Status = (Enums.Status)TypeConversionUtility.ToByte(reader[DbConstant.DbColumn.Status]); user.UserType = (Enums.UserType)TypeConversionUtility.ToByte(reader[DbConstant.DbColumn.UserType]); user.Email = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.Email]); user.Password = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.Password]); user.ProfileImage = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.ProfileImage]); user.PhoneNumber = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.PhoneNumber]); user.SchoolName = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.SchoolName]); user.DateCreated = TypeConversionUtility.ToDateTime(reader[DbConstant.DbColumn.DateCreated]); user.PromoCode = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.PromoCode]); user.SYId = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.SYId]); user.IsGiftFree = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsGiftFree]); user.IsTaxExempt = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsTaxExempt]); user.RoleId = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.RoleId]); } } } return user; } } }
public void UpdateStatus() { if (status == Enums.Status.disable) { status = Enums.Status.enable; } else { status = Enums.Status.disable; } }
public void SetStatue(ObjInfo item, Enums.Status statue) { if (wins.ContainsValue(item) && statue == Enums.Status.Stoped) { RemoveWindow(item); } else if ((!wins.ContainsValue(item)) && statue != Enums.Status.Stoped) { AddWindow(item, false); } item.Status = statue; }
public void Hide() { WaveSpawner.EnemiesAlive.Remove(gameObject); WaveSpawner.numberOfEnemiesAlive--; if (status == Enums.Status.disable) { return; } status = Enums.Status.disable; Zero(); isDead = true; gameObject.SetActive(false); }
public bool UpdateStatus(string id, Enums.Status status) { var record = RetrieveSMS(id); if (record == null) { return(false); } record.Status = status; _context.ShortMessageService.Update(record); var affected = _context.SaveChanges(); return(affected > 0); }
public static string StatusToString(Enums.Status status) { switch (status) { case Enums.Status.Normal: return("Normal"); case Enums.Status.Moved: return("Moved"); case Enums.Status.Fixed: return("Fixed"); } return(String.Empty); }
public HttpResponseMessage FailedDrive([FromBody] JToken jToken) { string id = jToken.Value <string>("driveId"); Guid driveId = Guid.Parse(id); string driverId = jToken.Value <string>("drivedBy"); Guid drivenBy = Guid.Parse(driverId); Enums.Status state = (Enums.Status)Enum.Parse(typeof(Enums.Status), jToken.Value <string>("state")); Comment comment = new Comment(); comment.CommentId = Guid.NewGuid(); comment.CreatedOn = DateTime.Now; comment.Description = jToken.Value <string>("text"); comment.Grade = jToken.Value <int>("grade"); Drive update = null; Driver driver = null; update = DataRepository._driveRepo.RetriveDriveById(driveId); driver = DataRepository._driverRepo.RetriveDriverById(drivenBy); if (update != null && driver != null) { comment.CreatedBy = driver; comment.CommentedOn = update; update.Comments = comment; update.State = state; driver.Occupied = false; DataRepository._driverRepo.DriverOccupation(driver); DataRepository._commentRepo.AddNewComment(comment); update.Comments.CommentedOn = null; DataRepository._driveRepo.AddComment(update, update.Comments.CommentId); DataRepository._driveRepo.UpdateState(update); return(Request.CreateResponse(HttpStatusCode.OK, update)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } }
private void readProgramVerifyFlash(byte[] array) { Structures.FlashResult buffer = new Structures.FlashResult(); object obj = new Structures.FlashResult(); StructConvert.ByteArrayToStructure(array, ref obj); buffer = (Structures.FlashResult)obj; Enums.Status status = (Enums.Status)buffer.Status; if (status != Enums.Status.OK) { MainWindow.Logger.Error("Ошибка операции: {0}", status); commandOut = Enums.Commands.ZeroCommand; Device.StatusProgress = Enums.StatusProgress.Alarm; Function = Enums.FunctionalMode.Disable; } //Device.AddressOffset += Device.LengthSend; // TODO uncomment if (TaskToProcess == 1) { TaskToProcess = 0; } }
private void readEraseFlash(byte[] array) { Structures.FlashResult buffer = new Structures.FlashResult(); object obj = new Structures.FlashResult(); StructConvert.ByteArrayToStructure(array, ref obj); buffer = (Structures.FlashResult)obj; Enums.Status status = (Enums.Status)buffer.Status; if (status != Enums.Status.OK) { MainWindow.Logger.Error("Ошибка операции: {0}", status); Device.StatusProgress = Enums.StatusProgress.Alarm; Function = Enums.FunctionalMode.Disable; } else { MainWindow.Logger.Trace("Очистка завершена"); Device.StatusProgress = Enums.StatusProgress.Finish; Function = Enums.FunctionalMode.Disable; } commandOut = Enums.Commands.ZeroCommand; }
public Usuario(string Descricao, string Login, string PassWord, Enums.UserPermission Permission, Enums.Status Status) { this.Descricao = Descricao; this.Login = Login; this.PassWord = PassWord; this.Permission = Permission; this.Status = Status; }
/// <summary> /// Gets the user. /// </summary> /// <param name="userId">The user id.</param> /// <param name="emailAddress">The email address.</param> /// <param name="password">The Password</param> /// <param name="status">The is active.</param> /// <returns></returns> public static User FindUserProfile(int? userId = null, string emailAddress = null, string password = null, Enums.Status status = Enums.Status.NotDefined) { var sqlUser = new SqlUser(); return sqlUser.GetUserProfile(userId, emailAddress, password, status); }
/// <summary> /// Gets the user based on User ID. /// </summary> /// <param name="userId">The User ID to be loaded.</param> /// <param name="emailAddress">The email address.</param> /// <param name="password">The password.</param> /// <param name="status">The status.</param> /// <returns>Object of <see cref="User" />.</returns> public User GetUserProfile(int? userId, string emailAddress, string password, Enums.Status status) { using (SqlConnection cn = new SqlConnection(_connectionString)) { using (SqlCommand cmd = SqlHelper.GetSqlCommand(DbConstant.StoreProcedure.usp_GetUserProfile, cn, true)) { SqlParameter paramUserId = new SqlParameter(DbConstant.Parameter.Id, userId); cmd.Parameters.Add(paramUserId); User user = null; cn.Open(); using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection)) { if (reader.HasRows) { if (reader.Read()) { user = new User(); user.Id = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.Id]); user.FirstName = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.FirstName]); user.LastName = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.LastName]); user.Status = (Enums.Status)TypeConversionUtility.ToByte(reader[DbConstant.DbColumn.Status]); user.UserType = (Enums.UserType)TypeConversionUtility.ToByte(reader[DbConstant.DbColumn.UserType]); user.Email = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.Email]); user.Password = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.Password]); user.ProfileImage = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.ProfileImage]); user.PhoneNumber = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.PhoneNumber]); user.SchoolName = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.SchoolName]); user.DateCreated = TypeConversionUtility.ToDateTime(reader[DbConstant.DbColumn.DateCreated]); user.PromoCode = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.PromoCode]); user.SYId = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.SYId]); user.AccountType.Id = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.AccountType]); user.PromoType = (Enums.PromoType)TypeConversionUtility.ToByte(reader[DbConstant.DbColumn.PromoType]); user.IsGiftFree = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsGiftFree]); user.PhoneNumberType = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.PhoneNumberType]); user.Address1 = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.Address1]); user.Address2 = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.Address2]); user.City = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.City]); user.ZipCode = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.ZipCode]); user.SchoolDistrict = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.SchoolDistrict]); user.ApprovedVendor = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.ApprovedVendor]); user.IsTaxExempt = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsTaxExempt]); user.TaxExempt = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.TaxExempt]); user.TaxExemptFile = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.TaxExemptFile]); user.AccountCategory.Id = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.AccountCategory]); user.AccountCategory.CategoryName = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.CategoryName]); user.AccountCategory.IsOther = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsOtherCategoryName]); user.SchoolCampus.Id = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.SchoolCampusId]); user.SchoolCampus.CampusName = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.CampusName]); user.SchoolCampus.IsOther = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsOtherCampus]); user.SchoolType.Id = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.SchoolTypeId]); user.SchoolType.IsOther = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsOtherSchoolType]); user.SchoolType.SchoolTypeName = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.SchoolTypeName]); user.State.Id = TypeConversionUtility.ToInteger(reader[DbConstant.DbColumn.StateId]); user.State.StateName = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.StateName]); user.State.StateCode = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.StateCode]); user.State.IsOther = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsOtherState]); user.IsSchoolDistrictExempt = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsSchoolDistrictExempt]); user.IsActiveCategory = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsActiveCategory]); user.IsProfile = true; user.IsNotifications = TypeConversionUtility.ToBoolean(reader[DbConstant.DbColumn.IsNotifications]); user.CellPhone = TypeConversionUtility.ToStringWithNull(reader[DbConstant.DbColumn.CellPhone]); } } } return user; } } }
public HttpResponseMessage Filters([FromBody] JToken jToken) { List <Drive> filteredDrives = null; List <Drive> allDrives = null; allDrives = DataRepository._driveRepo.GetAllDrives().ToList(); string userId = jToken.Value <string>("userId"); Guid user = Guid.Parse(userId); Enums.Roles role = (Enums.Roles)Enum.Parse(typeof(Enums.Roles), jToken.Value <string>("userRole")); if (allDrives != null) { List <Drive> resultDrives = new List <Drive>(); if (role == Enums.Roles.Customer) { resultDrives = DataRepository._driveRepo.GetAllDrivesForCustomerId(user).ToList();; } else if (role != Enums.Roles.Customer && jToken.Value <string>("whatDrives").Equals("My")) { if (role == Enums.Roles.Dispatcher) { allDrives.RemoveAll(d => (d.ApprovedBy == null) || (d.ApprovedBy.Id != user)); resultDrives = allDrives; } else { allDrives.RemoveAll(d => (d.DrivedBy == null) || (d.DrivedBy.Id != user)); resultDrives = allDrives; } } else { if (role == Enums.Roles.Dispatcher) { resultDrives = allDrives; } else { allDrives.RemoveAll(d => d.State != Enums.Status.Created); resultDrives = allDrives; } } List <Drive> filtered = new List <Drive>(); string sortBy = jToken.Value <string>("sortBy"); if (!sortBy.Equals("None")) { if (sortBy.Equals("Date")) { resultDrives.Sort((d1, d2) => DateTime.Compare(d2.Date, d1.Date)); } else if (sortBy.Equals("Grade")) { resultDrives.RemoveAll(x => x.Comments == null); resultDrives.Sort((d1, d2) => d2.Comments.Grade.CompareTo(d1.Comments.Grade)); } } if (!jToken.Value <string>("filterBy").Equals("State")) { Enums.Status state = (Enums.Status)Enum.Parse(typeof(Enums.Status), jToken.Value <string>("filterBy")); resultDrives.RemoveAll(x => x.State != state); } if (!String.IsNullOrEmpty(jToken.Value <string>("fromDate")) || !String.IsNullOrEmpty(jToken.Value <string>("toDate"))) { if (!String.IsNullOrEmpty(jToken.Value <string>("fromDate"))) { DateTime dateFrom = DateTime.Parse(jToken.Value <string>("fromDate")); if (!String.IsNullOrEmpty(jToken.Value <string>("toDate"))) { DateTime dateTo = DateTime.Parse(jToken.Value <string>("toDate")); resultDrives.RemoveAll(d => (d.Date.Date < dateFrom.Date) || (d.Date.Date > dateTo.Date)); } resultDrives.RemoveAll(d => d.Date.Date < dateFrom.Date); } else { DateTime dateTo = DateTime.Parse(jToken.Value <string>("toDate")); resultDrives.RemoveAll(d => d.Date.Date > dateTo.Date); } } if (!String.IsNullOrEmpty(jToken.Value <string>("gradeFrom")) || !String.IsNullOrEmpty(jToken.Value <string>("gradeTo"))) { if (!String.IsNullOrEmpty(jToken.Value <string>("gradeFrom")) && !jToken.Value <string>("gradeFrom").Equals("Grade")) { resultDrives.RemoveAll(x => x.Comments == null); int gradeFrom = Int32.Parse(jToken.Value <string>("gradeFrom")); if (!String.IsNullOrEmpty(jToken.Value <string>("gradeTo")) && !jToken.Value <string>("gradeTo").Equals("Grade")) { int gradeTo = Int32.Parse(jToken.Value <string>("gradeTo")); resultDrives.RemoveAll(d => (d.Comments.Grade < gradeFrom) || (d.Comments.Grade > gradeTo)); } resultDrives.RemoveAll(d => d.Comments.Grade < gradeFrom); } else { if (!String.IsNullOrEmpty(jToken.Value <string>("gradeTo")) && !jToken.Value <string>("gradeTo").Equals("Grade")) { resultDrives.RemoveAll(x => x.Comments == null); int gradeTo = Int32.Parse(jToken.Value <string>("gradeTo")); resultDrives.RemoveAll(d => d.Comments.Grade > gradeTo); } } } if (!String.IsNullOrEmpty(jToken.Value <string>("priceFrom")) || !String.IsNullOrEmpty(jToken.Value <string>("priceTo"))) { if (!String.IsNullOrEmpty(jToken.Value <string>("priceFrom"))) { double priceFrom = Double.Parse(jToken.Value <string>("priceFrom")); if (!String.IsNullOrEmpty(jToken.Value <string>("priceTo"))) { double priceTo = Double.Parse(jToken.Value <string>("priceTo")); resultDrives.RemoveAll(d => (d.Price < priceFrom) || (d.Price > priceTo)); } resultDrives.RemoveAll(d => d.Price < priceFrom); } else { double priceTo = Double.Parse(jToken.Value <string>("priceTo")); resultDrives.RemoveAll(d => d.Price > priceTo); } } filteredDrives = resultDrives; if (role == Enums.Roles.Dispatcher) { if (jToken.Value <string>("searchRole").Equals("Customer")) { if (!String.IsNullOrEmpty(jToken.Value <string>("filterName")) || !String.IsNullOrEmpty(jToken.Value <string>("filterSurname"))) { resultDrives.RemoveAll(d => d.OrderedBy == null); if (!String.IsNullOrEmpty(jToken.Value <string>("filterName"))) { string name = jToken.Value <string>("filterName"); if (!String.IsNullOrEmpty(jToken.Value <string>("filterSurname"))) { string surname = jToken.Value <string>("filterSurname"); resultDrives.RemoveAll(d => (!d.OrderedBy.Name.ToLower().Contains(name.ToLower())) || (!d.OrderedBy.Surname.ToLower().Contains(surname.ToLower()))); } resultDrives.RemoveAll(d => !d.OrderedBy.Name.ToLower().Contains(name.ToLower())); } else { string surname = jToken.Value <string>("filterSurname"); resultDrives.RemoveAll(d => !d.OrderedBy.Surname.ToLower().Contains(surname.ToLower())); } } filteredDrives = resultDrives; } else if (jToken.Value <string>("searchRole").Equals("Driver")) { if (!String.IsNullOrEmpty(jToken.Value <string>("filterName")) || !String.IsNullOrEmpty(jToken.Value <string>("filterSurname"))) { resultDrives.RemoveAll(d => d.DrivedBy == null); if (!String.IsNullOrEmpty(jToken.Value <string>("filterName"))) { string name = jToken.Value <string>("filterName"); if (!String.IsNullOrEmpty(jToken.Value <string>("filterSurname"))) { string surname = jToken.Value <string>("filterSurname"); resultDrives.RemoveAll(d => (!d.DrivedBy.Name.ToLower().Contains(name.ToLower())) || (!d.DrivedBy.Surname.ToLower().Contains(surname.ToLower()))); } resultDrives.RemoveAll(d => !d.DrivedBy.Name.ToLower().Contains(name.ToLower())); } else { string surname = jToken.Value <string>("filterSurname"); resultDrives.RemoveAll(d => !d.DrivedBy.Surname.ToLower().Contains(surname.ToLower())); } } filteredDrives = resultDrives; } } if (role == Enums.Roles.Driver) { if (jToken.Value <string>("drivesNearMe").Equals("Yes")) { Driver driver = DataRepository._driverRepo.RetriveDriverById(user); resultDrives.RemoveAll(d => (d.DrivedBy == null) || (d.CarType != driver.Car.Type)); resultDrives.Sort(delegate(Drive d1, Drive d2) { if (CalculateLength(driver.Location.X, driver.Location.Y, d1.Address.X, d1.Address.Y) < CalculateLength(driver.Location.X, driver.Location.Y, d2.Address.X, d2.Address.Y)) { return(-1); } else { return(1); } }); } filteredDrives = resultDrives; } return(Request.CreateResponse(HttpStatusCode.OK, filteredDrives)); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }
public void ChangeCurrentAppStatus(Enums.Status status, string statusString) { AppStatusInfo.ChangeCurrentStatus(status, statusString); _appStatusInfoBehaviourSubject.OnNext(AppStatusInfo); }
public JsonResult ChangeStatusByCourse(int id, Enums.Status status) { return(Json( _courseService.ChangeStatus(id, status) )); }