public List <CheckListItem> GetCheckListItems(CheckList checkList) { return(_connection.Query <CheckListItem>("select * from CheckListItem where CheckListId = ?", checkList.Id).ToList()); }
public async Task <int> DeleteCheckListAsync(CheckList model) { _dataSource.CheckLists.Remove(model); return(await _dataSource.SaveChangesAsync()); }
public async Task <IActionResult> Add(CheckList checkList) { var rv = await _checkListRepo.Add(checkList); return(Ok(rv)); }
public void Add(CheckList checkList) { _connection.Insert(checkList); }
public async Task <IActionResult> PutNote([FromRoute] int id, [FromBody] Note note) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await _context.Note.Include(x => x.labels).Include(x => x.checklist).ForEachAsync(x => { if (x.Id == note.Id) { x.Title = note.Title; x.text = note.text; foreach (Labels y in note.labels) { Labels a = x.labels.Find(z => z.Id == y.Id); if (a != null) { a.label = y.label; } else { Labels lab = new Labels() { label = y.label }; x.labels.Add(lab); } } foreach (CheckList obj in note.checklist) { CheckList c = x.checklist.Find(z => z.Id == obj.Id); if (c != null) { c.Check = obj.Check; c.isChecked = obj.isChecked; } else { CheckList a = new CheckList { Check = obj.Check, isChecked = obj.isChecked }; x.checklist.Add(a); } } } }); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NoteExists(id)) { return(NotFound()); } else { throw; } } //return CreatedAtAction(nameof(GetNoteByPrimitive), new //{ // note //}); return(Ok(note)); }
public string ObtenerComentarios(CheckList checklist) { string comentarios1 = ""; string comentarios2 = ""; string comentarios3 = ""; string comentarios4 = ""; string prioridad1 = ""; string prioridad2 = ""; string prioridad3 = ""; string prioridad4 = ""; if (checklist.Prioridad1 == 0) { prioridad1 = "BAJA"; } else if (checklist.Prioridad1 == 1) { prioridad1 = "MEDIA"; } else if (checklist.Prioridad1 == 2) { prioridad1 = "ALTA"; } if (checklist.Prioridad2 == 0) { prioridad2 = "BAJA"; } else if (checklist.Prioridad2 == 1) { prioridad2 = "MEDIA"; } else if (checklist.Prioridad2 == 2) { prioridad2 = "ALTA"; } if (checklist.Prioridad3 == 0) { prioridad3 = "BAJA"; } else if (checklist.Prioridad3 == 1) { prioridad3 = "MEDIA"; } else if (checklist.Prioridad3 == 2) { prioridad3 = "ALTA"; } if (checklist.Prioridad4 == 0) { prioridad4 = "BAJA"; } else if (checklist.Prioridad4 == 1) { prioridad4 = "MEDIA"; } else if (checklist.Prioridad4 == 2) { prioridad4 = "ALTA"; } if (checklist.Observacion1 != "" && checklist.Observacion1 != null) { comentarios1 = checklist.Observacion1 + " - PRIORIDAD " + prioridad1; } if (checklist.Observacion2 != "" && checklist.Observacion2 != null) { comentarios2 = checklist.Observacion2 + " - PRIORIDAD " + prioridad2; } if (checklist.Observacion3 != "" && checklist.Observacion3 != null) { comentarios3 = checklist.Observacion3 + " - PRIORIDAD " + prioridad3; } if (checklist.Observacion4 != "" && checklist.Observacion4 != null) { comentarios4 = checklist.Observacion4 + " - PRIORIDAD " + prioridad4; } string comentarios = comentarios1 + "\n" + comentarios2 + "\n" + comentarios3 + "\n" + comentarios4; return(comentarios); }
private bool IsExistInCurrentList(CheckList o) { var flag = SelectedCheckLists.Any(e => e.Id == o.Id); return(flag); }
public async Task <ActionResult <CheckList> > Post([FromBody] CheckList checkList) { /*CheckList check = new CheckList() * { * NombreP = checkList.NombreP, * Transporteur = checkList.Transporteur, * Tracteur = checkList.Tracteur, * Date = checkList.Date, * CatchAll = BsonDocument.Parse(checkList.CatchAll.ToString()) * };*/ var blockage = new Blockage(); var jsonDoc = JsonConvert.SerializeObject(checkList.CatchAll); checkList.CatchAll = BsonSerializer.Deserialize <Dictionary <string, object> >(jsonDoc); System.Diagnostics.Debug.WriteLine(jsonDoc); System.Diagnostics.Debug.WriteLine(checkList.CatchAll); var conducteur = _conducteurRepo.GetConducteurByCIN(checkList.Conducteur["cin"]); var vehicule = _vehiculeRepo.GetVehiculeByMatricule(checkList.Vehicule["matricule"]); var site = _siteRepo.GetSiteByLibelle(checkList.Site); var conducteurID = conducteur != null ? conducteur.Id : -1; var vehiculeID = vehicule != null ? vehicule.Id : -1; var siteID = site != null ? site.Id : -1; // var blockageID = -1; if (!string.IsNullOrEmpty(checkList.ImageURL)) { var imagePath = ConvertImage(checkList.ImageURL); checkList.ImageURL = imagePath; /*foreach (var image in checkList.ImagesURL) * { * var imagePath = ConvertImage(image.Value); * checkList.ImagesURL[image.Key] = imagePath; * var imageKey = image.Key; * var index = 0; * foreach (var item in image.Value) * { * var imagePath = ConvertImage(item); * checkList.ImagesURL[imageKey][index] = imagePath; * index++; * System.Diagnostics.Debug.WriteLine("Image Path: " + imagePath); * System.Diagnostics.Debug.WriteLine("Image Index: " + checkList.ImagesURL[imageKey][index]); * } * }*/ } if (conducteur == null) { Conducteur cond = new Conducteur() { Cin = checkList.Conducteur["cin"], NomComplet = checkList.Conducteur["nomComplet"] }; await _conducteurRepo.Create(cond); conducteurID = cond.Id; } if (vehicule == null) { Vehicule vehi = new Vehicule() { Matricule = checkList.Vehicule["matricule"], IdEngin = _vehiculeRepo.GetEnginByName(checkList.Vehicule["engin"]) }; await _vehiculeRepo.Create(vehi); vehiculeID = vehi.Id; } if (site == null) { Site st = new Site() { Libelle = checkList.Site, }; await _siteRepo.Create(site); siteID = st.Id; } checkList.Vehicule["idVehicule"] = vehiculeID.ToString(); checkList.Conducteur["idConducteur"] = conducteurID.ToString(); await _checkListRepo.Create(checkList); System.Diagnostics.Debug.WriteLine(checkList.Id.ToString()); System.Diagnostics.Debug.WriteLine(checkList.Controlleur); _context.CheckListRef.Add(new CheckListRef() { IdCheckListRef = checkList.Id.ToString(), Date = checkList.Date.Value.Date, Rating = checkList.Rating, Etat = checkList.Etat, IdConducteur = conducteurID, IdVehicule = vehiculeID, IdSite = siteID, IdControlleur = Convert.ToInt32(checkList.Controlleur["id"]) }); if (checkList.Etat) { blockage.IdVehicule = vehiculeID; blockage.DateBlockage = checkList.Date.Value.Date; blockage.IdCheckList = checkList.Id; blockage.ImageUrl = checkList.ImageURL; _context.Blockage.Add(blockage); } _context.SaveChanges(); // checkList.Vehicule["idBlockage"] = blockage.IdVehicule != null ? blockage.Id.ToString() : "-1"; // System.Diagnostics.Debug.WriteLine("BlockageID:" + blockageID); return(CreatedAtAction("GetCheckList", new { id = checkList.Id.ToString() }, checkList)); }
public static System.Tuple <int, float>[][] CalculateAveragePrices(int[] counts, int[][] values, CheckList <int> exceptValues) { var valueArray = new System.Collections.Generic.SortedDictionary <int, int> [counts.Length]; for (int i = 0; i < counts.Length; i++) { valueArray[i] = new System.Collections.Generic.SortedDictionary <int, int>(); } int ncount = 0; for (int j = 0; j < values.Length; j++) { if (exceptValues.Contains(j)) { continue; } for (int i = 0; i < valueArray.Length; i++) { int value = values[j][i]; int count = 0; valueArray[i].TryGetValue(value, out count); valueArray[i][value] = count + 1; } ncount++; } System.Tuple <int, float>[][] result = new System.Tuple <int, float> [counts.Length][]; for (int i = 0; i < counts.Length; i++) { result[i] = new System.Tuple <int, float> [valueArray[i].Count]; int count = 0; foreach (var pair in valueArray[i]) { result[i][count] = new System.Tuple <int, float>(pair.Key, pair.Value / (float)ncount); count++; } } return(result); }
public static OfferHolder TestOffer(int[] counts, int[][] values, CheckList <int> exceptValues, int myValues, int[] offer) { float enemyAvr = 0; int count = 0; int enemyMax = 0; int enemyMin = int.MaxValue; int nonZeroCount = 0; int[] valueArray = Utils.ArrayCreate(values.Length); for (int j = 0; j < values.Length; j++) { if (exceptValues.Contains(j)) { continue; } int value = CalculateIncomeForOffer(counts, values[j], offer, true); if (value > 0) { nonZeroCount++; } enemyAvr += value; valueArray[count++] = value; if (value > enemyMax) { enemyMax = value; } if (value < enemyMin) { enemyMin = value; } } if (enemyMin == int.MaxValue) // no valid offers at all { enemyMin = 0; } enemyAvr /= count; float enemyMedian = count % 2 == 1 ? valueArray[count >> 1] : (valueArray[count >> 1] + valueArray[(count >> 1) + 1]) * 0.5f; int myIncome = CalculateIncomeForOffer(counts, values[myValues], offer, false); float score = myIncome - enemyAvr; string offerCode = ""; for (int i = 0; i < offer.Length; i++) { offerCode += offer[i]; } return(new OfferHolder { MyIncome = myIncome, EnemyAverage = enemyAvr, EnemyMedian = enemyMedian, EnemyMin = enemyMin, EnemyMax = enemyMax, Offer = Utils.ArrayClone(offer), OfferCode = offerCode, Options = nonZeroCount, Score = score }); }
IEnumerator PopulateDatabaseElement(CheckList tableName) { WWWForm form = new WWWForm(); form.AddField("tn",tableName.ToString()); form.AddField("pn",TheProject); form.AddField("un",UserName); form.AddField("pw",UserPassword); WWW download = new WWW(TheURL,form); // Debug.Log (); yield return download; //Debug.Log(download.responseHeaders); if((!string.IsNullOrEmpty(download.error))) { print( "Error downloading: " + download.error ); } else { //always save to playerPrefs and load from playerPrefs PlayerPrefs.SetString(tableName.ToString(),download.text); if (download.text.Length > 14000) Debug.LogWarning("String too LONG!!"); else Debug.Log( download.text); switch (tableName) { case CheckList.check_phases: phases = JsonConvert.DeserializeObject<MWMPhasesModel>(PlayerPrefs.GetString(CheckList.check_phases.ToString())); break; case CheckList.check_blocks: blocks = JsonConvert.DeserializeObject<MWMBlocksModel>(PlayerPrefs.GetString(CheckList.check_blocks.ToString())); break; case CheckList.check_cores: core = JsonConvert.DeserializeObject<MWMCoresModel>(PlayerPrefs.GetString(CheckList.check_cores.ToString())); break; case CheckList.check_floors: floors = JsonConvert.DeserializeObject<MWMFloorsModel>(PlayerPrefs.GetString(CheckList.check_floors.ToString())); break; case CheckList.check_units: units = JsonConvert.DeserializeObject<MWMUnitsModel>(PlayerPrefs.GetString(CheckList.check_units.ToString())); break; case CheckList.check_aspects: aspects = JsonConvert.DeserializeObject<MWMAspectModel>(PlayerPrefs.GetString(CheckList.check_aspects.ToString())); break; case CheckList.check_bedrooms: bedrooms = JsonConvert.DeserializeObject<MWMBedroomsModel>(PlayerPrefs.GetString(CheckList.check_bedrooms.ToString())); break; case CheckList.check_duplex: duplexs = JsonConvert.DeserializeObject<MWMDuplexModel>(PlayerPrefs.GetString(CheckList.check_duplex.ToString())); break; case CheckList.check_outside: outside = JsonConvert.DeserializeObject<MWMOutsideModel>(PlayerPrefs.GetString(CheckList.check_outside.ToString())); break; case CheckList.check_status: status = JsonConvert.DeserializeObject<MWMStatusModel>(PlayerPrefs.GetString(CheckList.check_status.ToString())); break; case CheckList.check_tenure: tenure = JsonConvert.DeserializeObject<MWMTenureModel>(PlayerPrefs.GetString(CheckList.check_tenure.ToString())); break; case CheckList.check_types: types = JsonConvert.DeserializeObject<MWMTypeModel>(PlayerPrefs.GetString(CheckList.check_types.ToString())); break; case CheckList.check_wheelchair: wheelChairs = JsonConvert.DeserializeObject<MWMWheelchairModel>(PlayerPrefs.GetString(CheckList.check_wheelchair.ToString())); break; case CheckList.check_pricerange: priceRanges = JsonConvert.DeserializeObject<MWMPricerangeModel>(PlayerPrefs.GetString(CheckList.check_pricerange.ToString())); break; case CheckList.check_updates: updateAll = JsonConvert.DeserializeObject<MWMUpdateModel>(PlayerPrefs.GetString(CheckList.check_updates.ToString())); PlayerPrefs.SetInt(tableName.ToString(), updateAll.updates[0].updates_status); break; default: break; } Debug.Log ("done"); } }
void GenerateValueList(CheckList filterOption) { valueList.Clear (); switch (filterOption) { case CheckList.check_blocks: foreach(string block in ReleaseEntityManager.instance.activeBlockList) { if(!valueList.Contains(block)) valueList.Add(block); } valueList.Insert(0, "ALL"); break; case CheckList.check_cores: foreach(string core in ReleaseEntityManager.instance.activeCoreList) { if(!valueList.Contains(core)) { if(ApartmentManager.instance.block.block_name != "ALL") // if the block filter is set, we need to check if this core exists in that block { if (ApartmentManager.instance.CoreNameToBlockName(core) == ApartmentManager.instance.block.block_name) valueList.Add(core); } else valueList.Add(core); } } valueList.Insert(0, "ALL"); break; case CheckList.check_floors: foreach (MWMFloor floor in MWM_CMS_DatabaseManager.instance.floors.floors) { if(!valueList.Contains(floor.floor_name)) { if(ApartmentManager.instance.core.core_name!="ALL") { Debug.Log(" checking if floor exists in core " + ApartmentManager.instance.core.core_name ); if(ApartmentManager.instance.CoreIdToName(floor.floor_core) == ApartmentManager.instance.core.core_name) valueList.Add(floor.floor_name); } else valueList.Add(floor.floor_name); } } // sort out ordering for LGs Gs if(valueList.Contains("LG")) { valueList.Remove("LG"); valueList.Insert(0,"LG"); } valueList.Insert(0, "ALL"); break; case CheckList.check_bedrooms: foreach(MWMBedroom bedroomType in MWM_CMS_DatabaseManager.instance.bedrooms.bedrooms) { if(!valueList.Contains(bedroomType.bedroom_name)) valueList.Add(bedroomType.bedroom_name); } valueList.Insert(0, "ALL"); break; case CheckList.check_types: foreach(MWMType type in MWM_CMS_DatabaseManager.instance.types.types) { if(!valueList.Contains(type.type_name)) valueList.Add(type.type_name); } valueList.Insert(0, "ALL"); break; case CheckList.check_aspects: foreach(MWMAspect aspect in MWM_CMS_DatabaseManager.instance.aspects.aspects) { if(!valueList.Contains(aspect.aspect_name)) valueList.Add(aspect.aspect_name); } valueList.Insert(0, "ALL"); break; case CheckList.check_status: foreach(MWMStatus status in MWM_CMS_DatabaseManager.instance.status.statuses) { if(!valueList.Contains(status.status_name)) valueList.Add(status.status_name); } valueList.RemoveAt(0); valueList.Insert(0, "ALL"); break; case CheckList.check_pricerange: foreach(MWMPricerange _priceRange in MWM_CMS_DatabaseManager.instance.priceRanges.priceranges) { string newPriceRange = "£" + _priceRange.pricerange_start.ToString().Insert(3,",") +"-" + "£" +_priceRange.pricerange_end.ToString().Insert(3,",") ; if(!valueList.Contains(newPriceRange)) valueList.Add(newPriceRange); } valueList.RemoveAt(0); valueList.Insert(0, "ALL"); break; default: break; } }
void HandleFilterOptionChangedAction(CheckList Option) { //Debug.Log (" filter option changed received by filter button " + filterOption.ToString()); //Logic to decide which filter needs to regenerate switch (Option) { case CheckList.check_blocks: if (filterOption != CheckList.check_blocks) CreateButtons() ; break; case CheckList.check_cores: if (filterOption != CheckList.check_blocks && filterOption != CheckList.check_cores) CreateButtons(); break; case CheckList.check_floors: if ((filterOption != CheckList.check_blocks && filterOption != CheckList.check_cores) && filterOption != CheckList.check_floors ) CreateButtons(); break; default: break; } }
public async Task <IActionResult> Update(CheckList checklist) { return(Ok(await _rep.Update(checklist))); }
public Control CreateControl(ControlType controlType) { var result = default(Control); switch (controlType) { case ControlType.FreeText: result = new FreeText { ControlType = ControlType.FreeText, Text = Resource.FreeTextDefaultText, FontSize = 12, Color = "#000000", Strong = false }; break; case ControlType.TextBox: result = new TextBox { ControlType = ControlType.TextBox, Label = Resource.TextBoxLabel, Size = 200, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { ValidationType = ValidationType.Required, IsRequired = false }, new ValidationRules.Length { ValidationType = ValidationType.Length } } }; break; case ControlType.Number: result = new Number { ControlType = ControlType.Number, Label = Resource.NumberLabel, Size = 200, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { ValidationType = ValidationType.Required, IsRequired = false }, new ValidationRules.Length { ValidationType = ValidationType.Length }, new ValidationRules.Number { ValidationType = ValidationType.Number } } }; break; case ControlType.Email: result = new Email { ControlType = ControlType.Number, Label = Resource.EmailLabel, Size = 200, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { ValidationType = ValidationType.Required, IsRequired = false }, new ValidationRules.Length { ValidationType = ValidationType.Length }, new ValidationRules.Email { ValidationType = ValidationType.Email } } }; break; case ControlType.FormattedNumber: result = new FormattedNumber { ControlType = ControlType.FormattedNumber, Label = Resource.FormattedNumberLabel, Separator = FormSettings.DEFAULT_FORMAT_SEPARATOR, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { ValidationType = ValidationType.Required, IsRequired = false }, new ValidationRules.FormattedNumber { ValidationType = ValidationType.FormattedNumber } } }; break; case ControlType.DropDown: result = new DropDown { ControlType = ControlType.DropDown, Label = Resource.DropDownLabel, Value = 0.ToString(), EmptyOption = new Option{Id = -1, Value = string.Empty}, Options = new List<Option> { new Option{Id = 1, Value = Resource.FirstOption}, new Option{Id = 2, Value = Resource.SecondOption}, new Option{Id = 3, Value = Resource.ThirdOption} }, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { IsRequired = false, ValidationType = ValidationType.Required } } }; break; case ControlType.CheckList: result = new CheckList { ControlType = ControlType.CheckList, Label = Resource.CheckListLabel, OptionLayoutType = OptionLayoutType.OneColumn, SelectedValues = new List<int>{}, Options = new List<Option> { new Option{Id = 1, Value = Resource.FirstOption}, new Option{Id = 2, Value = Resource.SecondOption}, new Option{Id = 3, Value = Resource.ThirdOption} }, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { IsRequired = false, ValidationType = ValidationType.Required } } }; break; case ControlType.OptionList: result = new OptionList { ControlType = ControlType.OptionList, Label = Resource.OptionListLabel, OptionLayoutType = OptionLayoutType.OneColumn, AllowOther = false, OtherValue = string.Empty, OtherOption = new Option { Id = -1, Value = Resource.OtherValue }, Options = new List<Option> { new Option{Id = 1, Value = Resource.FirstOption}, new Option{Id = 2, Value = Resource.SecondOption}, new Option{Id = 3, Value = Resource.ThirdOption} }, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { IsRequired = false, ValidationType = ValidationType.Required } } }; break; default: throw new Exception(Resource.InvalidControlType); break; } return result; }
public JobDetailViewModel(INavigation navigation, Models.MyBookingModel bookingListTap) : base(navigation) { if (Xamarin.Forms.Application.Current.Properties.ContainsKey("AppLocale") && !string.IsNullOrEmpty(Xamarin.Forms.Application.Current.Properties["AppLocale"].ToString())) { languageculture = Xamarin.Forms.Application.Current.Properties["AppLocale"].ToString(); } else { languageculture = "en-US"; } //IsRatingPopup = false; MyBooking = bookingListTap; switch (languageculture) { case "en-US": MyBooking.Category.Name = MyBooking.Category.Name; MyBooking.SubCategory.Name = MyBooking.SubCategory.Name; break; case "fr-FR": MyBooking.Category.Name = MyBooking.Category.Name_French; MyBooking.SubCategory.Name = MyBooking.SubCategory.Name_French; break; case "he-IL": MyBooking.Category.Name = MyBooking.Category.Name_Hebrew; MyBooking.SubCategory.Name = MyBooking.SubCategory.Name_Hebrew; break; case "ru-RU": MyBooking.Category.Name = MyBooking.Category.Name_Russian; MyBooking.SubCategory.Name = MyBooking.SubCategory.Name_Russian; break; } //MyBooking.ServiceProviderProfilePic = IsImagesValid(MyBooking.ServiceProviderProfilePic, ApiHelpers.ApiImageBaseUrl); if (MyBooking.SubSubCategories != null && MyBooking.SubSubCategories.Count > 0) { IsSubsubCategoryVisible = true; foreach (var item in MyBooking.SubSubCategories) { switch (languageculture) { case "en-US": item.Name = item.Name; break; case "fr-FR": item.Name = item.Name_French; break; case "he-IL": item.Name = item.Name_Hebrew; break; case "ru-RU": item.Name = item.Name_Russian; break; } SubSubCategoryList.Add(item); } SubSubCategoryHeight = SubSubCategoryList.Count * 70; } else { IsSubsubCategoryVisible = false; } if ((string.IsNullOrEmpty(MyBooking.Description) || string.IsNullOrWhiteSpace(MyBooking.Description)) && (MyBooking.ReferenceImages == null || MyBooking.ReferenceImages.Count == 0)) { IsRefDescriptionVisible = false; } else { IsRefDescriptionVisible = true; if (MyBooking.ReferenceImages != null && MyBooking.ReferenceImages.Count > 0) { IsRefImagesVisible = true; foreach (var item in MyBooking.ReferenceImages) { ReferenceImagesList.Add(new ReferenceImagesModel() { ReferenceImages = IsImagesValid(item, ApiHelpers.ReferenceImageBaseUrl) }); } } else { IsRefImagesVisible = false; } if (string.IsNullOrEmpty(MyBooking.Description) || string.IsNullOrWhiteSpace(MyBooking.Description)) { IsJobDescriptionVisible = false; } else { IsJobDescriptionVisible = true; } } if (MyBooking.JobStatus == Convert.ToInt32(RequestStatus.Completed)) { if (MyBooking.UserJobRating != null && MyBooking.UserRating != null && MyBooking.UserJobRating.Value != 0 && MyBooking.UserRating.Value != 0) { JobRatingIcon = string.Empty; } else { JobRatingIcon = "ic_customer_rating.png"; } //if(MyBooking.PaymentMethod == Convert.ToInt32(PaymentMethod.ByCreditCard)) //{ // IsPaymentBtnVisible = true; // if(MyBooking.IsPaymentDone != null && MyBooking.IsPaymentDone.Value) // { // PaymentBtnText = AppResource.PaymentBtn1; // PaymentBgColor = Color.FromHex(StaticHelpers.GrayColor); // IsPaymentBtnEnable = false; // } // else // { // PaymentBtnText = AppResource.PaymentBtn; // PaymentBgColor = Color.FromHex(StaticHelpers.BlueColor); // IsPaymentBtnEnable = true; // } //} //else //{ // IsPaymentBtnVisible = false; //} IsPaymentBtnVisible = true; if (MyBooking.IsPaymentDone != null && MyBooking.IsPaymentDone.Value) { PaymentBtnText = AppResource.PaymentBtn1; PaymentBgColor = Color.FromHex(StaticHelpers.GrayColor); IsPaymentBtnEnable = false; } else { PaymentBtnText = AppResource.PaymentBtn; PaymentBgColor = Color.FromHex(StaticHelpers.BlueColor); IsPaymentBtnEnable = true; } } else { JobRatingIcon = string.Empty; } if (MyBooking.CheckList != null && MyBooking.CheckList.Count > 0) { IsCheckList = true; foreach (var item in MyBooking.CheckList) { CheckList.Add(new CheckListModel() { CheckListValue = item.TaskDetail, CheckListCheck = item.IsDone.HasValue && item.IsDone.Value == true ? "ic_register_check.png" : "ic_uncheked.png", }); CheckListHeight = (50 * CheckList.Count) + 10; } } else { IsCheckList = false; } }
public async Task <string> Execute(CheckList checklist, int idAppointment, DateTime dateTimeDelivery, string path) { if (idAppointment == 0) { throw new NotFoundRegisterException("Appointment não Encontrado. Verifique"); } var appointment = await _repository.FindById(idAppointment); if (appointment == null) { throw new NotFoundRegisterException("Appointment não Encontrado. Verifique"); } if (appointment.DateTimeCollected == null) { throw new NotFoundRegisterException("Carro não foi alocado. Verifique para realizar vistória."); } if (appointment.DateTimeCollected > dateTimeDelivery) { throw new DateTimeColectedInvalidException("A data de devolução é menor que a data coletada. Verifique para realizar vistória."); } appointment.DateTimeDelivery = dateTimeDelivery; appointment.Inspected = true; if (!checklist.CleanCar) { appointment.AdditionalCosts = appointment.Amount * 0.30; } if (!checklist.FullTank) { appointment.AdditionalCosts = appointment.Amount * 0.30; } if (checklist.Crumpled) { appointment.AdditionalCosts = appointment.Amount * 0.30; } if (checklist.Scratches) { appointment.AdditionalCosts = appointment.Amount * 0.30; } string pdf; if (appointment.IdCheckList != null) { checklist.Id = (int)appointment.IdCheckList; await _repository.Update(appointment); await _repositoryCheckList.Update(checklist); pdf = CheckListPaymentPDF.Writer(appointment); return(_servicePDF.Build(path, pdf)); } await _repository.Update(appointment); await _repositoryCheckList.Add(checklist); pdf = CheckListPaymentPDF.Writer(appointment); return(_servicePDF.Build(path, pdf)); }
//temoprary - needed to avoid empty action call void HandleFilterOptionChangedAction(CheckList option) { }
/// <summary> /// Updates the Final Punch cell. /// </summary> /// <param name="parentController">Parent controller.</param> /// <param name="itemTableView">Item table view.</param> /// <param name="indexPath">Index path.</param> /// <param name="checkLstItem">Check lst item.</param> public void UpdateCell(InspectionViewController parentController, UITableView itemTableView, NSIndexPath indexPath, CheckList checkLstItem) { ResetUIView(); UpdateUIContent(checkLstItem); weakUITableView = new WeakReference(itemTableView); Parent = new WeakReference(parentController); var textDelegate = new FinalPunchTextViewDelegate(this, itemTableView); CommentsTextView.WeakDelegate = textDelegate; takePictureBtn.TouchUpInside -= takePictureBtn_TouchUpInside; takePictureBtn.TouchUpInside += takePictureBtn_TouchUpInside; punchSegmentControl.ValueChanged -= PunchSegmentControl_ValueChanged; punchSegmentControl.ValueChanged += PunchSegmentControl_ValueChanged; LoadPunchItemImages(); if (checkLstItem.Result == ResultType.PASS || checkLstItem.Result == ResultType.FAIL) { takePictureBtn.Enabled = true; takePictureBtn.BackgroundColor = UIColor.FromRGB(19, 95, 160); takePictureBtn.SetTitleColor(UIColor.White, UIControlState.Disabled); } else { takePictureBtn.Enabled = false; takePictureBtn.BackgroundColor = UIColor.LightGray; takePictureBtn.SetTitleColor(UIColor.Black, UIControlState.Disabled); } parentController.buttonStyleRefresh(null); }
public string ObtenerItemsFaltantes(CheckList checklist) { string itemsFaltantes = ""; if (checklist.SistemaDireccion == "0") { itemsFaltantes = itemsFaltantes + "- Sistema de Dirección\n"; } if (checklist.SistemaFrenos == "0") { itemsFaltantes = itemsFaltantes + "- Sistema de Frenos\n"; } if (checklist.Faros == "0") { itemsFaltantes = itemsFaltantes + "- Faros (delanteros y posteriores)\n"; } if (checklist.LucesDireccionales == "0") { itemsFaltantes = itemsFaltantes + "- Luces Direccionales\n"; } if (checklist.Asientos == "0") { itemsFaltantes = itemsFaltantes + "- Asientos\n"; } if (checklist.Cinturones == "0") { itemsFaltantes = itemsFaltantes + "- Cinturones en cada asiento\n"; } if (checklist.Vidrios == "0") { itemsFaltantes = itemsFaltantes + "- Vidrios\n"; } if (checklist.LimpiaParabrisas == "0") { itemsFaltantes = itemsFaltantes + "- Limpia Parabrisas\n"; } if (checklist.EspejoInterno == "0") { itemsFaltantes = itemsFaltantes + "- Espejos Retrovisores Internos\n"; } if (checklist.EspejoExterno == "0") { itemsFaltantes = itemsFaltantes + "- Espejos Retrovisores Externos\n"; } if (checklist.NivelAceite == "0") { itemsFaltantes = itemsFaltantes + "- Nivel de Aceite\n"; } if (checklist.NivelAgua == "0") { itemsFaltantes = itemsFaltantes + "- Nivel de Agua / Refrigerante\n"; } if (checklist.Combustible == "0") { itemsFaltantes = itemsFaltantes + "- Combustible\n"; } if (checklist.Claxon == "0") { itemsFaltantes = itemsFaltantes + "- Claxon\n"; } if (checklist.AlarmaRetorceso == "0") { itemsFaltantes = itemsFaltantes + "- Alarma de retroceso\n"; } if (checklist.RelojesIndicadores == "0") { itemsFaltantes = itemsFaltantes + "- Relojes Indicadores / Panel de Control\n"; } if (checklist.Neumaticos == "0") { itemsFaltantes = itemsFaltantes + "- Neumáticos\n"; } if (checklist.NeumaticoRepuesto == "0") { itemsFaltantes = itemsFaltantes + "- Neumático de repuesto\n"; } if (checklist.Extintor == "0") { itemsFaltantes = itemsFaltantes + "- Extintor PQS tipo ABC\n"; } if (checklist.ConosSeguridad == "0") { itemsFaltantes = itemsFaltantes + "- Conos de Seguridad (02)\n"; } if (checklist.SogaArrastre == "0") { itemsFaltantes = itemsFaltantes + "- Soga de arrastre\n"; } if (checklist.Botiquin == "0") { itemsFaltantes = itemsFaltantes + "- Botiquín\n"; } if (checklist.HerramientasLlaves == "0") { itemsFaltantes = itemsFaltantes + "- Herramienta y llave de ruedas\n"; } if (checklist.GataPalanca == "0") { itemsFaltantes = itemsFaltantes + "- Gata y Palanca\n"; } if (checklist.Triangulo == "0") { itemsFaltantes = itemsFaltantes + "- Triángulos de seguridad (02)\n"; } if (checklist.Linterna == "0") { itemsFaltantes = itemsFaltantes + "- Linterna\n"; } if (checklist.Cunas == "0") { itemsFaltantes = itemsFaltantes + "- Cuñas\n"; } if (checklist.Carroceria == "0") { itemsFaltantes = itemsFaltantes + "- Carrocería\n"; } if (checklist.Pertiga == "0") { itemsFaltantes = itemsFaltantes + "- Pértiga\n"; } if (checklist.Circulina == "0") { itemsFaltantes = itemsFaltantes + "- Circulina\n"; } return(itemsFaltantes); }
public AddViewController(UIViewController theView, BaseItem ParentTask, long assignedID, int groupID, DateTime duedate) : base(null, true) { this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, delegate { this.DeactivateController(true); }); taskElement = new ImageStringElement("Item", Images.boxImg, delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID) { Kind = TaskKind.Item, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID, ParentID = ParentTask == null ? 0: ParentTask.ID, GroupID = ParentTask == null ? groupID: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task, true), true); }); calendarElement = new ImageStringElement("Calendar Event", Images.AppleCalendar, delegate { this.NavigationController.PopViewControllerAnimated(false); addController = new EKEventEditViewController(); // set the addController's event store to the current event store. addController.EventStore = Util.MyEventStore; addController.Event = EKEvent.FromStore(Util.MyEventStore); if (duedate.Year < 2000) { duedate = DateTime.Today; } addController.Event.StartDate = duedate.AddHours(DateTime.Now.Hour); addController.Event.EndDate = duedate.AddHours(DateTime.Now.Hour + 1); addController.Completed += delegate(object theSender, EKEventEditEventArgs eva) { switch (eva.Action) { case EKEventEditViewAction.Canceled: theView.NavigationController.DismissModalViewControllerAnimated(true); break; case EKEventEditViewAction.Deleted: theView.NavigationController.DismissModalViewControllerAnimated(true); break; case EKEventEditViewAction.Saved: theView.NavigationController.DismissModalViewControllerAnimated(true); break; } }; theView.NavigationController.PresentModalViewController(addController, true); }); checkListElement = new ImageStringElement("List", Images.checkListImage, delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new CheckList(assignedID) { Kind = TaskKind.List, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID, ParentID = ParentTask == null ? 0: ParentTask.ID, GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; var taskVC = new DetailViewController(task, true); taskVC.TaskListSaved += savedTask => { theView.NavigationController.PushViewController(new TaskViewController(savedTask.Description, true, savedTask), true); }; theView.NavigationController.PushViewController(taskVC, true); }); phoneCallElement = new ImageStringElement("Phone Call", Images.phoneImg, delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID) { Kind = TaskKind.PhoneCall, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID, ParentID = ParentTask == null ? 0: ParentTask.ID, GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task, true), true); }); emailElement = new ImageStringElement("Send an Email", Images.emailImg, delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID) { Kind = TaskKind.Email, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID, ParentID = ParentTask == null ? 0: ParentTask.ID, GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task, true), true); }); websiteElement = new ImageStringElement("Visit a Website", Images.globeImg, delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID) { Kind = TaskKind.VisitAWebsite, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID, ParentID = ParentTask == null ? 0: ParentTask.ID, GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task, true), true); }); Root = new RootElement("Add new item") { new Section() { taskElement, calendarElement, checkListElement, }, new Section() { phoneCallElement, emailElement, websiteElement, } }; /// }
/// <summary> /// Save the specified checklist. /// If the review id exists then update otherwise insert /// </summary> /// <param name="entity">The entity.</param> public void Save(CheckList entity) { using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaCheckListSave", connection)) { var sqlParams = new List <SqlParameter>(); var paramReturnValue = new SqlParameter("@return_value", SqlDbType.Int) { Direction = ParameterDirection.ReturnValue }; sqlParams.Add(paramReturnValue); var checkListId = new SqlParameter("@CheckListId", SqlDbType.Int) { Direction = ParameterDirection.InputOutput, Value = 0, }; sqlParams.Add(checkListId); SqlHelper.AddIntPara(entity.ReviewID, "@ReviewId", sqlParams); // need to allow nullable bit var paraIsClaimDuplicateOverlapping = new SqlParameter("@IsClaimDuplicateOverlapping", SqlDbType.Bit) { Value = AppHelper.ToNullableBool(entity.IsClaimDuplicateOverlapping), IsNullable = true, Direction = ParameterDirection.Input }; var paraIsClaimIncludedInDeedNonPayableOutcomeList = new SqlParameter("@IsClaimIncludedInDeedNonPayableOutcomeList", SqlDbType.Bit) { Value = AppHelper.ToNullableBool(entity.IsClaimIncludedInDeedNonPayableOutcomeList), IsNullable = true, Direction = ParameterDirection.Input }; var paraDoesDocEvidenceMeetGuidelineRequirement = new SqlParameter("@DoesDocEvidenceMeetGuidelineRequirement", SqlDbType.Bit) { Value = AppHelper.ToNullableBool(entity.DoesDocEvidenceMeetGuidelineRequirement), IsNullable = true, Direction = ParameterDirection.Input }; var paraIsDocEvidenceConsistentWithESS = new SqlParameter("@IsDocEvidenceConsistentWithESS", SqlDbType.Bit) { Value = AppHelper.ToNullableBool(entity.IsDocEvidenceConsistentWithESS), IsNullable = true, Direction = ParameterDirection.Input }; var paraIsDocEvidenceSufficientToSupportPaymentType = new SqlParameter("@IsDocEvidenceSufficientToSupportPaymentType", SqlDbType.Bit) { Value = AppHelper.ToNullableBool(entity.IsDocEvidenceSufficientToSupportPaymentType), IsNullable = true, Direction = ParameterDirection.Input }; sqlParams.Add(paraIsClaimDuplicateOverlapping); sqlParams.Add(paraIsClaimIncludedInDeedNonPayableOutcomeList); sqlParams.Add(paraDoesDocEvidenceMeetGuidelineRequirement); sqlParams.Add(paraIsDocEvidenceConsistentWithESS); sqlParams.Add(paraIsDocEvidenceSufficientToSupportPaymentType); SqlHelper.AddVarcharPara(entity.Comment, "@Comment", sqlParams); SqlHelper.AddVarcharPara(entity.CreatedBy, "@CreatedBy", sqlParams); SqlHelper.AddVarcharPara(entity.UpdatedBy, "@UpdatedBy", sqlParams); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); command.ExecuteNonQuery(); if (((Int32)command.Parameters["@return_value"].Value) != 0) { return; } entity.CheckListID = (int)checkListId.Value; } } }
public void CompleteCheckList(CheckList checklist) { checklist.CreationCompleted = true; _context.Entry(checklist).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChangesAsync(); }
public async Task <IActionResult> Update(int id, CheckList newData) { var rv = await _checkListRepo.Update(id, newData); return(Ok(rv)); }
public AddViewController(UIViewController theView, BaseItem ParentTask,long assignedID,int groupID, DateTime duedate) : base(null,true) { this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, delegate{ this.DeactivateController(true); }); taskElement = new ImageStringElement("Item",Images.boxImg,delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID){ Kind = TaskKind.Item, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID , ParentID = ParentTask == null ? 0: ParentTask.ID , GroupID = ParentTask == null ? groupID: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task,true),true); }); calendarElement = new ImageStringElement("Calendar Event",Images.AppleCalendar,delegate { this.NavigationController.PopViewControllerAnimated(false); addController = new EKEventEditViewController(); // set the addController's event store to the current event store. addController.EventStore = Util.MyEventStore; addController.Event = EKEvent.FromStore(Util.MyEventStore); if(duedate.Year < 2000) duedate = DateTime.Today; addController.Event.StartDate = duedate.AddHours(DateTime.Now.Hour); addController.Event.EndDate = duedate.AddHours(DateTime.Now.Hour + 1); addController.Completed += delegate(object theSender, EKEventEditEventArgs eva) { switch (eva.Action) { case EKEventEditViewAction.Canceled : theView.NavigationController.DismissModalViewControllerAnimated(true); break; case EKEventEditViewAction.Deleted : theView.NavigationController.DismissModalViewControllerAnimated(true); break; case EKEventEditViewAction.Saved: theView.NavigationController.DismissModalViewControllerAnimated(true); break; } }; theView.NavigationController.PresentModalViewController(addController,true); }); checkListElement = new ImageStringElement("List",Images.checkListImage, delegate{ this.NavigationController.PopViewControllerAnimated(false); var task = new CheckList(assignedID){ Kind = TaskKind.List, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID , ParentID = ParentTask == null ? 0: ParentTask.ID , GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; var taskVC = new DetailViewController(task,true); taskVC.TaskListSaved += savedTask => { theView.NavigationController.PushViewController(new TaskViewController(savedTask.Description,true,savedTask),true); }; theView.NavigationController.PushViewController(taskVC,true); }); phoneCallElement = new ImageStringElement("Phone Call",Images.phoneImg, delegate{ this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID){ Kind = TaskKind.PhoneCall, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID , ParentID = ParentTask == null ? 0: ParentTask.ID , GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task,true),true); }); emailElement = new ImageStringElement("Send an Email",Images.emailImg,delegate{ this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID){ Kind = TaskKind.Email, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID , ParentID = ParentTask == null ? 0: ParentTask.ID , GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task,true),true); }); websiteElement = new ImageStringElement("Visit a Website",Images.globeImg,delegate{ this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID){ Kind = TaskKind.VisitAWebsite, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID , ParentID = ParentTask == null ? 0: ParentTask.ID , GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task,true),true); }); Root = new RootElement("Add new item") { new Section() { taskElement, calendarElement, checkListElement, }, new Section() { phoneCallElement, emailElement, websiteElement, } }; /// }
public void Update(CheckList checkList) { _connection.Update(checkList); }
public ActionResult Details(CheckListFormViewModel model, OptionsViewModel moreInfo, CheckListTaskVM grid1) { List <Error> errors = new List <Error>(); if (ModelState.IsValid) { if (ServerValidationEnabled) { errors = _hrUnitOfWork.SiteRepository.CheckForm(new CheckParm { CompanyId = CompanyId, ObjectName = "CheckList", TableName = "CheckLists", ParentColumn = "CompanyId", Columns = Models.Utils.GetColumnViews(ModelState.Where(a => !a.Key.Contains('.'))), Culture = Language }); if (errors.Count() > 0) { foreach (var e in errors) { foreach (var errorMsg in e.errors) { ModelState.AddModelError(errorMsg.field, errorMsg.message); } } return(Json(Models.Utils.ParseFormErrors(ModelState))); } } CheckList record; //insert if (model.Id == 0) { record = new CheckList(); _hrUnitOfWork.JobRepository.AddLName(Language, record.Name, model.Name, model.LocalName); AutoMapper(new Models.AutoMapperParm { Destination = record, Source = model, ObjectName = "CheckList", Options = moreInfo, Transtype = TransType.Insert }); record.CreatedUser = UserName; record.CreatedTime = DateTime.Now; record.CompanyId = model.IsLocal ? CompanyId : (int?)null; if (record.StartDate > record.EndDate) { ModelState.AddModelError("EndDate", MsgUtils.Instance.Trls("EndDateGthanStartDate")); return(Json(Models.Utils.ParseFormErrors(ModelState))); } _hrUnitOfWork.CheckListRepository.Add(record); } //update else { record = _hrUnitOfWork.Repository <CheckList>().FirstOrDefault(a => a.Id == model.Id); _hrUnitOfWork.JobRepository.AddLName(Language, record.Name, model.Name, model.LocalName); AutoMapper(new Models.AutoMapperParm { Destination = record, Source = model, ObjectName = "CheckList", Options = moreInfo, Transtype = TransType.Update }); record.ModifiedTime = DateTime.Now; record.ModifiedUser = UserName; record.CompanyId = model.IsLocal ? CompanyId : (int?)null; if (record.StartDate > record.EndDate) { ModelState.AddModelError("EndDate", MsgUtils.Instance.Trls("EndDateGthanStartDate")); return(Json(Models.Utils.ParseFormErrors(ModelState))); } _hrUnitOfWork.CheckListRepository.Attach(record); _hrUnitOfWork.CheckListRepository.Entry(record).State = EntityState.Modified; } // Save grid1 errors = SaveGrid(grid1, ModelState.Where(a => a.Key.Contains("grid")), record); if (errors.Count > 0) { return(Json(errors.First().errors.First().message)); } errors = SaveChanges(Language); var message = "OK"; if (errors.Count > 0) { message = errors.First().errors.First().message; } return(Json(message)); } return(Json(Models.Utils.ParseFormErrors(ModelState))); }
private async Task <bool> FillNodeListWithData(IList <MUXC.TreeViewNode> targetList, CheckList parent, CancellationToken token) { targetList.Clear(); await Task.Delay(CLEAR_DELAY); foreach (CheckList c1 in DataStorage.Singleton.getListsbyFilter(parent.List_ID)) { if (token.IsCancellationRequested || rootToken.IsCancellationRequested) { await semaphore.WaitAsync(); try { targetList.Clear(); await Task.Delay(CLEAR_DELAY); } finally { semaphore.Release(); } return(false); } await semaphore.WaitAsync(); try { targetList.Add(CreateListNode(c1)); await Task.Delay(ADD_DELAY); } finally { semaphore.Release(); } } foreach (CheckPoint c2 in DataStorage.Singleton.getPointsbyFilter(parent.List_ID)) { if (token.IsCancellationRequested || rootToken.IsCancellationRequested) { await semaphore.WaitAsync(); try { targetList.Clear(); await Task.Delay(CLEAR_DELAY); return(false); } finally { semaphore.Release(); } } await semaphore.WaitAsync(); try { targetList.Add(CreatePointNode(c2)); await Task.Delay(ADD_DELAY); } finally { semaphore.Release(); } } return(true); }
private List <Error> SaveGrid(CheckListTaskVM grid1, IEnumerable <KeyValuePair <string, ModelState> > state, CheckList checkList) { List <Error> errors = new List <Error>(); // Deleted if (grid1.deleted != null) { foreach (CheckListTaskViewModel model in grid1.deleted) { var chlistTask = new ChecklistTask { Id = model.Id }; _hrUnitOfWork.CheckListRepository.Remove(chlistTask); } } // Exclude delete models from sever side validations if (ServerValidationEnabled) { var modified = Models.Utils.GetModifiedRows(state.Where(a => !a.Key.Contains("deleted"))); if (modified.Count > 0) { errors = _hrUnitOfWork.CompanyRepository.Check(new CheckParm { CompanyId = CompanyId, ObjectName = "ChecklistTasks", TableName = "ChecklistTasks", Columns = Models.Utils.GetModifiedRows(state.Where(a => !a.Key.Contains("deleted"))), Culture = Language }); if (errors.Count() > 0) { return(errors); } } } // updated records if (grid1.updated != null) { foreach (CheckListTaskViewModel model in grid1.updated) { var chlistTask = new ChecklistTask(); AutoMapper(new Models.AutoMapperParm { Destination = chlistTask, Source = model }); chlistTask.ModifiedTime = DateTime.Now; chlistTask.ModifiedUser = UserName; _hrUnitOfWork.CheckListRepository.Attach(chlistTask); _hrUnitOfWork.CheckListRepository.Entry(chlistTask).State = EntityState.Modified; } } // inserted records if (grid1.inserted != null) { foreach (CheckListTaskViewModel model in grid1.inserted) { var chlistTask = new ChecklistTask(); AutoMapper(new Models.AutoMapperParm { Destination = chlistTask, Source = model }); chlistTask.Checklist = checkList; chlistTask.CreatedTime = DateTime.Now; chlistTask.CreatedUser = UserName; _hrUnitOfWork.CheckListRepository.Add(chlistTask); } } return(errors); }
public async Task <IActionResult> Create(CheckList checklist) { var retorno = await _rep.Create(checklist); return(Ok(retorno)); }
public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) { CheckList item = _vm.Items[indexPath.Row]; _vm.DataService.DeleteCheckList(item); }
public static IQuestionnaire MultiSelectListQuestion(this IQuestionnaire questionnaire, CheckList question) { if (question == null) { throw new System.ArgumentNullException(nameof(question)); } return(questionnaire.Add(question)); }
public void SetSearchCondition(CheckList filterType, string name) { switch (filterType) { case CheckList.check_blocks: { block.block_name = name; break; } case CheckList.check_cores: { core.core_name = name; break; } case CheckList.check_floors: { floor.floor_name = name; floor.floor_id = FloorNameToId(name); break; } case CheckList.check_bedrooms: { bedroom.bedroom_name = name; bedroom.bedroom_id = BedroomNameToId(name); break; } case CheckList.check_aspects: { aspect.aspect_name = name; aspect.aspect_id = AspectNameToId(name); break; } case CheckList.check_types: { type.type_name = name; break; } case CheckList.check_status: status.status_name = name; break; case CheckList.check_pricerange: if (name != "ALL") { string priceStart = name.Replace("£", ""); priceStart = priceStart.Replace(",", ""); priceStart = priceStart.Split('-')[0]; foreach (MWMPricerange price in MWM_CMS_DatabaseManager.instance.priceRanges.priceranges) { if (priceRange.pricerange_start.ToString() == priceStart) { priceRange = price; } } } else { priceRange = new MWMPricerange(); } break; default: break; } FilterOptionChangedAction.Invoke(filterType); }
public InlineKeyboardMarkup BuildWorkListWithMarkup(CheckList checklist, out WorkCheckList workCheckList) { workCheckList = _workCheckListService.CreateWorkCheckList(checklist); return(ResponseMessageHelper.BuildMarkup(workCheckList)); }
/// <summary> /// 設定をファイルに保存 /// </summary> public static void SaveSetting() { FileStream fs = null; XmlTextWriter writer = null; try { fs = new FileStream(SettingPath, FileMode.Create, FileAccess.Write); writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8")); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(true); writer.WriteStartElement("Setting"); writer.WriteStartElement("Header"); writer.WriteStartElement("Name"); writer.WriteAttributeString("name", TwitterAwayInfo.ApplicationName); writer.WriteEndElement(); // End of Name. writer.WriteStartElement("Version"); writer.WriteAttributeString("version", TwitterAwayInfo.VersionNumber); writer.WriteEndElement(); // End of Version. writer.WriteStartElement("Date"); writer.WriteAttributeString("date", DateTime.Now.ToString()); writer.WriteEndElement(); // End of Date. writer.WriteEndElement(); // End of Header. writer.WriteStartElement("Content"); writer.WriteStartElement("User"); writer.WriteAttributeString("name", UserName); writer.WriteAttributeString("password", Password); writer.WriteEndElement(); // End of User writer.WriteStartElement("CheckList"); writer.WriteAttributeString("list", CheckList.ToString()); writer.WriteEndElement(); // End of CheckList writer.WriteStartElement("UpdateTimer"); writer.WriteAttributeString("check", UpdateTimerCheck.ToString()); writer.WriteAttributeString("millsecond", UpdateTimerMillSecond.ToString()); writer.WriteEndElement(); // End of UpdateTimer writer.WriteStartElement("Proxy"); writer.WriteAttributeString("use", ProxyUse.ToString()); writer.WriteAttributeString("server", ProxyServer); writer.WriteAttributeString("port", ProxyPort.ToString()); writer.WriteEndElement(); // End of Porxy writer.WriteStartElement("TwitterListViewColumnWidth"); writer.WriteAttributeString("name", TwitterListViewNameColumnWidth.ToString()); writer.WriteAttributeString("doing", TwitterListViewDoingColumnWidth.ToString()); writer.WriteAttributeString("date", TwitterListViewDateColumnWidth.ToString()); writer.WriteEndElement(); // End of TwitterListViewColumnWidth writer.WriteEndElement(); // End of Content. writer.WriteEndElement(); // End of Setting. writer.WriteEndDocument(); } catch (IOException) { throw; } finally { writer.Close(); fs.Close(); } }
public async Task <IActionResult> Put(string id, [FromBody] CheckList checkList) { var checkListSearch = _checkListRepo.GetCheckListByID(id); if (checkListSearch == null) { return(NotFound()); } var jsonDoc = JsonConvert.SerializeObject(checkList.CatchAll); checkList.CatchAll = BsonSerializer.Deserialize <Dictionary <string, object> >(jsonDoc); var conducteur = _conducteurRepo.GetConducteurByCIN(checkList.Conducteur["cin"]); var vehicule = _vehiculeRepo.GetVehiculeByMatricule(checkList.Vehicule["matricule"]); var site = _siteRepo.GetSiteByLibelle(checkList.Site); var conducteurID = conducteur.Id; var vehiculeID = vehicule.Id; var siteID = site.Id; if (conducteur == null) { Conducteur cond = new Conducteur() { Cin = checkList.Conducteur["cin"], NomComplet = checkList.Conducteur["nomComplet"] }; await _conducteurRepo.Create(cond); conducteurID = cond.Id; } if (vehicule == null) { Vehicule vehi = new Vehicule() { Matricule = checkList.Vehicule["matricule"], IdEngin = _vehiculeRepo.GetEnginByName(checkList.Vehicule["engin"]) }; await _vehiculeRepo.Create(vehi); vehiculeID = vehi.Id; } if (site == null) { Site st = new Site() { Libelle = checkList.Site, }; await _siteRepo.Create(site); siteID = st.Id; } await _checkListRepo.Update(checkList); CheckListRef checkListRef = _context.CheckListRef.FirstOrDefault(x => x.IdCheckListRef == checkList.Id.ToString()); checkListRef.Date = checkList.Date.Value.Date; checkListRef.IdConducteur = conducteurID; checkListRef.IdVehicule = vehiculeID; checkListRef.IdCheckListRef = checkList.Id.ToString(); checkListRef.IdSite = siteID; checkListRef.IdControlleur = Convert.ToInt32(checkList.Controlleur["id"]); _context.Entry(checkListRef).State = EntityState.Modified; _context.SaveChanges(); return(NoContent()); }
public void SetSearchCondition(CheckList filterType, string name) { switch (filterType) { case CheckList.check_blocks: { block.block_name = name; break; } case CheckList.check_cores: { core.core_name = name; break; } case CheckList.check_floors: { floor.floor_name = name; floor.floor_id = FloorNameToId(name); break; } case CheckList.check_bedrooms: { bedroom.bedroom_name = name; bedroom.bedroom_id = BedroomNameToId(name); break; } case CheckList.check_aspects: { aspect.aspect_name = name; aspect.aspect_id = AspectNameToId(name); break; } case CheckList.check_types: { type.type_name = name; break; } case CheckList.check_status: status.status_name = name; break; case CheckList.check_pricerange: if(name!="ALL"){ string priceStart = name.Replace("£",""); priceStart = priceStart.Replace(",",""); priceStart = priceStart.Split('-')[0]; foreach (MWMPricerange price in MWM_CMS_DatabaseManager.instance.priceRanges.priceranges){ if(priceRange.pricerange_start.ToString() == priceStart) priceRange = price; } } else priceRange = new MWMPricerange(); break; default: break; } FilterOptionChangedAction.Invoke(filterType); }