public async Task <Unit> Handle(CreateCheckItemCommand request, CancellationToken cancellationToken) { var user = _userAccessor.GetUser(); var checkItemOrder = (await _context.CheckItems.AnyAsync(x => x.ActivityId == request.ActivityId, cancellationToken) ? (await _context.CheckItems .Where(x => x.ActivityId == request.ActivityId) .MaxAsync(x => x.Order, cancellationToken)) : 0) + 1; var entity = new CheckItem { ActivityId = request.ActivityId, Content = request.Content, Order = checkItemOrder }; entity.CreateEnd(Guid.NewGuid(), "No name provided", Guid.Parse(user.FindFirst(ClaimTypes.NameIdentifier).Value)); entity.ApplicationUserId = Guid.Parse(user.FindFirst(ClaimTypes.NameIdentifier).Value); await _context.CheckItems.AddAsync(entity, cancellationToken); try { await _context.SaveChangesAsync(cancellationToken); } catch (Exception e) { Console.WriteLine(e); throw; } return(Unit.Value); }
//检查纹理的大小 private bool CheckSize(Texture texture, TextureImporter importer, ref CheckItem item) { item.width = texture.width; item.height = texture.height; item.isVailidSize = item.width * item.height < this.maxSpriteWidth * this.maxSpriteHeight; return(item.isVailidSize); }
public void Delete() { var item = FocusedItem; if (item != null) { var result = GetService <IMessageBoxService>() .ShowMessage(messageBoxText: "Delete task?" , caption: "" , button: MessageButton.YesNo , icon: MessageIcon.Question , defaultResult: MessageResult.Yes); if (result == MessageResult.Yes) { var next = item.GetNext(); if (next == null) { next = item.GetPrevious(); } item.Delete(); RaisePropertyChanged(() => DxCheckList); if (next != null) { FocusedItem = next; } } } else { } }
/// <summary> /// 根据CheckItem的hashcode更新ListView指定行 /// </summary> /// <param name="hashCode"></param> private void UpdateCheckList(int hashCode) { ListViewItem lvi = dicCheckItem[hashCode]; CheckItem ci = (CheckItem)lvi.Tag; lvCheckList.BeginUpdate(); lvi.SubItems[2].Text = ci.ParaDate.ActualValue; // 市场日期 lvi.SubItems[3].Text = ci.ParaStatus.ActualValue; // 市场状态 lvi.SubItems[4].Text = ci.IsCheckPassed ? "√" : "×"; // 检查通过 lvi.SubItems[5].Text = ci.Note; // 说明 if (!ci.IsCheckPassed) { lvi.BackColor = Color.Pink; } else { lvi.BackColor = SystemColors.Window; } if (ci.IsRunning) { lvi.BackColor = Color.LightBlue; lvi.EnsureVisible(); } lvCheckList.EndUpdate(); }
public static CheckList CreateDefault() { var cl = new CheckList(); var analize = new CheckItem() { Name = "Анализ" }; var dev = new CheckItem() { Name = "Разработка" }; var test = new CheckItem() { Name = "Тестирование" }; var doc = new CheckItem() { Name = "Документирование" }; cl.Root.Add(analize); cl.Root.Add(dev); cl.Root.Add(test); cl.Root.Add(doc); return(cl); }
public ActionResult DeleteCheckItem(int id, int templateID) { CheckItem checkItem = db.CheckItems.Find(id); if (checkItem != null) { foreach (var c in db.Comments) { if (c.CheckItemID == checkItem.ID) { foreach (var i in db.Images) { if (i.CommentID == c.ID) { db.Images.Remove(i); db.SaveChangesAsync(); } } db.Comments.Remove(c); } } db.CheckItems.Remove(checkItem); db.SaveChanges(); } TemplateModel templateModel = new TemplateModel(); templateModel.Template = db.Templates.Find(templateID); return(Save(templateID, templateModel)); }
internal bool ДобавитьШтрихКод(string barCodeType, string barCode) { if (string.IsNullOrWhiteSpace(barCodeType)) { return(false); } if (string.IsNullOrWhiteSpace(barCode)) { return(false); } var item = new CheckItem { isFiscal = false, Barcode = new Barcode() { BarcodeText = barCode, BarcodeType = barCodeType } }; _items.Add(item); Check.CheckItems = _items.ToArray(); return(true); }
/// <summary> /// Добавляет фискальную позицию в чек ФФД 1.0.5 с учетом скидки /// </summary> /// <param name="Наименование">Наименование позиции</param> /// <param name="ЦенаБезСкидки">Цена без скидки</param> /// <param name="Количество">Количество</param> /// <param name="СуммаСоСкидкой">Сумма со скидкой</param> /// <param name="Отдел">Отдел (Департамент)</param> /// <param name="НДС">НДС</param> /// <param name="ПризнакСпособаРасчета">Признак способа расчета</param> /// <param name="ПризнакПредметаРасчета">Признак предмета расчета</param> /// <remarks> /// Когда скидка уже учетна в сумме, не возникает ошибкок связаных с копейками при расчете скидок. ///<para> /// НДС /// -1 - Без НДС /// 0 - 0 % НДС /// 10 - 10 % НДС /// 18 - 18 % НДС /// 20 - 20 % НДС /// 110 - 110 % НДС /// 118 - 118 % НДС /// 120 - 120 % НДС /// </para> /// <para> /// Признак предмета расчета /// НеПрименяется = 0, /// ПредоплатаПолная = 1, /// ПредоплатаЧастичная = 2, /// Аванс = 3, /// ПередачаСПолнойОплатой = 4, /// ПередачСЧастичнойОплатой = 5, /// ПередачабезОплаты = 6, /// ОплатаКредита = 7, /// НеПрименяется = 0 /// </para> /// <para> /// Признак способа расчета /// Возможные значения /// Товар = 1, /// ПодакцизныйТовар = 2, /// Работа = 3, /// Услуга = 4, /// ПриемСтавок = 5, /// ВыплатаВыигрышейВАзартныхИграх = 6, /// РеализацияЛотерейныхБилетов = 7, /// ВыплатаВыигрышейВЛотереях = 8, /// ПравНаИспользованиеИнтелектуальнойДеятельности = 9, /// АвансЗадатокПредоплатаКредит = 10, /// ПредметРасчета = 11, /// ПредметРасчетаНеОтносящийсяКПредметамРасчета = 12, /// НеПрименяется13 = 13 /// </para>> /// </remarks>> public void ДобавитьПозициюСУчетомСкидки(string Наименование, double ЦенаБезСкидки, double Количество, double СуммаСоСкидкой, int Отдел, double НДС, int ПризнакСпособаРасчета, int ПризнакПредметаРасчета) { decimal скидка = (decimal)(Math.Round(ЦенаБезСкидки * Количество, 2, MidpointRounding.AwayFromZero) - СуммаСоСкидкой); var item = new CheckItem { isFiscal = true, After = new PrintLine(), Before = new PrintLine(), Quantity = (decimal)Количество, Name = Наименование, Price = (decimal)ЦенаБезСкидки, Department = Отдел, DiscountValue = 0, DiscountInfoValue = скидка, ItemType = (ItemTypes)ПризнакПредметаРасчета, PaymentMode = (PaymentModes)ПризнакСпособаРасчета }; item.Summ = (decimal)СуммаСоСкидкой; // Если скидка полностью покрывает сумму оплаты if (item.Summ == Math.Round(скидка, 2, MidpointRounding.AwayFromZero)) { // обнуляем цену позиции, // чтобы пройти валидацию на сервере в FRbase.CheckData() item.Price = 0; } ConvertNDS(НДС, item); _items.Add(item); Check.CheckItems = _items.ToArray(); }
/// <summary> /// 인터넷 익스플로러 취약성 점검 /// 레지스트리를 통해 인터넷 익스플로러 취약성을 검토 /// </summary> /// <param name="item"></param> public static void Diagnosis_MA_001(CheckItem item) { string value = GreyWnReg.GetRegistryValue("SOFTWARE\\Microsoft\\Internet Explorer", "svcUpdateVersion", GreyWnReg.Hive.LocalMachine); int MajorIeVersion; if (int.TryParse(value.Split('.').First(), out MajorIeVersion)) { if (MajorIeVersion >= 11) { item.Proofs["IeVersion"] = value; item.Status = Result.Fulfilled; } else { item.Status = Result.Negative; } } else { item.Status = Result.Negative; } // 진단 시작 }
private void ButtonOpenCheckItemClick(object sender, RoutedEventArgs e) { CheckItem window = new CheckItem(); window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.Show(); }
/// <summary> /// Add product to check /// </summary> /// <param name="code"></param> /// <param name="quantity"></param> /// <exception cref="ArgumentNullException">When `code` is null or empty</exception> /// <exception cref="ArgumentException">When `quantity` is not positive number</exception> public bool Scan(string code, int quantity = 1) { if (string.IsNullOrWhiteSpace(code)) { throw new ArgumentNullException(nameof(code)); } if (quantity <= 0) { throw new ArgumentException($"{nameof(quantity)} should be positive number."); } if (_scannedProducts.TryGetValue(code, out var item)) { item.AddItems(quantity); return(true); } var product = _productRepository.GetProduct(code); if (product != null) { _scannedProducts[code] = new CheckItem(product, quantity); return(true); } var discount = _discountRepository.GetDiscount(code); if (discount != null) { _discounts.Add(discount); return(true); } return(false); }
/**Carga el directorio pasado por parametros al TreeNode del treeView*/ private void LoadSubDirectories(string dir, CheckItem td, TreeView treeView, string categName) { // Get all subdirectories string[] subdirectoryEntries = Directory.GetDirectories(dir); // Loop through them to see if they have any other subdirectories DirectoryInfo di; CheckItem tds; bool exists; foreach (string subdirectory in subdirectoryEntries) { if (AppMAnager.DirectoryHasMediaFiles(subdirectory)) { di = new DirectoryInfo(subdirectory); exists = DBManager.MediaFilesRepo.Exists(di.FullName); if (td != null) { tds = td.AddChild(di.Name, exists, true); } else { tds = new CheckItem(di.Name, exists, true); treeView.Items.Add(tds); } //tds.StateImageIndex = 0; tds.Tag = di; LoadSubDirectories(subdirectory, tds, null, categName); LoadFiles(subdirectory, tds, null, categName); //UpdateProgress(); } } }
public void DeleteCheckItem(int id) { CheckItem post = checkListRepository.Get(id); checkListRepository.Remove(post); checkListRepository.SaveChanges(); }
public FormMain() { this.InitializeComponent(); var itemCount = 16; this._checkItems = new List <CheckedTextBox>(); for (var i = 0; i < itemCount; i++) { var item = new CheckItem() { Label = i.ToString(), Checked = i % 2 == 0, Text = $"Text-{i}" }; var ctrl = new CheckedTextBox() { DataContext = item, Tag = item, Size = new Size(ControlWidth, ControlHeight) }; this._checkItems.Add(ctrl); } this.Controls.AddRange(this._checkItems.ToArray()); this.UpdateLayout(); this.Resize += this.FormMain_Resize; this.Click += this.FormMain_Click; }
/// <summary> /// Handles the <see cref="E:AddFilterClick" /> event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void OnAddFilterClick(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TextBoxAddFilter.Text)) { return; } // Create new extension filter var itemToAdd = $"True;{TextBoxAddFilter.Text}"; // Add and save configuration Settings.Default.FileFilter.Add(itemToAdd); Settings.Default.Save(); // Create item for UI and display it var newFilterExtension = new CheckItem(null, TextBoxAddFilter.Text) { IsChecked = true }; _FileFilterItemSource.Add(newFilterExtension); // Connect changed filter changed event newFilterExtension.PropertyChanged -= OnCheckItemPropertyChanged; CheckListBoxFileFilter.ScrollIntoView(newFilterExtension); }
public void AddItem(CheckItem item) { var vm = _itemFactory().InitializeWith(_cardId, Id, item); Items.Add(vm); UpdateCounts(); }
public ActionResult DeleteConfirmed(int id) { CheckItem checkItem = db.CheckItems.Find(id); db.CheckItems.Remove(checkItem); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Add(CheckItem newCheckItem) { var items = readFromFile(); newCheckItem.ID = getId(items); items.Add(newCheckItem); saveToFile(items); }
/** Si un nodo es un directorio y se selecciona/deselecciona entonces * se refresca la seleccion de todos sus hijos*/ public static void ActualizarSeleccion(CheckItem node) { foreach (CheckItem n in node.Items) { n.SetChecked(node.IsChecked()); ActualizarSeleccion(n); } }
private void addRow(CheckItem checkItem) { var texts = new string[] { checkItem.Text.Replace("\r\n", " ") }; var item = new ListViewItem(texts); item.Group = checklistLv.Groups[checkItem.Type]; item.StateImageIndex = checkItem.Completed ? 1 : 0; checklistLv.Items.Add(item); }
public CheckItemDBInfo(int serviceVisitItemNumber, CheckItem checkItem) { this.serviceVisitItemNumber = serviceVisitItemNumber; this.id = checkItem.Id; this.description = checkItem.Description; this.comment = checkItem.Comment; this.siteEquipmentLineNumber = checkItem.SiteEquipmentLineNumber; this.photoURL = checkItem.PhotoURL; this.status = checkItem.Status.ToString(); this.Primarykey = this.serviceVisitItemNumber.ToString() + this.id.ToString(); }
/// <summary> /// Добавляет не фискальную позицию в чек как текст /// </summary> /// <param name="Текст">Строка текста</param> public void ДобавитьНеФискальнуюПозицию(string Текст) { var item = new CheckItem { isFiscal = false, Name = Текст }; _items.Add(item); Check.CheckItems = _items.ToArray(); }
public CheckItem GetCheckItem() { CheckItem checkItem = new CheckItem(); checkItem.Id = this.id; checkItem.Description = this.description; checkItem.Comment = this.comment; checkItem.SiteEquipmentLineNumber = this.siteEquipmentLineNumber; checkItem.PhotoURL = this.photoURL; checkItem.Status = (ChecklistStatus)Enum.Parse(typeof(ChecklistStatus), this.status); return(checkItem); }
public CheckItemVM(CheckItem cki) { this.checkitem = cki; if (cki.state == "complete") { ischecked = true; } else { ischecked = false; } }
private static string ItemToString(CheckItem item) { string str = item.Name + " " + item.Price + "*" + item.Quantity; if (item.DiscountValue != 0) { str += "-" + item.DiscountValue; } str += "=" + item.Summ; str += "\n"; return(str); }
private void InitRadio() { List <Entity.Role> roles = DAL.Role.GetAllRole(); foreach (Entity.Role role in roles) { CheckItem ci = new CheckItem(); ci.Text = role.Description; ci.Value = role.ID.ToString(); Role.Items.Add(ci); } }
public ActionResult Edit([Bind(Include = "ID,Name,SystemID,AreaID")] CheckItem checkItem) { if (ModelState.IsValid) { db.Entry(checkItem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AreaID = new SelectList(db.Areas, "ID", "Name", checkItem.AreaID); ViewBag.SystemID = new SelectList(db.HomeSystems, "ID", "Name", checkItem.SystemID); return(View(checkItem)); }
protected void Page_Init(object sender, EventArgs e) { List <Entity.Role> roles = DAL.Role.GetAllRole(); foreach (Entity.Role role in roles) { CheckItem ci = new CheckItem(); ci.Text = role.Description; ci.Value = role.ID.ToString(); Role.Items.Add(ci); } }
internal void Render(ISpatialDisplay display, IDrawStyle style) { if (m_nCurrent >= 0 && m_nCurrent < m_nTotal) { CheckItem checkResult = m_Cmd.GetResult(m_nCurrent); if (checkResult != null) { checkResult.Render(display, style); checkResult.HighlightCheckedItem(display); } } }
/// <summary> /// This is used to initialize a check list item that has been created and returned from the API /// </summary> public ChecklistItemViewModel InitializeWith(string cardId, string listId, CheckItem item) { using (new SuppressNotificationScope(this)) { _idCard = cardId; _idList = listId; Id = item.Id; Name = item.Name; Checked = false; } return(this); }
void pickUpItem() { RaycastHit hit; if(Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit)) { if(hit.distance < distance) { inv = GameObject.FindGameObjectWithTag("Inventory").GetComponent<Inventory>(); CheckItem check = new CheckItem(); hit.transform.SendMessage("setItemID", check, SendMessageOptions.DontRequireReceiver); inv.SendMessage("AddItem", check.itemID, SendMessageOptions.RequireReceiver); hit.transform.SendMessage("itemCollected", SendMessageOptions.DontRequireReceiver); } } }
void checkItemProximity() { RaycastHit hit1; if(Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit1)) { if(hit1.distance < distance) { check = new CheckItem(); hit1.transform.SendMessage("setItemName", check, SendMessageOptions.DontRequireReceiver); if(check.itemName != null) { showText = true; } else { showText = false; } } else showText = false; } }
void setItemID(CheckItem item) { item.itemID = this.itemID; }
void setItemName(CheckItem item) { item.itemName = this.itemName; }
private List<DocType> ReloadDocTypes() { List<DocType> docTypeList = new List<DocType>(); XDocument xdoc = XDocument.Load(xmlFName); try { var docTypes = from docType in xdoc.Descendants("filetype") orderby docType.Attribute("name").Value select new { name = docType.Attribute("name").Value, good = docType.Descendants("good"), bad = docType.Descendants("bad"), grabtext = docType.Descendants("grabtext"), docdate = docType.Descendants("docdate"), moveto = docType.Descendants("moveto"), renameto = docType.Descendants("renameto"), thumbs = docType.Descendants("thumb") }; //Loop through results foreach (var docType in docTypes) { DocType dt = new DocType(); dt.dtName = docType.name; // Strings required for match foreach (var gd in docType.good) { CheckItem ci = new CheckItem(gd.Value, gd.Attribute("req").Value); dt.goodStrings.Add(ci); } // Strings not required for match foreach (var bd in docType.bad) { CheckItem ci = new CheckItem(bd.Value, bd.Attribute("req").Value); dt.badStrings.Add(ci); } // Text that should be extracted from file foreach (var gt in docType.grabtext) { GrabItem gi = new GrabItem(gt.Attribute("name").Value, gt.Attribute("from").Value, gt.Value); dt.grabTexts.Add(gi); } // Move-to path foreach (var mt in docType.moveto) { dt.moveTo = mt.Value; } // Rename-to value foreach (var rt in docType.renameto) { dt.renameTo = rt.Value; } // Thumbnails foreach (var th in docType.thumbs) { dt.thumbFileNames.Add(th.Value); } // Store the doc-type docTypeList.Add(dt); } } catch { } return docTypeList; }
public bool Compare(CheckItem other) { if (checkString != other.checkString) return false; if (numInstances != other.numInstances) return false; return true; }
public void UpdateItems(CheckItem[] newItems) { if (newItems != null && this.CheckItems != null) { CheckItem[] curItems = this.CheckItems; foreach (CheckItem item in newItems) { int nbItems = curItems.Length; for (int i = 0; i < nbItems; i++) { if (curItems[i].ShortName == item.ShortName) { item.Checked = curItems[i].Checked; break; } } } } this.CheckItems = newItems; }
public void plusClicked(string id) { var product = App.api.getProduct (id)[0]; if (App.check.check_items.Count > 0) { if (App.check.check_items.Exists (e => e.product.id == product.id)) { App.check.check_items.Find (x => x.product.id == product.id).count++; } else { var checkItem = new CheckItem (); checkItem.count = 1; checkItem.title = product.title; checkItem.price = product.price; checkItem.product = product; App.check.check_items.Add (checkItem); } } else { var checkItem = new CheckItem (); checkItem.count = 1; checkItem.title = product.title; checkItem.price = product.price; checkItem.product = product; App.check.check_items.Add (checkItem); } double total = 0; foreach (CheckItem item in App.check.check_items) { total = total + item.count * item.price; } MessagingCenter.Send<FlowProductViewViewModel, string> (this, "total", total.ToString()); Console.WriteLine (id); }