private async void Add()
 {
     if (Quantity > 0)
     {
         if (!Details.Any(a => a.ProductCode.Trim().ToLower() == SearchProduct.Trim().ToLower()))
         {
             Details.Add(new SampleDetailExtend()
             {
                 Id          = (Cont += 1),
                 ProductCode = SelectedValueBp,
                 ProductName = SystemElementList.FirstOrDefault(a => a.Code == SelectedValueBp).Description,
                 Quantity    = Quantity,
                 User        = "******"
             });
             HeightList        = (_details.Count * 45) + (_details.Count * 10);
             Quantity          = 0;
             ExistProduct      = false;
             SearchProduct     = string.Empty;
             SystemElementList = null;
             MessageSearch     = string.Empty;
         }
         else
         {
             MessageSearch = "El producto ya se encuentra en la Muestra";
         }
     }
     else
     {
         MessageSearch = "La Cantidad ingresada debe ser mayor a 0";
     }
 }
Esempio n. 2
0
        void ExplodeFile()
        {
            string strLine = null;
            var    srFile  = new StreamReader(File);

            var SegA = new CNAB240SegmentoA();
            var SegB = new CNAB240SegmentoB();

            while ((strLine = srFile.ReadLine()) != null)
            {
                object ret = LineProcessing(strLine);

                if (ret is CNAB240Header)
                {
                    this.Header = ret as CNAB240Header;
                }
                else if (ret is CNAB240SegmentoA)
                {
                    SegA = ret as CNAB240SegmentoA;
                }
                else if (ret is CNAB240SegmentoB)
                {
                    SegB = ret as CNAB240SegmentoB;
                    Details.Add(new CNAB240Detail()
                    {
                        SegmentoA = SegA,
                        SegmentoB = SegB,
                    });
                    SegA = null;
                    SegB = null;
                }
            }

            srFile.Close();
        }
Esempio n. 3
0
        /// <summary>Set a value into the <see cref="Details"/> bag. If a value with the same name already exists it is overwritten.</summary>
        /// <param name="detailName">The name of the item to set.</param>
        /// <param name="value">The value to set. If this parameter is null the detail is removed.</param>
        /// <param name="valueType">The type of value to store in details.</param>
        public virtual void SetDetail(string detailName, object value, Type valueType)
        {
            ContentDetail detail = null;

            if (Details.TryGetValue(detailName, out detail))
            {
                if (value != null)
                {
                    // update an existing detail of same type
                    detail.Value = value;
                    return;
                }
            }

            if (detail != null)
            {
                // delete detail or remove detail of wrong type
                Details.Remove(detailName);
            }
            if (value != null)
            {
                // add new detail
                Details.Add(detailName, N2.Details.ContentDetail.New(this, detailName, value));
            }
        }
Esempio n. 4
0
 //This should not be in clean model...It's an anti pattern..
 public void AddDetail(string key, string value)
 {
     if (!string.IsNullOrEmpty(value))
     {
         Details.Add(key, value);
     }
 }
Esempio n. 5
0
 /// <summary>Adds a value to the collection.</summary>
 /// <param name="value">The value to add.</param>
 /// <returns>the index of the added value.</returns>
 public virtual int Add(object value)
 {
     Untemporarize();
     ContentDetail detail = GetDetail(value);
     Details.Add(detail);
     return Details.Count - 1;
 }
Esempio n. 6
0
        /// <summary>Adds a value to the collection.</summary>
        /// <param name="value">The value to add.</param>
        /// <returns>the index of the added value.</returns>
        public int Add(object value)
        {
            ContentDetail detail = GetDetail(value);

            Details.Add(detail);
            return(Details.Count - 1);
        }
