Esempio n. 1
0
        public W_Supplier()
        {
            InitializeComponent();
            Title = "TSmatch: выбор поставщика";
            List <Spl> items = new List <Spl>();
            Docs       doc   = Docs.getDoc(Decl.SUPPLIERS);

            for (int i = doc.i0; i <= doc.il; i++)
            {
                Supl s = new Supl(i);
                if (s == null || string.IsNullOrWhiteSpace(s.Name) || string.IsNullOrWhiteSpace(s.City))
                {
                    continue;
                }
                items.Add(new Spl(s.Name, Lib.ToInt(s.Index), s.City, s.Street, s.Url));
                suppliers.Add(s);
            }
            Spl oldSupl = items.Find(x => x.SuplName == MainWindow.SuplName);

            if (oldSupl == null)
            {
                Msg.F("W_Supplier: No Selected SuplName");
            }
            int ind = items.IndexOf(oldSupl);

            items[ind].Flag = true;
            log.Info("Supplier.Count=" + suppliers.Count + "\tInitial Supplier =\"" + oldSupl.SuplName + "\"");
            items.Sort();
            Suppliers.ItemsSource = items;
        }
        public LightingSelector(ComboBoxItem comboBoxItem, Model3DGroup model3DGroup)
        {
            Model3DGroup model3DGrouppa = (Model3DGroup)this.FindName("LightGroup");

            string typeOfLight = comboBoxItem.Name;

            switch (typeOfLight)
            {
            case "drl":
                Drl drl = new Drl(model3DGroup);
                drl.Show();
                break;

            case "aml":
                Aml aml = new Aml(model3DGroup);
                aml.Show();
                break;

            case "ptl":
                Ptl ptl = new Ptl(model3DGroup);
                ptl.Show();
                break;

            case "spl":
                Spl spl = new Spl(model3DGroup);
                spl.Show();
                break;
            }
        }
Esempio n. 3
0
        private void OnSupplier_changed(object sender, SelectionChangedEventArgs e)
        {
            string oldSupplier  = MainWindow.SuplName;
            Spl    selectedSupl = (Spl)Suppliers.SelectedItem;

            selectedSupplier = selectedSupl.SuplName;
            log.Info("new Supplier selected = \"" + selectedSupl.SuplName + "\"");

            var selSupl = suppliers.Find(x => x.Name == selectedSupl.SuplName);

            if (selSupl == null)
            {
                Msg.F("Inconsystent W_Supplier");
            }
            var grOLD = MainWindow.currentGroup;
            var grNEW = selSupl.getNEWcs(selSupl, grOLD);

            if (grNEW == null)
            {
                Msg.AskOK("\"{0}\" не поставляет [{1}, {2}], но Вы можете изменить Правила" +
                          " и согласовать изменения с проектировщиком."
                          , selSupl.Name, grOLD.Mat, grOLD.Prf);
            }
            else
            {
                //////                // пересчитывать вес, объем, стоимость группы; диалог по "тому же" сортаменту
                ////////22/5                selSupl = selSupl.getTotals();
            }
#if notReady
            Supl supl =
                bool csOK = false;
            do
            {
                if (!Msg.AskYN("Вы действительно хотите заменить \"{0}\" на \"{1}\"?"
                               , oldSupplier, selectedSupplier))
                {
                    return;
                }
                var cs =
                    csOK =
            } while (csOK);
//21/5            MainWindow.SuplName = selSN;
//21/5            MainWindow.RePricing();

            Close();
#endif // notReady
        }
        /// <summary>
        ///     Returns true if RunnerChange instances are equal
        /// </summary>
        /// <param name="other">Instance of RunnerChange to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RunnerChange other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((Tv == other.Tv || Tv != null && Tv.Equals(other.Tv)) &&
                   (Batb == other.Batb || Batb != null && Batb.SequenceEqual(other.Batb)) &&
                   (Spb == other.Spb || Spb != null && Spb.SequenceEqual(other.Spb)) &&
                   (Bdatl == other.Bdatl || Bdatl != null && Bdatl.SequenceEqual(other.Bdatl)) &&
                   (Trd == other.Trd || Trd != null && Trd.SequenceEqual(other.Trd)) &&
                   (Spf == other.Spf || Spf != null && Spf.Equals(other.Spf)) &&
                   (Ltp == other.Ltp || Ltp != null && Ltp.Equals(other.Ltp)) &&
                   (Atb == other.Atb || Atb != null && Atb.SequenceEqual(other.Atb)) &&
                   (Spl == other.Spl || Spl != null && Spl.SequenceEqual(other.Spl)) &&
                   (Spn == other.Spn || Spn != null && Spn.Equals(other.Spn)) &&
                   (Atl == other.Atl || Atl != null && Atl.SequenceEqual(other.Atl)) &&
                   (Batl == other.Batl || Batl != null && Batl.SequenceEqual(other.Batl)) &&
                   (Id == other.Id || Id != null && Id.Equals(other.Id)) &&
                   (Hc == other.Hc || Hc != null && Hc.Equals(other.Hc)) &&
                   (Bdatb == other.Bdatb || Bdatb != null && Bdatb.SequenceEqual(other.Bdatb)));
        }
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (Tv != null)
                {
                    hash = hash * 59 + Tv.GetHashCode();
                }

                if (Batb != null)
                {
                    hash = hash * 59 + Batb.GetHashCode();
                }

                if (Spb != null)
                {
                    hash = hash * 59 + Spb.GetHashCode();
                }

                if (Bdatl != null)
                {
                    hash = hash * 59 + Bdatl.GetHashCode();
                }

                if (Trd != null)
                {
                    hash = hash * 59 + Trd.GetHashCode();
                }

                if (Spf != null)
                {
                    hash = hash * 59 + Spf.GetHashCode();
                }

                if (Ltp != null)
                {
                    hash = hash * 59 + Ltp.GetHashCode();
                }

                if (Atb != null)
                {
                    hash = hash * 59 + Atb.GetHashCode();
                }

                if (Spl != null)
                {
                    hash = hash * 59 + Spl.GetHashCode();
                }

                if (Spn != null)
                {
                    hash = hash * 59 + Spn.GetHashCode();
                }

                if (Atl != null)
                {
                    hash = hash * 59 + Atl.GetHashCode();
                }

                if (Batl != null)
                {
                    hash = hash * 59 + Batl.GetHashCode();
                }

                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (Hc != null)
                {
                    hash = hash * 59 + Hc.GetHashCode();
                }

                if (Bdatb != null)
                {
                    hash = hash * 59 + Bdatb.GetHashCode();
                }

                return(hash);
            }
        }