protected override void ProcessPage(Page p, EditStatus edit) { if (p.GetNamespace() != 0) return; p.Load(); var before = p.text; var changes = new List<string>(); Match m; while ((m = MuenzenRegex.Match(p.text)).Success) { var kupfer = 0; var silber = 0; var gold = 0; int.TryParse(m.Groups["kupfer"].Value, out kupfer); int.TryParse(m.Groups["silber"].Value, out silber); int.TryParse(m.Groups["gold"].Value, out gold); var muenzen = kupfer + 100*silber + 10000*gold; p.text = p.text.Replace(m.Value.Trim(), "{{Münzen|" + muenzen + "}}"); changes.Add(string.Format("{0}g {1}s {2}k → {3}", gold, silber, kupfer, muenzen)); } if (changes.Count > 0) { edit.EditComment = string.Format("Münzen ({0}x): {1}", changes.Count, string.Join(", ", changes)); edit.Save = true; } }
private void ClickEdit(object sender, RoutedEventArgs e) { if (DgProj.SelectedIndex == -1) return; ProjectEditStatus = EditStatus.Edit; SendDataToControl(ProjectList[DgProj.SelectedIndex]); SetViewState(ViewState.Editing); }
protected override void ProcessPage(Page p, EditStatus edit) { if (p.GetNamespace() != 0) return; p.Load(); var changes = new List<string>(); p.InsertPlaceholders(GeneralExtensions.Placeholder.Default); foreach (var replacement in Replacements.Where(replacement => p.text.Contains(replacement.Key))) { p.text = p.text.Replace(replacement.Key, replacement.Value); changes.Add(replacement.Key + " → " + replacement.Value); } foreach (var replacement in RegexReplacements) { var pattern = replacement.Key; var replace = replacement.Value; pattern.Replace(p.text, match => { var replaceWith = RegexParseReplaceWithString(match, replace); changes.Add(match.Value + " → " + replaceWith); return replaceWith; }); } p.RemovePlaceholders(); if (changes.Count > 0) { edit.Save = true; edit.EditComment = "Ersetzt: " + string.Join(", ", changes); } }
protected override void ProcessPage(Page p, EditStatus edit) { if (p.GetNamespace() != 0) return; p.Load(); var templates = p.GetAllTemplates().Where(t => t.Title.ToLower() == "infobox gegenstand"); foreach (var template in templates) { if (template.Parameters.ContainsKey("beschreibung") && _regex.IsMatch(template.Parameters["beschreibung"])) { template.Parameters["beschreibung"] = _regex.Replace(template.Parameters["beschreibung"], "[[$1]]"); template.Save(); edit.Save = true; edit.EditComment = "Attribute in Gegenstandsbeschreibung verlinkt"; } } }
protected override void ProcessPage(Page p, EditStatus edit) { if (p.GetNamespace() != 0) return; p.Load(); //Nur Seiten mit Vorlage:Infobox NSC if (p.GetAllTemplates().All(t => t.Title.ToLower() != "infobox nsc")) return; //Nur Seiten, die eine Unterseite mit Angeboten haben... var m = Regex.Match(p.text, "\\{\\{:" + p.title + "/([^}]+)}}"); if (!m.Success) return; var subpageTitle = m.Groups[1].Value; var subpage = new Page(p.site, p.title + "/" + subpageTitle); subpage.Load(); if (!subpage.Exists()) { p.text = p.text.Replace(m.Value, ""); edit.EditComment = "Verweis auf nicht vorhandene Angebots-Unterseite „" + subpage.title + "“ entfernt"; edit.Save = true; } else { var pl2 = new PageList(p.site); pl2.FillFromLinksToPage(subpage.title); if (pl2.Count() > 1) return; var subpageContent = Regex.Replace(subpage.text, "<noinclude>.*?</noinclude>", "").Trim(); p.text = p.text.Replace(m.Value, subpageContent); subpage.text = "{{Löschantrag|[Bot] In den Hauptartikel „[[" + p.title + "]]“ verschoben}}\n" + subpage.text; subpage.Save("[Bot] In Hauptartikel „[[" + p.title + "]]“ verschoben", true); edit.EditComment = "Angebot von „" + subpage.title + "“ in den Hauptartikel verschoben"; edit.Save = true; } }
private void btnInclui_Click(object sender, EventArgs e) { groupBox1.Enabled = false; dgvClientes.Enabled = false; groupBox2.Enabled = true; tbxNOME.Focus(); foreach (Control ctl in groupBox2.Controls) { //if (ctl is TextBox) (ctl as TextBox).Clear(); //if (ctl is TextBox) ((TextBox)ctl).Clear(); if (ctl is TextBox) { ctl.Text = ""; } } recStatus = EditStatus.Inclui; }
/// <summary> /// Returns the color of a field in the matrix. /// </summary> /// <param name="isOne"> /// Is the field set to 1. /// </param> /// <param name="toggle"> /// Is the value of the field changed? /// </param> /// <param name="EditStatus"> /// The edit status of this field, i.e. of this row or column. /// </param> /// <param name="function"> /// What will be drawn with this color. /// </param> /// <returns></returns> public Color this[bool isOne, bool toggle, EditStatus status, ColorFunction function] { get { return(fieldColorSet[ isOne ? 1 : 0, toggle ? 1 : 0, (int)status, (int)function ]); } set { fieldColorSet[ isOne ? 1 : 0, toggle ? 1 : 0, (int)status, (int)function ] = value; } }
public async Task <ICollection <Portfolio> > GetPortfolioByStatus(EditStatus status) { try { var listPortfolioFund = await _unitOfWork.PortfolioFundRepository.FindByAsync(m => m.EditStatus == status); if (listPortfolioFund == null) { throw new NotFoundException(); } var currentPortfolioIds = listPortfolioFund.Select(x => x.PortfolioId).ToList(); var res = await _unitOfWork.PortfolioRepository.FindByAsync(m => currentPortfolioIds.Contains(m.Id) && m.IsDeleted == false); return(res.ToList()); } catch (Exception ex) { throw ex; } }
public RequestStatus GetStatus(EditStatus editStatus, int apprenticeshipCount, LastAction lastAction, AgreementStatus?overallAgreementStatus) { bool hasApprenticeships = apprenticeshipCount > 0; if (editStatus == EditStatus.Both) { return(RequestStatus.Approved); } if (editStatus == EditStatus.ProviderOnly) { return(GetProviderOnlyStatus(lastAction, hasApprenticeships)); } if (editStatus == EditStatus.EmployerOnly) { return(GetEmployerOnlyStatus(lastAction, hasApprenticeships, overallAgreementStatus)); } return(RequestStatus.None); }
/// <summary> /// Initializes a new instance of the <see cref="MongoHistoryPart"/> class. /// </summary> /// <param name="part">The part.</param> /// <exception cref="ArgumentNullException">part</exception> public MongoHistoryPart(IPart part) { if (part == null) { throw new ArgumentNullException(nameof(part)); } Id = Guid.NewGuid().ToString(); ItemId = part.ItemId; TypeId = part.TypeId; RoleId = part.RoleId; ThesaurusScope = part.ThesaurusScope; TimeCreated = part.TimeCreated; CreatorId = part.CreatorId; TimeModified = part.TimeModified; UserId = part.UserId; ReferenceId = part.Id; Status = EditStatus.Created; }
private void btnIncluiAltera_Click(object sender, EventArgs e) { // descobrir qual botão foi clicado ToolStripButton btn = (ToolStripButton)sender; // sinalizar o tipo de operação if (btn.Tag.ToString() == "I") { RecStatus = EditStatus.Inclui; } else { RecStatus = EditStatus.Altera; } // devolve a linha selecionada no grid int id = getIdProduto(); // criar o form de edição FormProdutosEdicao frm = new FormProdutosEdicao(id); if (frm.ShowDialog() == DialogResult.OK) { // atualizar a consulta btnFiltra.PerformClick(); // reposicionar o ponteiro no registro que foi // alterado/incluido var prod = produtos .Where(p => p.ID_PRODUTO == frm.IdProduto); if (prod.Count() > 0) { int pos = produtos.IndexOf(prod.First()); bsProdutos.Position = pos; // NÃO FUNCIONA QUANDO BindinSource está associado // à um List //bsProdutos.Find("ID_PRODUTO", frm.IdProduto); } } }
public frmPWOInProductionEditor( EditStatus status, int t134LeafID, int t216LeafID, int t131LeafID, List <EntityBatchPWO> pwos, ref EntityBatchPWO pwo) : this() { editStatus = status; this.t134LeafID = t134LeafID; this.t216LeafID = t216LeafID; this.t131LeafID = t131LeafID; datas = pwos; data = pwo; switch (editStatus) { case EditStatus.New: Text = "新增"; break; case EditStatus.Edit: Text = "修改"; edtPWONo.Text = data.PWONo; edtProductNo.Text = data.T102Code; edtProductName.Text = data.T102Name; edtBatchNo.Text = data.LotNumber; edtTextureCode.Text = data.Texture; edtQuantity.Value = Convert.ToDecimal(data.Quantity); edtPWONo.Enabled = false; break; } }
private void btnGrava_Click(object sender, EventArgs e) { if (recStatus == EditStatus.Altera) { altera(); } else { inclui(); } groupBox2.Enabled = false; groupBox1.Enabled = true; dgvClientes.Enabled = true; btnFiltra.PerformClick(); recStatus = EditStatus.Consulta; Text = codcli.ToString(); // bsClientes.Position = bsClientes.Find("CODCLI", codcli); }
/// <summary> /// Initializes a new instance of the <see cref="MongoHistoryItem"/> class. /// </summary> /// <param name="item">The item.</param> /// <exception cref="ArgumentNullException">null item</exception> public MongoHistoryItem(HistoryItem item) { if (item == null) { throw new ArgumentNullException(nameof(item)); } Id = Guid.NewGuid().ToString(); Title = item.Title; Description = item.Description; FacetId = item.FacetId; GroupId = item.GroupId; SortKey = item.SortKey; Flags = item.Flags; TimeCreated = item.TimeCreated; CreatorId = item.CreatorId; TimeModified = item.TimeModified; UserId = item.UserId; ReferenceId = item.Id; Status = item.Status; }
protected override void ProcessPage(Page p, EditStatus edit) { if (p.GetNamespace() != 0) return; p.Load(); var before = p.text; foreach (var template in p.GetAllTemplates()) { if (template.Title == "#dpl:" && template.Parameters.ContainsKey("category") && template.Parameters.ContainsKey("linksto") && template.Parameters.ContainsKey("format")) { var linksTo = template.Parameters["linksto"]; linksTo = linksTo == p.title ? "{{PAGENAME}}" : linksTo; if (template.Parameters["category"].ToLower() == "trophäe") p.text = p.text.Replace(template.Text, "Beschaffung|gegenstand=" + linksTo + "|kategorie=Trophäe"); else if (template.Parameters["category"].ToLower() == "behälter") p.text = p.text.Replace(template.Text, "Beschaffung|gegenstand=" + linksTo + "|kategorie=Behälter"); } } if (p.text.Contains("#dpl:") && p.text.Contains("Behälter")) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("{0} still contains dpl", p.title); Console.ResetColor(); } if (p.text != before) { edit.Save = true; edit.EditComment = "DPL durch {{Beschaffung}} ersetzt"; } }
public RequestStatus GetStatus(EditStatus editStatus, int apprenticeshipCount, LastAction lastAction, AgreementStatus?overallAgreementStatus, long?transferSenderId, TransferApprovalStatus?transferApprovalStatus) { if (transferSenderId.HasValue) { return(GetTransferStatus(editStatus, transferApprovalStatus, lastAction, overallAgreementStatus)); } if (editStatus == EditStatus.Both) { return(RequestStatus.Approved); } if (editStatus == EditStatus.ProviderOnly) { return(GetProviderOnlyStatus(lastAction)); } if (editStatus == EditStatus.EmployerOnly) { return(GetEmployerOnlyStatus(lastAction, overallAgreementStatus)); } return(RequestStatus.None); }
public void Run() { Start(); var statusApi = new StatusApi(); statusApi.SetStatus(true); try { var i = 0; lock(Pages) foreach (Page p in Pages.OrderBy(p => p.title).Skip(0)) { if (!statusApi.GetRunning()) { Console.WriteLine("Canceled by status api"); return; } var editStatus = new EditStatus(); ProcessPage(p, editStatus); if (editStatus.Save) { p.Save("[Bot] " + editStatus.EditComment, true); p.LoadEx(); statusApi.AddEdit(p.title, p.lastRevisionID, editStatus.EditComment); Thread.Sleep(10000); } Console.Title = string.Format("({0}/{1})", ++i, Pages.Count()); } } finally { statusApi.SetStatus(false); End(); } }
protected override void ProcessPage(Page p, EditStatus edit) { if (p.GetNamespace() != 0) return; p.Load(); var allChanges = new List<string>(); var before = p.text; foreach (var template in p.GetAllTemplates()) { var templateChanges = new List<string>(); if (Replacements.ContainsKey(template.Title)) { foreach (var parameter in template.Parameters) { if (Replacements[template.Title].ContainsKey(parameter.Key)) { template.ChangeParametername(parameter.Key, Replacements[template.Title][parameter.Key]); templateChanges.Add(parameter.Key + " → " + Replacements[template.Title][parameter.Key]); } } } if (templateChanges.Count > 0) { template.Save(); allChanges.Add(template.Title + ": " + string.Join(", ", templateChanges)); } } if (allChanges.Count > 0) { edit.Save = true; edit.EditComment = "Parameter umbenannt: " + string.Join("; ", allChanges); } }
protected override void ProcessPage(Page p, EditStatus edit) { if (p.GetNamespace() != 0) return; p.Load(); var changes = new List<string>(); var templates = p.GetAllTemplates(); foreach (var template in templates) { if (template.Title == "Rezept") { if (template.Parameters.ContainsKey("seltenheit") && new[] {"meisterwerk", "selten", "exotisch", "legendär"}.Contains( template.Parameters["seltenheit"].ToLower()) && template.Parameters.ContainsKey("gebunden") && template.Parameters["gebunden"].ToLower() == "benutzung") { template.Parameters.Remove("gebunden"); template.Save(); changes.Add("Rezept: 'gebunden = benutzung' entfernt"); } } else if (template.Title == "Eventbelohnung") { string[] parametersToRemove = { "ep-gold", "ep-silber", "ep-bronze", "ep-gold-niederlage", "ep-silber-niederlage", "ep-bronze-niederlage", "ep-niederlage", "karma-gold", "karma-silber", "karma-bronze", "karma-gold-niederlage", "karma-silber-niederlage", "karma-bronze-niederlage", "karma-niederlage", "münzen-gold", "münzen-silber", "münzen-bronze", "münzen-gold-niederlage", "münzen-silber-niederlage", "münzen-bronze-niederlage", "münzen-niederlage" }; var removed = new List<string>(); foreach (var parameter in parametersToRemove) { if (template.Parameters.ContainsKey(parameter)) { template.Parameters.Remove(parameter); removed.Add(parameter); } } if (removed.Any()) { template.Save(); changes.Add("Eventbelohnung: '" + string.Join("', '", removed) + "' entfernt"); } } else if (template.Title == "Infobox Aufgabe") { string[] parametersToRemove = { "erfahrung", "münzen" }; var removed = new List<string>(); foreach (var parameter in parametersToRemove) { if (template.Parameters.ContainsKey(parameter)) { template.Parameters.Remove(parameter); removed.Add(parameter); } } if (removed.Any()) { template.Save(); changes.Add("Infobox Aufgabe: '" + string.Join("', '", removed) + "' entfernt"); } } else if (template.Title == "Infobox Farbstoff") { string[] parametersToRemove = { "seltenheit" }; var removed = new List<string>(); foreach (var parameter in parametersToRemove) { if (template.Parameters.ContainsKey(parameter)) { template.Parameters.Remove(parameter); removed.Add(parameter); } } if (removed.Any()) { template.Save(); changes.Add("Infobox Farbstoff: '" + string.Join("', '", removed) + "' entfernt"); } } } if (changes.Count == 0) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\tUnbekannt..."); Console.ResetColor(); } else { Console.ForegroundColor = ConsoleColor.White; var comment = "Überflüssige Parameter entfernt: " + string.Join("; ", changes); Console.WriteLine("\t" + comment); Console.ResetColor(); edit.EditComment = comment; edit.Save = true; } }
private void gripperMouseUp(object sender, MouseEventArgs e) { Status = EditStatus.IDLE; boundsBeforeResize = Rectangle.Empty; boundsAfterResize = RectangleF.Empty; isMadeUndoable = false; Invalidate(); }
public void CommitmentIsTransferFundedAndInValidState(RequestStatus expectedResult, EditStatus editStatus, TransferApprovalStatus transferApprovalStatus) { var commitment = new CommitmentListItem { AgreementStatus = AgreementStatus.NotAgreed, ApprenticeshipCount = 1, LastAction = LastAction.None, EditStatus = editStatus, TransferSenderId = 1, TransferApprovalStatus = transferApprovalStatus }; var status = commitment.GetStatus(); Assert.AreEqual(expectedResult, status); }
public EditStatus Update(object oCurrent, object oUpdate) { EditStatus ok = EditStatus.NONE; if (Opened == false) { return(ok); } var o1 = convertToDynamicObject_GetIndex(oCurrent); var o2 = convertToDynamicObject_GetIndex(oUpdate); if (o1 == null || o2 == null) { return(EditStatus.FAIL_EXCEPTION_CONVERT_TO_DYNAMIC_OBJECT); } else { if (o1.Item1 == -1) { return(EditStatus.FAIL_ITEM_NOT_EXIST); } if (o2.Item1 != -1) { return(EditStatus.FAIL_ITEM_EXIST); } int index = o1.Item1; object val = o2.Item2; byte[] buf = serializeDynamicObject(val, index + 1); if (buf == null || buf.Length == 0) { return(EditStatus.FAIL_EXCEPTION_SERIALIZE_DYNAMIC_OBJECT); } if (index != -1) { lock (_lockSearch) m_listItems[index] = val; lock (_lockUpdate) { if (m_bytes.ContainsKey(index)) { m_bytes[index] = buf; } List <byte> lb = new List <byte>(); for (int k = 0; k < m_Count; k++) { if (m_bytes.ContainsKey(k)) { lb.AddRange(m_bytes[k]); } } //string j1 = string.Join(" ", lb.Select(x => x.ToString()).ToArray()); m_BlobLEN = 0; writeData(lb.ToArray(), 0); m_BlobLEN = lb.Count; ok = EditStatus.SUCCESS; } } } return(ok); }
protected override void ProcessPage(Page p, EditStatus edit) { if (p.GetNamespace() != 0) return; p.Load(); //ignore pages which already have {{standort}} if (p.GetAllTemplates().Any(t => t.Title == "Standort")) return; var section = p.GetSectionByName("Standort", false); if (section == null) return; var standorte = new List<string>(); Match lastMatch = null; var prependText = ""; var remainingText = ""; var foundNonSchauplatz = false; var compactTemplate = true; var lines = section.Content.GetLines().Skip(1).ToList(); var addAdditionalStar = !lines.First().Contains('*') && lines.First().Length > 2 && PageIsSchauplatz(lines.First().Trim('[', ']', '\'', ';')); foreach (var line in lines) { //just add the line to the remaining text as soon as we found a non schauplatz if (foundNonSchauplatz) remainingText += "\r\n" + line; if (string.IsNullOrWhiteSpace(line)) continue; var match = StandortItemRegex.Match((addAdditionalStar ? "*" : "") + line); //if the line is no listitem and no schauplatz, we are done with the standort list //all remaining text will be added to remainingText if (!match.Success || !PageIsSchauplatz(match.Groups[2].Value)) { if (standorte.Count == 0 && lastMatch == null) { prependText += line + "\r\n"; } else { foundNonSchauplatz = true; remainingText = line; } continue; } var added = false; //has a descripting text if (match.Groups[3].Length > 0) { standorte.Add(match.Groups[2].Value + " = " + match.Groups[4].Value); compactTemplate = false; added = true; } if (lastMatch != null && match.Groups[1].Length <= lastMatch.Groups[1].Length) { //add last standorte.Add(lastMatch.Groups[2].Value + (lastMatch.Groups[4].Length > 0 ? " = " + lastMatch.Groups[4].Value : "")); lastMatch = null; } lastMatch = !added ? match : null; } if (lastMatch != null) { standorte.Add(lastMatch.Groups[2].Value + (lastMatch.Groups[4].Length > 0 ? " = " + lastMatch.Groups[4].Value : "")); } if (standorte.Count == 0) return; if (!foundNonSchauplatz) remainingText += "\r\n"; if (standorte.Count > 3) compactTemplate = false; //build the new section content section.Content = section.Content.GetLines().First() + "\r\n" + prependText + (compactTemplate ? "{{Standort|" + string.Join("|", standorte) + "}}" : "{{Standort\r\n | " + string.Join("\r\n | ", standorte) + "\r\n}}") + "\r\n" + remainingText; section.Save(); edit.Save = true; edit.EditComment = "/* "+section.Title+" */ [[Benutzer: Darthmaim Bot/Projekte#Standort|Standortvorlage eingebaut]] ("+standorte.Count+")"; }
void OverPost(ProjectItem item, EditStatus status) { switch (status) { case EditStatus.New: ProjectList.Add(item); break; case EditStatus.Edit: ProjectList[DgProj.SelectedIndex].UpdateWithoutDatetime(item); break; case EditStatus.Delete: ProjectList.RemoveAt(DgProj.SelectedIndex); break; case EditStatus.Run: ProjectList[DgProj.SelectedIndex].UpdateDatetime(); break; } DgProj.Items.Refresh(); ApplyChanges(); SetViewState(ViewState.Default); }
protected override void ProcessPage(Page p, EditStatus edit) { var changes = new List<string>(); if (p.GetNamespace() != 0) return; p.Load(); var templates = p.GetAllTemplates(); foreach (var template in templates) { var changeCountBeforeTemplate = changes.Count; #region [G] Infobox Gegenstand if (template.Title.Equals("Infobox Gegenstand", StringComparison.OrdinalIgnoreCase)) { //stapelbar = ja/###/... if (template.Parameters.HasNotValueIgnoreCase("stapelbar", "nein")) { changes.Add(string.Format("'stapelbar = {0}' entfernt", template.Parameters["stapelbar"])); template.Parameters.Remove("stapelbar"); } //wert -> händlerwert if (template.Parameters.ContainsKey("wert")) { //wenn händlerwert schon existiert löschen if (template.Parameters.ContainsKey("händlerwert")) { template.Parameters.Remove("wert"); changes.Add("'wert' entfernt"); } else { template.ChangeParametername("wert", "händlerwert"); changes.Add("'wert' zu 'händlerwert' geändert"); } } //seelengebunden = ja -> gebunden = seele if (template.Parameters.HasValueIgnoreCase("seelengebunden", "ja")) { //wenn gebunden schon existiert löschen if (template.Parameters.ContainsKey("gebunden")) { changes.Add(string.Format("'seelengebunden = {0}' entfernt", template.Parameters["seelengebunden"])); template.Parameters.Remove("seelengebunden"); } else { changes.Add(string.Format("'seelengebunden = {0}' zu 'gebunden = seele' geändert", template.Parameters["seelengebunden"])); template.ChangeParametername("seelengebunden", "gebunden"); template.Parameters["gebunden"] = "seele"; } } //seltenheit = ramsch -> seltenheit = scrhott if (template.Parameters.HasValueIgnoreCase("seltenheit", "ramsch")) { changes.Add(string.Format("'seltenheit = {0}' zu 'seltenheit = Schrott' geändert", template.Parameters["seltenheit"])); template.Parameters["seltenheit"] = "Schrott"; } //benutzungen = 1 if (template.Parameters.HasValue("benutzungen","1")) { changes.Add("'benutzungen = 1' entfernt"); template.Parameters.Remove("benutzungen"); } } #endregion #region [J] Angebot if (template.Title.Equals("angebot", StringComparison.OrdinalIgnoreCase)) { //seltenheit = ja entfernen if (template.Parameters.HasValueIgnoreCase("seltenheit", "ja")) { changes.Add("'seltenheit = ja' entfernt"); template.Parameters.Remove("seltenheit"); } //stufe = ja entfernen if (template.Parameters.HasValueIgnoreCase("stufe", "ja")) { changes.Add("'stufe = ja' entfernt"); template.Parameters.Remove("stufe"); } //typ = ja entfernen if (template.Parameters.HasValueIgnoreCase("typ", "ja")) { changes.Add("'typ = ja' entfernt"); template.Parameters.Remove("typ"); } //werte = ja entfernen if (template.Parameters.HasValueIgnoreCase("werte", "ja")) { changes.Add("'werte = ja' entfernt"); template.Parameters.Remove("werte"); } } #endregion #region [R] Rezept if (template.Title.Equals("Rezept", StringComparison.OrdinalIgnoreCase)) { var changedSomething = false; for (var i = 1; i <= 4; i++) { var key = "attribut" + i + "-wert"; if (template.Parameters.ContainsKey(key) && template.Parameters[key].StartsWith("+")) { template.Parameters[key] = template.Parameters[key].TrimStart('+'); changedSomething = true; } } if (changedSomething) changes.Add("Überflüssiges + aus dem [[Vorlage:Rezept|Rezept]] " + (template.Parameters.ContainsKey("name") ? template.Parameters["name"] : p.title) + " entfernt"); //anzahl = 1 if (template.Parameters.ContainsKey("anzahl") && template.Parameters["anzahl"] == "1") { changes.Add("'anzahl = 1' entfernt"); template.Parameters.Remove("anzahl"); } //gebunden = benutzung bei seltenheit meisterwerk/selten/exotisch/legendär entfernen if (template.Parameters.HasValueIgnoreCase("gebunden", "benutzung") && template.Parameters.HasValueIgnoreCase("seltenheit", "meisterwerk", "selten", "exotisch", "legendär")) { changes.Add(string.Format("'gebunden = {0}' entfernt, da 'seltenheit = {1}'", template.Parameters["gebunden"], template.Parameters["seltenheit"])); template.Parameters.Remove("gebunden"); } } #endregion if (changeCountBeforeTemplate != changes.Count) template.Save(); } if (changes.Count == 0) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\tUnbekannt..."); Console.ResetColor(); } else { Console.ForegroundColor = ConsoleColor.White; var comment = "Parameterfehler behoben: " + string.Join("; ", changes); Console.WriteLine("\t" + comment); Console.ResetColor(); edit.EditComment = comment; edit.Save = true; } }
/// <summary> /// ドロー表リポジトリ DTO の新しいインスタンスを生成します。 /// </summary> /// <param name="tournamentId">大会 ID。</param> /// <param name="tennisEventId">種目 ID。</param> /// <param name="editStatus">編集状態。</param> public DrawTableRepositoryDto(int tournamentId, string tennisEventId, EditStatus editStatus) { this.TournamentId = tournamentId; this.TennisEventId = tennisEventId; this.EditStatus = editStatus; }
public void WhenLastActionTakenIsNoneEditStatusIsNotChanged(EditStatus existingEditStatus, CallerType caller) { var result = _rules.DetermineNewEditStatus(existingEditStatus, caller, false, 0, LastAction.None); Assert.AreEqual(existingEditStatus, result); }
public async Task <List <PortfolioFundModel> > GetPortfolioFundByPortfolioId(int portfolioId, EditStatus status) { try { var lstPortfolioFunds = _portfolioManager.GetPortfolioFundByPortfolioId(portfolioId, status).Result; var listPortfolioFundDto = _mapper.Map <List <PortfolioFundModel> >(lstPortfolioFunds); return(listPortfolioFundDto); } catch (Exception ex) { throw ex; } }
private bool RemoveInspectItems(OrderInfo pwoInfo) { int errCode = 0; string errText = ""; int countDeal = 0; foreach (DataRow dr in dtInspection.Rows) { EditStatus recordStatus = (EditStatus)dr["RecordStatus"]; switch (recordStatus) { case EditStatus.Edit: case EditStatus.Delete: if (dr["AttachedFile"].ToString() == "" && (int)dr["HasIQCReport"] == 1) { DataRow dr1 = dr; GetIQCReportFromDB(ref dr1); } countDeal++; try { IRAPMESBatchClient.Instance.usp_SaveFact_SmeltBatchMethodCancel( IRAPUser.Instance.CommunityID, pwoInfo.T216LeafID, pwoInfo.T107LeafID, pwoInfo.BatchNumber, "D", (long)dr["FactID"], IRAPUser.Instance.SysLogID, out errCode, out errText); if (errCode != 0) { XtraMessageBox.Show( string.Format( "已经成功删除了[{0}]条记录。\n" + "但是有错误发生:[{1}]\n" + "终止继续处理", countDeal, errText), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } catch (Exception error) { XtraMessageBox.Show( string.Format( "已经成功删除了[{0}]条记录。\n" + "但是有错误发生:[{1}]\n" + "终止继续处理", countDeal, error.Message), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } break; } } return(true); }
/// <summary> /// 生成需要新增的检验数据 XML 串 /// </summary> private void GenerateNewRSFactXML() { XmlNode root = xmlRSFact.SelectSingleNode("RSFact"); if (root == null) { root = xmlRSFact.CreateElement("RSFact"); xmlRSFact.AppendChild(root); } int rowIdx = 1; foreach (DataRow dr in dtInspection.Rows) { EditStatus recordStatus = (EditStatus)dr["RecordStatus"]; switch (recordStatus) { case EditStatus.New: case EditStatus.Edit: #region 生成新增的 XML 节点 XmlNode rsfactNode = xmlRSFact.CreateElement("RF6_2"); root.AppendChild(rsfactNode); for (int i = 0; i < inspectionItems.Count; i++) { XmlNode node = null; if (i == 0) { node = rsfactNode; } else { node = xmlRSFact.CreateElement("RF6_2"); root.AppendChild(node); } node.Attributes.Append( XMLHelper.CreateAttribute( xmlRSFact, "RowNum", rowIdx.ToString())); node.Attributes.Append( XMLHelper.CreateAttribute( xmlRSFact, "Ordinal", inspectionItems[i].Ordinal.ToString())); node.Attributes.Append( XMLHelper.CreateAttribute( xmlRSFact, "T20LeafID", inspectionItems[i].T20LeafID.ToString())); node.Attributes.Append( XMLHelper.CreateAttribute( xmlRSFact, "LowLimit", "")); node.Attributes.Append( XMLHelper.CreateAttribute( xmlRSFact, "Criterion", "")); node.Attributes.Append( XMLHelper.CreateAttribute( xmlRSFact, "HighLimit", "")); node.Attributes.Append( XMLHelper.CreateAttribute( xmlRSFact, "UnitOfMeasure", inspectionItems[i].UnitOfMeasure)); node.Attributes.Append( XMLHelper.CreateAttribute( xmlRSFact, "Metric01", dr[string.Format( "Column{0}", inspectionItems[i].Ordinal)].ToString())); } rsfactNode.Attributes.Append( XMLHelper.CreateAttribute( xmlRSFact, "IQCReport", dr["AttachedFile"].ToString())); rowIdx++; #endregion break; } } }
private void ItemDetail_Load(object sender, EventArgs e) { _p = new Prument.ORM.Products(); ((mainForm)this.MdiParent).tsslMain.Text = "Ready"; this.Status = EditStatus.New; }
private void ClickNew(object sender, RoutedEventArgs e) { ProjectEditStatus = EditStatus.New; SendDataToControl(null); SetViewState(ViewState.Editing); }
public CTeleportService(EditStatus status) : base(status) { }
public void btnSave_Click(object sender, EventArgs e) { int i=0; string _mess = "����ɹ���"; Prument.ORM.BindOperator _bo; try { _p.Name = this.txbName.Text; _p.Description = this.txbDescription.Text; _p.Images.clear(); while(i < ImageMax){ _p.Images.add(ImagePaths[i]); i++; } if (this.Status == EditStatus.Changed) _bo = Prument.ORM.BindOperator.Update; else _bo = Prument.ORM.BindOperator.Insert; FileInfo _file; i = 0; while (_p.Images.Path[i] != "" && _p.Images.Path[i] != null) { _file = new FileInfo(_p.Images.Path[i]); string target = Application.StartupPath + "\\Pictures\\" + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Year.ToString() + "_" + DateTime.Now.Hour.ToString().ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + (new System.Random()).Next(0, 100).ToString() + _p.Images.Path[i].Substring(_p.Images.Path[i].LastIndexOf("\\") + 1, _p.Images.Path[i].Length - _p.Images.Path[i].LastIndexOf("\\") - 1); _file.CopyTo(target,true); _p.Images.Path[i] = target; ((mainForm)this.MdiParent).tspbMain.Value = (int)Math.Floor((decimal)i * (decimal)100 / (decimal)_p.Images.Count); i++; } _p.DataBind(_bo); ((mainForm)this.MdiParent).tspbMain.Value = 0; } catch (Exception ex) { _mess = "�洢ʧ��" + ex.Message; } MessageBox.Show(_mess); this.Status = EditStatus.Saved; changeSaveStatus(); }
public void EmployerSendsToProviderToAddApprentices(RequestStatus expectedResult, AgreementStatus agreementStatus, EditStatus editStatus, int numberOfApprenticeships, LastAction lastAction) { // Scenario 1 var status = _calculator.GetStatus(editStatus, numberOfApprenticeships, lastAction, agreementStatus); status.Should().Be(expectedResult); }
public EditStatus[] AddItems(object[] items) { EditStatus[] rs = new EditStatus[items.Length]; if (Opened == false || items == null || items.Length == 0) { return(rs); } bool ok = false; int itemConverted = 0; ///////////////////////////////////////// #region [ convert items[] to array dynamic object ] //IList lsDynObject = (IList)typeof(List<>).MakeGenericType(m_typeDynamic).GetConstructor(Type.EmptyTypes).Invoke(null); var lsDynObject = items .Select((x, k) => convertToDynamicObject(x)) .ToList(); if (lsDynObject.Count > 0) { int[] ids; lock (_lockSearch) // performance very bad !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ids = lsDynObject.Select(x => x == null ? -2 : m_listItems.IndexOf(x)).ToArray(); for (int k = ids.Length - 1; k >= 0; k--) { switch (ids[k]) { case -2: rs[k] = EditStatus.FAIL_EXCEPTION_CONVERT_TO_DYNAMIC_OBJECT; lsDynObject.RemoveAt(k); break; case -1: itemConverted++; break; default: rs[k] = EditStatus.FAIL_ITEM_EXIST; lsDynObject.RemoveAt(k); break; } } } #endregion if (itemConverted == 0) { return(rs); } ///////////////////////////////////////// Dictionary <int, byte[]> dicBytes = new Dictionary <int, byte[]>(); List <byte> lsByte = new List <byte>() { }; List <int> lsIndexItemNew = new List <int>(); int itemCount = 0; if (lsDynObject.Count > 0) { using (m_lockFile.WriteLock()) { #region [ === CONVERT DYNAMIC OBJECT - SERIALIZE === ] for (int k = 0; k < lsDynObject.Count; k++) { rs[k] = EditStatus.NONE; int index_ = m_Count + itemCount + 1; byte[] buf = serializeDynamicObject(lsDynObject[k], index_); if (buf == null || buf.Length == 0) { rs[k] = EditStatus.FAIL_EXCEPTION_SERIALIZE_DYNAMIC_OBJECT; continue; } else if (buf.Length > m_BlobSizeMax) { rs[k] = EditStatus.FAIL_MAX_LEN_IS_255_BYTE; continue; } else { lsByte.AddRange(buf); dicBytes.Add(index_ - 1, buf); rs[k] = EditStatus.SUCCESS; itemCount++; lsIndexItemNew.Add(k); } } // end for each items #endregion #region [ === TEST === ] ////////////////////var o1 = convertToDynamicObject(items[lsDynamicObject.Count - 1], 0); ////////////////////byte[] b2; ////////////////////using (var ms = new MemoryStream()) ////////////////////{ //////////////////// ProtoBuf.Serializer.Serialize(ms, o1); //////////////////// b2 = ms.ToArray(); ////////////////////} ////////////////////byte[] b3 = serializeDynamicObject(o1); ////////////////////string j3 = string.Join(" ", b2.Select(x => x.ToString()).ToArray()); ////////////////////string j4 = string.Join(" ", b3.Select(x => x.ToString()).ToArray()); ////////////////////if (j3 == j4) //////////////////// b2 = null; //////////lsDynamicObject.Add(convertToDynamicObject(items[0], 1)); //////////lsDynamicObject.Add(convertToDynamicObject(items[1], 2)); //////////lsDynamicObject.Add(convertToDynamicObject(items[2], 3)); //////////lsDynamicObject.Add(convertToDynamicObject(items[3], 4)); //////////byte[] b1; //////////using (var ms = new MemoryStream()) //////////{ ////////// ProtoBuf.Serializer.Serialize(ms, lsDynamicObject); ////////// b1 = ms.ToArray(); //////////} ////////////string j1 = string.Join(" ", b1.Select(x => x.ToString()).ToArray()); //////////////string j2 = string.Join(" ", lsByte.Select(x => x.ToString()).ToArray()); //////////////if (j1 == j2) ////////////// b1 = null; //////////////byte[] bs = "10 9 8 0 18 5 16 1 82 1 49 10 2 8 1 0 0 0 0 10 2 8 2 10 9 8 3 18 5 16 2 82 1 51".Split(' ').Select(x => byte.Parse(x)).ToArray(); //////////////object vs; //////////////Type typeList = typeof(List<>).MakeGenericType(m_typeDynamic); //////////////using (var ms = new MemoryStream(bs)) ////////////// vs = (IList)ProtoBuf.Serializer.NonGeneric.Deserialize(typeList, ms); //////////return rs; #endregion #region [ === RESIZE GROW === ] int freeStore = m_FileSize - (m_BlobLEN + m_HeaderSize); if (freeStore < lsByte.Count + 1) { m_mapFile.Close(); FileStream fs = new FileStream(m_FilePath, FileMode.OpenOrCreate); long fileSize = fs.Length + lsByte.Count + (m_BlobGrowSize * m_BlobSizeMax); fs.SetLength(fileSize); fs.Close(); m_FileSize = (int)fileSize; m_mapFile = MemoryMappedFile.Create(m_FilePath, MapProtection.PageReadWrite, m_FileSize); } #endregion #region [ === WRITE FILE === ] bool w = false; w = writeData(lsByte.ToArray(), itemCount); if (w) { //string j1 = string.Join(" ", lsByte.Select(x => x.ToString()).ToArray()); lock (_lockSearch) { for (int k = 0; k < itemCount; k++) { Interlocked.Increment(ref m_Count); Interlocked.Increment(ref m_Capacity); m_listItems.Add(lsDynObject[lsIndexItemNew[k]]); } } lock (_lockUpdate) { foreach (KeyValuePair <int, byte[]> kv in dicBytes) { m_bytes.Add(kv.Key, kv.Value); } } ok = true; } if (w == false) { for (int k = 0; k < rs.Length; k++) { if (rs[k] == EditStatus.SUCCESS) { rs[k] = EditStatus.FAIL_EXCEPTION_WRITE_ARRAY_BYTE_TO_FILE; } } } #endregion }// end lock } if (ok) { SearchExecuteUpdateCache(ItemEditType.ADD_NEW_ITEM); } return(rs); }
public void TestValidEditStatusMapping(Party party, EditStatus expectedResult) { var result = party.ToEditStatus(); Assert.IsTrue(result == expectedResult); }
public EditStatus Remove(object item) { EditStatus ok = EditStatus.NONE; if (Opened == false) { return(ok); } var it = convertToDynamicObject_GetIndex(item); if (it == null) { return(EditStatus.FAIL_EXCEPTION_CONVERT_TO_DYNAMIC_OBJECT); } else { if (it.Item1 == -1) { return(EditStatus.FAIL_ITEM_NOT_EXIST); } int index = it.Item1; if (index != -1) { lock (_lockSearch) { m_listItems.RemoveAt(index); m_Count = m_listItems.Count; } byte[] bf1 = m_bytes[0]; int p1 = -1; for (int k = 1; k < bf1.Length; k++) { if (bf1[k - 1] == 1 && bf1[k] == 82) { p1 = k - 1; break; } } lock (_lockUpdate) { List <byte> lb = new List <byte>(); int km = m_bytes.Count - 1; for (int k = 0; k < km; k++) { if (k < index) { lb.AddRange(m_bytes[k]); } else { byte[] bf = changeIndex(p1, m_bytes[k + 1], k + 1); m_bytes[k] = bf; lb.AddRange(bf); } } m_bytes.Remove(km); //string j1 = string.Join(" ", lb.Select(x => x.ToString()).ToArray()); m_BlobLEN = 0; writeData(lb.ToArray(), 0); m_BlobLEN = lb.Count; ok = EditStatus.SUCCESS; } } } return(ok); }
public void AndPartyIsEmployerOrProviderAndOtherPartyHasApprovedThenShouldUpdateStatus(Party modifyingParty, EditStatus expectedEditStatus) { _fixture.SetModifyingParty(modifyingParty) .SetWithParty(modifyingParty) .SetApprovals(modifyingParty.GetOtherParty()) .AddDraftApprenticeship() .Approve(); _fixture.Cohort.EditStatus.Should().Be(expectedEditStatus); _fixture.Cohort.LastAction.Should().Be(LastAction.Approve); _fixture.Cohort.CommitmentStatus.Should().Be(CommitmentStatus.Active); }
public void CommitmentIsTransferFundedAndStatusesAreInvalid(TransferApprovalStatus transferApprovalStatus, EditStatus editStatus) { var commitment = new CommitmentListItem { AgreementStatus = AgreementStatus.NotAgreed, ApprenticeshipCount = 1, LastAction = LastAction.None, EditStatus = editStatus, TransferSenderId = 1, TransferApprovalStatus = transferApprovalStatus }; Assert.Throws <Exception>(() => commitment.GetStatus()); }
private void txbName_TextChanged(object sender, EventArgs e) { if (this.Status != EditStatus.New && this.Status != EditStatus.NewChanged) this.Status = EditStatus.Changed; else this.Status = EditStatus.NewChanged; changeSaveStatus(); }
public async Task <ICollection <PortfolioFund> > GetPortfolioFundByPortfolioId(int portfolioId, EditStatus status) { try { var listPortfolioFund = await _unitOfWork.PortfolioFundRepository.FindByAsync(m => m.EditStatus == status && m.PortfolioId == portfolioId); if (listPortfolioFund == null) { throw new NotFoundException(); } return(listPortfolioFund.ToList()); } catch (Exception ex) { throw ex; } }
private void gripperMouseDown(object sender, MouseEventArgs e) { mx = e.X; my = e.Y; Status = EditStatus.RESIZING; boundsBeforeResize = new Rectangle(left, top, width, height); boundsAfterResize = new RectangleF(boundsBeforeResize.Left, boundsBeforeResize.Top, boundsBeforeResize.Width, boundsBeforeResize.Height); isMadeUndoable = false; }
private void gripperMouseUp(object sender, MouseEventArgs e) { Status = EditStatus.IDLE; isMadeUndoable = false; Invalidate(); }
private void ofdMain_FileOk(object sender, CancelEventArgs e) { ImagePaths[ImageMax] = ofdMain.FileName.ToString(); ImageCursor = ImageMax; ImageMax++; if (this.Status != EditStatus.New && this.Status != EditStatus.NewChanged) this.Status = EditStatus.Changed; else this.Status = EditStatus.NewChanged; showPicture(); changeSaveStatus(); }
public ActionResult UpdateStatus(EditStatus status) { return(Ok(_nhanVien.UpdateStatus(status))); }
private void gripperMouseDown(object sender, MouseEventArgs e) { mx = e.X; my = e.Y; Status = EditStatus.RESIZING; isMadeUndoable = false; }
protected abstract void ProcessPage(Page p, EditStatus edit);
/// <summary> /// Draws the matrix; /// </summary> protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); // ---------- // Preprocessing Graphics g = e.Graphics; Font font = new Font("Consolas", 10.0f); StringFormat strForm = new StringFormat(); strForm.Alignment = StringAlignment.Center; strForm.LineAlignment = StringAlignment.Center; Point fieldPt = GuiToField(mouseCoord); Area mouseArea = GetArea(mouseCoord); // ---------- // Background g.Clear(this.BackColor); List <int> fixedRCs = new List <int>(); List <int> addRCs = new List <int>(); List <int> removeRCs = new List <int>(); for (int r = 0; r < Dimension.Height; r++) { EditStatus rES = (rowEditStatus != null && rowEditStatus.Count > r) ? rowEditStatus[r] : EditStatus.Fixed; int rowEntry = -(r + 1); switch (rES) { case EditStatus.Fixed: fixedRCs.Add(rowEntry); break; case EditStatus.Add: addRCs.Add(rowEntry); break; case EditStatus.Remove: removeRCs.Add(rowEntry); break; } } for (int c = 0; c < Dimension.Width; c++) { EditStatus cES = (colEditStatus != null && colEditStatus.Count > c) ? colEditStatus[c] : EditStatus.Fixed; int colEntry = (c + 1); switch (cES) { case EditStatus.Fixed: fixedRCs.Add(colEntry); break; case EditStatus.Add: addRCs.Add(colEntry); break; case EditStatus.Remove: removeRCs.Add(colEntry); break; } } // Allows to iterate over one list. List <int> allRCs = new List <int>(fixedRCs.Count + addRCs.Count + removeRCs.Count); allRCs.AddRange(fixedRCs); allRCs.AddRange(addRCs); allRCs.AddRange(removeRCs); for (int i = 0; i < allRCs.Count; i++) { int entry = allRCs[i]; EditStatus entryES; if (i < fixedRCs.Count) { entryES = EditStatus.Fixed; } else if (i < fixedRCs.Count + addRCs.Count) { entryES = EditStatus.Add; } else { entryES = EditStatus.Remove; } bool isRow = entry < 0; int entryIndex = (isRow ? -1 : 1) * entry - 1; bool isMouse = entryIndex == (isRow ? fieldPt.Y : fieldPt.X); Color rsColor = Colors[entryES, isMouse]; if (rsColor != Color.Transparent) { Rectangle rec = new Rectangle( isRow ? 1 : fieldSize.Width * entryIndex + 1, isRow ? fieldSize.Height * entryIndex + 1 : 1, isRow ? this.Width - 2 : fieldSize.Width, isRow ? fieldSize.Height : this.Height - 2 ); g.FillRectangle(new SolidBrush(rsColor), rec); } } if (fieldPt.X >= 0 && fieldPt.Y >= 0) { // Fix background of mouse over rows/columns. EditStatus mcES = (colEditStatus != null && colEditStatus.Count > fieldPt.X) ? colEditStatus[fieldPt.X] : EditStatus.Fixed; EditStatus mrES = (rowEditStatus != null && rowEditStatus.Count > fieldPt.Y) ? rowEditStatus[fieldPt.Y] : EditStatus.Fixed; if (fieldPt.Y < Dimension.Height) { for (int c = 0; c < Dimension.Width; c++) { if (c == fieldPt.X) { continue; } EditStatus cES = (colEditStatus != null && colEditStatus.Count > c) ? colEditStatus[c] : EditStatus.Fixed; if (mrES < cES || (mrES == cES && mrES != EditStatus.Fixed)) { DrawFieldBg( g, new Point( fieldSize.Width * c + 1, fieldSize.Height * fieldPt.Y + 1 ), Colors[cES, true] ); } } } if (fieldPt.X < Dimension.Width) { for (int r = 0; r < Dimension.Height; r++) { if (r == fieldPt.Y) { continue; } EditStatus rES = (colEditStatus != null && rowEditStatus.Count > r) ? rowEditStatus[r] : EditStatus.Fixed; if (mcES < rES || (mcES == rES && mcES != EditStatus.Fixed)) { DrawFieldBg( g, new Point( fieldSize.Width * fieldPt.X + 1, fieldSize.Height * r + 1 ), Colors[rES, true] ); } } } } // ---------- // Frame if (IsEditing) { g.DrawRectangle(new Pen(Color.Gray) { DashStyle = DashStyle.Dash }, 0, 0, MatrixArea.Width + 1, MatrixArea.Height + 1); } g.DrawRectangle(Pens.Black, 0, 0, this.Width - 1, this.Height - 1); // ---------- // Fields for (int x = 0; x < Dimension.Width; x++) { EditStatus xES = (colEditStatus != null && colEditStatus.Count > x) ? colEditStatus[x] : EditStatus.Fixed; for (int y = 0; y < Dimension.Height; y++) { bool isOne = this[x, y]; bool toggle = IsEditing && x < oldDimension.Width && y < oldDimension.Height && oldMatrix[x, y] != isOne; EditStatus yES = (rowEditStatus != null && rowEditStatus.Count > y) ? rowEditStatus[y] : EditStatus.Fixed; EditStatus fieldES = (EditStatus)Math.Max((int)xES, (int)yES); Color bgColor = Colors[isOne, toggle, fieldES, ColorFunction.Background]; Color borderColor = Colors[isOne, toggle, fieldES, ColorFunction.Border]; Color textColor = Colors[isOne, toggle, fieldES, ColorFunction.Text]; DrawField( g, isOne ? "1" : "0", font, strForm, new Point( fieldSize.Width * x + 1, fieldSize.Height * y + 1 ), bgColor, borderColor, textColor ); } // for x } // for y // ---------- // Border for edit mode if (IsEditing) { for (int x = 0; x < Dimension.Width; x++) { // ToDo: Dynamic charachter and color Color bgColor = Color.Transparent; Color borderColor = Color.Transparent; Color textColor = Color.Gray; string fieldChar = "-"; DrawField( g, fieldChar, font, strForm, new Point( fieldSize.Width * x + 1, MatrixArea.Height + 2 ), bgColor, borderColor, textColor ); } for (int y = 0; y < Dimension.Height; y++) { // ToDo: Dynamic charachter and color Color bgColor = Color.Transparent; Color borderColor = Color.Transparent; Color textColor = Color.Gray; string fieldChar = "-"; DrawField( g, fieldChar, font, strForm, new Point( MatrixArea.Width + 2, fieldSize.Height * y + 1 ), bgColor, borderColor, textColor ); } } }
private void btnDeleteImg_Click(object sender, EventArgs e) { int i; for (i = ImageCursor; i <= ImageMax;i++ ) { ImagePaths[i] = ImagePaths[i + 1] != null && ImagePaths[i + 1] != ""?ImagePaths[i + 1]:null; } ImageMax--; ImageCursor = ImageCursor + 1> ImageMax ? ImageMax - 1 : ImageCursor; if (this.Status != EditStatus.New && this.Status != EditStatus.NewChanged) this.Status = EditStatus.Changed; else this.Status = EditStatus.NewChanged; showPicture(); changeSaveStatus(); }
/// <summary> /// Initializes a new instance of the <see cref="TtsXmlStatus"/> class. /// </summary> /// <param name="name">Status name.</param> /// <param name="status">Status.</param> public TtsXmlStatus(string name, EditStatus status) : this(name) { _status = status; }
/// <summary> /// Parse status from xml node. /// </summary> /// <param name="node">XML node.</param> public void Parse(XmlNode node) { if (node == null) { throw new ArgumentNullException("node"); } XmlElement ele = (XmlElement)node; _originalValue = ele.Value; _status = (EditStatus)Enum.Parse(typeof(EditStatus), ele.GetAttribute("value")); string positionString = ele.GetAttribute("position"); if (!string.IsNullOrEmpty(positionString)) { if (!int.TryParse(positionString, out _position)) { throw new InvalidDataException(Helper.NeutralFormat( "Can't prase position [{0}]", positionString)); } } string delIndexString = ele.GetAttribute("delIndex"); if (!string.IsNullOrEmpty(delIndexString)) { if (!int.TryParse(delIndexString, out _delIndex)) { throw new InvalidDataException(Helper.NeutralFormat( "Can't prase deleted index [{0}]", delIndexString)); } } string severityString = ele.GetAttribute("severity"); if (!string.IsNullOrEmpty(severityString)) { _severity = severityString; } _timestamp = ele.GetAttribute("timestamp"); _comment = ele.GetAttribute("comment"); }
public void Scenario3(RequestStatus expectedResult, AgreementStatus agreementStatus, EditStatus editStatus, int numberOfApprenticeships, LastAction lastAction) { // Scenario 3 var status = _calculator.GetStatus(editStatus, numberOfApprenticeships, lastAction, agreementStatus); status.Should().Be(expectedResult); }
/// <summary> /// Parse status from XML reader. /// </summary> /// <param name="reader">XML reader to parse from.</param> public void Parse(XmlReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } _name = reader.GetAttribute("name"); _status = (EditStatus)Enum.Parse(typeof(EditStatus), reader.GetAttribute("value")); string positionString = reader.GetAttribute("position"); if (!string.IsNullOrEmpty(positionString)) { _position = int.Parse(positionString, CultureInfo.InvariantCulture); } string delIndexString = reader.GetAttribute("delIndex"); if (!string.IsNullOrEmpty(delIndexString)) { _delIndex = int.Parse(delIndexString, CultureInfo.InvariantCulture); } _comment = reader.GetAttribute("comment"); _timestamp = reader.GetAttribute("timestamp"); string severityString = reader.GetAttribute("severity"); if (!string.IsNullOrEmpty(severityString)) { _severity = severityString; } if (!reader.IsEmptyElement) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.CDATA) { _originalValue = reader.Value; } else if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "status") { break; } } } }
public void startedit() { editingpoints = new List <PointD>(); lists = new List <List <PointD> >(); this.editstatus = EditStatus.editing; }
protected override void ProcessPage(Page p, EditStatus edit) { if (p.GetNamespace() != 0) return; p.Load(); var before = p.text; var templates = p.GetAllTemplates().Where(t => t.Title.ToLower() == "fehlende informationen"); foreach (var template in templates) { var fehlendeInformation = template.Parameters["0"].Trim(); if(fehlendeInformation.ToLower() == "interwiki" || fehlendeInformation.ToLower() == "fr" || fehlendeInformation.ToLower() == "en" || fehlendeInformation.ToLower() == "es") { RemoveTemplate(p, template); edit.Save = true; edit.EditComment = "[[Vorlage:Fehlende Informationen]] entfernt (nur interwiki)"; } else if (fehlendeInformation == "") { RemoveTemplate(p, template); edit.Save = true; edit.EditComment = "[[Vorlage:Fehlende Informationen]] entfernt (leer)"; } else { var modifiedFehlendeInformationen = fehlendeInformation; while(true) { var match = _regex.Match(modifiedFehlendeInformationen); if (!match.Success) break; modifiedFehlendeInformationen = _regex.Replace(modifiedFehlendeInformationen, "", 1); } if (modifiedFehlendeInformationen == fehlendeInformation) continue; var removed = fehlendeInformation.FindRemovedPart(modifiedFehlendeInformationen); modifiedFehlendeInformationen = modifiedFehlendeInformationen.RemoveTrailingPunctuation(); if (string.IsNullOrWhiteSpace(modifiedFehlendeInformationen)) { RemoveTemplate(p, template); edit.Save = true; edit.EditComment = string.Format("[[Vorlage:Fehlende Informationen]] entfernt (Inhalt war: „{0}“)", fehlendeInformation); } else { p.text = p.text.Replace(fehlendeInformation, modifiedFehlendeInformationen); edit.Save = true; edit.EditComment = string.Format("Aus fehlenden Informationen entfernt: „{0}“", removed); } } } }