Esempio n. 7
0
 private void ShowDetails(IEnumerable <ScheduleDetail> details)
 {
     if (Details != null)
     {
         Details.CollectionChanged -= OnDetailsChanged;
         Details = new ObservableCollection <ScheduleDetailsController>();
         Details.CollectionChanged += OnDetailsChanged;
     }
     foreach (var scheduleDetail in details)
     {
         ScheduleDetailsController sdController = new ScheduleDetailsController()
         {
             Id             = scheduleDetail.Id,
             ScheduleId     = scheduleDetail.ScheduleId,
             AmountDue      = scheduleDetail.AmountDue,
             DateDue        = scheduleDetail.DateDue,
             AmountPaid     = scheduleDetail.AmountPaid,
             ContractNo     = scheduleDetail.ContractNo,
             DiscountAmount = scheduleDetail.DiscountAmount,
             State          = ControllerStates.Loaded,
             Remarks        = scheduleDetail.Remarks
         };
         Debug.Assert(Details != null, "Details != null");
         Details.Add(sdController);
     }
 }
        public void OpenNewBookDetail()
        {
            var item = _bookDetailCreator();

            item.Title = "Book " + _newItemCounter++;
            Details.Add(item);
            SelectedDetail = item;
        }
Esempio n. 9
0
 public void AddDetail(string category, string content)
 {
     Details.Add(new HistoryEventDetail()
     {
         Category = category ?? string.Empty,
         Content  = content ?? string.Empty
     });
 }
Esempio n. 10
0
 public void AddDetail(string detail)
 {
     if (Details == null)
     {
         Details = new List <string>();
     }
     Details.Add(detail);
 }
Esempio n. 11
0
        public ValidationData Fail(string mess = null, ResultCode?code = null, object data = null)
        {
            Details.Add(AppResult.OfCode(_localizer, code, data, mess));

            IsValid = false;

            return(this);
        }
Esempio n. 12
0
 public PropertyInformation IsRequired(bool isRequired)
 {
     if (isRequired)
     {
         Details.Add(new PropertyDetailInformation("NotNull"));
     }
     return(this);
 }
Esempio n. 13
0
 public void AddDetails(OrderDetail orderDetail)
 {
     if (this.Details.Contains(orderDetail))
     {
         throw new Exception($"orderDetails-{orderDetail.Id} is already existed!");
     }
     Details.Add(orderDetail);
     Amount += orderDetail.amount;
 }
Esempio n. 14
0
        private void Search(KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }
            long s;

            if (!long.TryParse(SearchText, out s))
            {
                return;
            }
            var oldDetail = Details.FirstOrDefault(x => x.Serial == s && x.Available + x.OldQuantity > x.Quantity);

            if (oldDetail != null)
            {
                oldDetail.Quantity++;
            }
            else
            {
                var item = _itemService.SearchBySerial(s);
                if (item == null)
                {
                    Messages.Notification(" لايوجد صنف بهذا الباركود " + SearchText);
                    SearchText = "";
                    return;
                }

                if (item.Quantity == 0)
                {
                    Messages.Notification("لا توجد كمية متاحة من " + item.Name);
                    SearchText = "";
                    return;
                }
                List <PurchaseItem> purchaseItems = _purchaseService.GetPurchaseItemsWithStock(item);
                var ids = Details.Where(x => x.Serial == s).Select(y => y.PurchaseItemID);
                var selectedPurchaseItem = purchaseItems.Where(x => !ids.Contains(x.ID)).FirstOrDefault();
                if (selectedPurchaseItem == null)
                {
                    Messages.Notification("لا توجد كمية متاحة من " + item.Name);
                    SearchText = "";
                    return;
                }
                OrderDetails od = new OrderDetails();
                Details.Add(od);
                od.UpdateValues  += () => Order.Total = Details.Sum(x => x.Total);
                od.PurchaseItemID = selectedPurchaseItem.ID;
                od.Available      = selectedPurchaseItem.Available;
                od.Retail         = selectedPurchaseItem.Price;
                od.Name           = item.Name;
                od.ItemID         = item.ID;
                od.Serial         = item.Serial;
                od.Price          = item.Price;
                od.Quantity       = 1;
            }
            SearchText = "";
        }
Esempio n. 15
0
 private void scoreNibs()
 {
     foreach (var card in _justTheHand)
     {
         if (card.IsJack && card.Suit == _cards[4].Suit)
         {
             Details.Add(ScoreDetail.CreateNibs(card));
         }
     }
 }
Esempio n. 16
0
        private void addThreeOfAKind(IEnumerable <Card> cards)
        {
            //If not already in a four of a kind
            if (FourOfAKind != null && FourOfAKind.Cards.Intersect(cards).Any())
            {
                return;
            }

            Details.Add(ScoreDetail.CreateThreeOfAKind(cards));
        }
Esempio n. 17
0
        private void OnAddServiceCommand(object ctrl)
        {
            var row = new AppointmentDetail()
            {
                AppointmentID = _data.ID
            };

            Details.Add(row);
            SelectedDetail = row;
        }
Esempio n. 18
0
        private void addFlush(IEnumerable <Card> cards)
        {
            //If not already in another flush
            if (Flush != null && Flush.Cards.Intersect(cards).Any())
            {
                return;
            }

            Details.Add(ScoreDetail.CreateFlush(cards));
        }
 /// <summary>
 /// Adds a detail unit to the interaction unit.
 /// </summary>
 /// <param name="controllerDetail">Detail controller</param>
 /// <returns>IUController</returns>
 public IDetailController AddDetail(IDetailController controllerDetail, string detailAlias, string idXMLDetailAlias)
 {
     Details.Add(controllerDetail);
     controllerDetail.RefreshMasterRequired += new EventHandler <RefreshRequiredMasterEventArgs>(HandleDetailRefreshMasterRequired);
     controllerDetail.DetailAlias            = detailAlias;
     controllerDetail.IdXMLDetailAlias       = idXMLDetailAlias;
     controllerDetail.RefreshDetailRequired += new EventHandler <EventArgs>(HandleDetailRefreshDetailRequired);
     controllerDetail.CloseMainScenario     += new EventHandler <EventArgs>(HandleCloseMainScenario);
     return(controllerDetail);
 }
 /// <summary>
 /// Initializes a new instance of the class
 /// </summary>
 /// <param name="checks">List of responsibilities</param>
 public ServiceStatusDetailed(Dictionary <IConfigurationStatusCheck, StatusCheckDetail> checks)
 {
     foreach (KeyValuePair <IConfigurationStatusCheck, StatusCheckDetail> check in checks)
     {
         Details.Add(new ServiceStatusDetailedEntry(
                         check.Key.Name,
                         check.Value.Value,
                         check.Value.ResponseTime));
     }
 }
        public void OpenNewFriendDetail()
        {
            var item = _friendDetailCreator();

            item.FirstName  = "Thomas";
            item.LastName   = "Huber " + _newItemCounter++;
            item.HasChanges = false;
            Details.Add(item);
            SelectedDetail = item;
        }
Esempio n. 22
0
        public AdditionalInformationService()
        {
            if (File.Exists(IndexConsts.MemeDocumentsFile))
            {
                Log.Information("Meme documents found to load metadata");

                try
                {
                    var lines = File.ReadAllLines(IndexConsts.MemeDocumentsFile);
                    Log.Information($"Found {lines.Length} meme documents. Loading metadata...");
                    foreach (var line in lines)
                    {
                        var meme = JsonConvert.DeserializeObject <Meme>(line);

                        Statuses.Add(meme.Status);

                        var details    = meme.Details.Split(", ");
                        var categories = meme.Category.Split(", ");

                        foreach (var detail in details)
                        {
                            if (Details.ContainsKey(detail))
                            {
                                Details[detail]++;
                            }
                            else
                            {
                                Details.Add(detail, 1);
                            }
                        }

                        foreach (var category in categories)
                        {
                            if (Categories.ContainsKey(category))
                            {
                                Categories[category]++;
                            }
                            else
                            {
                                Categories.Add(category, 1);
                            }
                        }
                    }
                    Log.Information($"Loading metadata finished!");
                }
                catch (Exception ex)
                {
                    Log.Error("Error while loading metadata. Reason: " + ex.Message);
                }
            }
            else
            {
                Log.Warning("Can't find meme documents file to load metadata");
            }
        }
Esempio n. 23
0
        private void updateDetail(int key, string text)
        {
            var detailText = "Detail" + key + text;

            expectedData !.Details.Remove(key);
            expectedData !.Details.Add(key, detailText);
            var detail = DC.Data.SampleDetails[key];

            detail.Update(detailText, detail.Sample);
            assertData();
        }
        /// <summary>
        /// Initialize a new instance of the class
        /// </summary>
        /// <param name="checks"></param>
        /// <param name="responsibilityFilter">Filter checks by responsibility</param>
        public ServiceStatusDetailed(Dictionary <IServiceStatusCheck, StatusCheckDetail> checks, string responsibilityFilter = null)
        {
            // We have received a filtering request, empty the responsibilities
            if (!string.IsNullOrEmpty(responsibilityFilter))
            {
                Responsibilities = new Dictionary <string, string>();
            }

            foreach (KeyValuePair <IServiceStatusCheck, StatusCheckDetail> check in checks)
            {
                // Retrieve lists of keys for required and optional responsiblities
                IEnumerable <string> requiredFor = check.Key.Responsibilities.Where(x => x.Value == ServiceStatusRequirement.Required).Select(x => x.Key);
                IEnumerable <string> optionalFor = check.Key.Responsibilities.Where(x => x.Value == ServiceStatusRequirement.Optional).Select(x => x.Key);

                // Add the Add the service status detialed entry
                Details.Add(new ServiceStatusDetailedEntry(
                                check.Key.Name,
                                check.Value.Value,
                                check.Value.ResponseTime,
                                string.IsNullOrEmpty(responsibilityFilter) && requiredFor.Any() ? requiredFor.ToArray() : null,
                                string.IsNullOrEmpty(responsibilityFilter) && optionalFor.Any() ? optionalFor.ToArray() : null));
            }

            // Gather responsibilities
            IEnumerable <string> responsibilities = !string.IsNullOrEmpty(responsibilityFilter) ?
                                                    checks.Keys.SelectMany(statusCheck => statusCheck.Responsibilities.Where(x => x.Key.Equals(responsibilityFilter, StringComparison.OrdinalIgnoreCase)).Select(y => y.Key)).Distinct() :
                                                    checks.Keys.SelectMany(statusCheck => statusCheck.Responsibilities.Select(x => x.Key)).Distinct();

            foreach (string responsibility in responsibilities)
            {
                var applicableServiceStatusChecks = checks.Keys
                                                    .Where(statusCheck => statusCheck.Responsibilities.Any(checkResponsibility => checkResponsibility.Key.Equals(responsibility, StringComparison.OrdinalIgnoreCase)))
                                                    .ToList();

                bool anyWantedFailures = applicableServiceStatusChecks
                                         .Where(statusCheck => statusCheck.Responsibilities.Single(x => x.Key.Equals(responsibility, StringComparison.OrdinalIgnoreCase)).Value == ServiceStatusRequirement.Optional)
                                         .Any(statusCheck => checks[statusCheck].Value != StatusTypes.OK);

                bool anyNeededFailures = applicableServiceStatusChecks
                                         .Where(statusCheck => statusCheck.Responsibilities.Single(x => x.Key.Equals(responsibility, StringComparison.OrdinalIgnoreCase)).Value == ServiceStatusRequirement.Required)
                                         .Any(statusCheck => checks[statusCheck].Value != StatusTypes.OK);

                string result = anyNeededFailures ? StatusTypes.Offline : anyWantedFailures ? StatusTypes.Degraded : StatusTypes.OK;

                if (!Responsibilities.ContainsKey(responsibility))
                {
                    Responsibilities.Add(responsibility, result);
                }
                else
                {
                    Responsibilities[responsibility] = result;
                }
            }
        }
Esempio n. 25
0
        private void OnItemAdded(Item obj)
        {
            var pd = new PurchaseDetails()
            {
                ItemID = obj.ID, Name = obj.Name, Quantity = 1
            };

            pd.OnUpdateValues += () => Purchase.Total = Details.Sum(x => x.Total);
            Details.Add(pd);
            SelectedDetail = pd;
        }
        public void AddDetail(SurveyTemplateQuestion item)
        {
            item.SurveyTemplateId = this.Id;
            item.SurveyTemplate   = this;
            item.IsActive         = true;
            item.CreationUser     = System.Threading.Thread.CurrentPrincipal.Identity.Name;
            item.CreationDate     = DateTime.Now;

            Details.Add(item);
            SetAsModified();
        }
Esempio n. 27
0
        protected void Loop(object sender, EventArgs args)
        {
            try
            {
                // get current open processes
                IEnumerable <ProcessDetails> processes = Process
                                                         .GetProcesses()
                                                         .Where(x =>
                                                                !string.IsNullOrEmpty(x.MainWindowTitle) &&
                                                                !Settings.ExcludedProcesses.Contains(x.ProcessName) &&
                                                                x.Id != ThisProcessId)
                                                         .Select(x => new ProcessDetails(x));

                // end details that are not open anymore
                IEnumerable <ProcessDetails> ended = Details
                                                     .Where(x => !x.EndTime.HasValue && !processes.Any(y => y.Id == x.Id));
                foreach (var detail in ended)
                {
                    detail.EndTime = DateTime.Now;
                }

                // add new processes that have been started
                IEnumerable <ProcessDetails> started = processes
                                                       .Where(x => !Details.Any(y => y.Id == x.Id && !y.EndTime.HasValue));
                foreach (var detail in started)
                {
                    if (Details.Any(x => x.Id == detail.Id && x.EndTime.HasValue))
                    {
                        detail.StartTime = DateTime.Now;
                    }
                    Details.Add(detail);
                }

                // replace file
                Directory.CreateDirectory(Settings.HistoryFolder);
                List <string> lines = new List <string>
                {
                    ProcessDetails.CSVTitle
                };
                lines.AddRange(Details.Select(x => x.CSV));
                File.WriteAllLines(Settings.HistoryFolder + "/" + DateTime.Now.ToString("yyyyMMdd") + "_" + ThisProcessId + ".csv", lines);

                // bind lists
                ProcessGrid.ItemsSource = Details.OrderBy(x => x.StartTime);
                ProcessGrid.Items.Refresh();
            }
            catch (Exception ex)
            {
                Errors.Add(ex.Message);
                ErrorsButton.Content    = "Errors (" + Errors.Count + ")";
                ErrorsButton.Visibility = Visibility.Visible;
            }
        }
Esempio n. 28
0
 public void AddItem(PayableItem item)
 {
     if (Details == null)
     {
         Details = new List <PayableItem>();
     }
     if (Details.Any(p => p.CostType == item.CostType))
     {
         return;
     }
     Details.Add(item);
 }
Esempio n. 29
0
 public RequestViewModel(Request request)
 {
     RequestID = request.RequestID;
     Comment   = request.Comment;
     State     = request.State;
     Author    = request.Author;
     History   = request.History;
     foreach (RequestDetail detail in request.Details)
     {
         Details.Add(new RequestDetailViewModel(detail));
     }
 }
Esempio n. 30
0
        private void addDetail(int detailKey, int sampleKey)
        {
            var detailText = "Detail" + sampleKey + '.' + detailKey;

            expectedData !.Details.Add(detailKey, detailText);
            var sample = DC.Data.SampleX[sampleKey];
            var detail = new SampleDetail(detailText, sample, false);

            detail.Store();
            expectedData !.Samples.Remove(sampleKey);
            expectedData !.Samples.Add(sampleKey, sample.ToString());
            assertData();
        }