예제 #1
0
        private void FillChartTable(CompareItem item, DataTable dt)
        {
            List <string> dates = item.Targets.Keys.ToList <string>();

            foreach (string d in dates)
            {
                if (_dateList.Contains(d) == false)
                {
                    _dateList.Add(d);
                }
            }
            _dateList.Sort();

            float tarQty  = 0.0f;
            float planQty = 0.0f;
            float diffQty = 0.0f;

            foreach (string date in _dateList)
            {
                // TARGET
                float qty1 = 0.0f;
                item.Targets.TryGetValue(date, out qty1);
                tarQty += qty1;

                DataRow chartRow = dt.NewRow();

                chartRow[TargetPlanCompareData.CATEGORY]    = QtyType.TARGET.ToString();
                chartRow[TargetPlanCompareData.TARGET_DATE] = date;
                chartRow[TargetPlanCompareData.QTY]         = tarQty;

                dt.Rows.Add(chartRow);


                // Plan
                float qty2 = 0.0f;
                item.Plans.TryGetValue(date, out qty2);
                planQty += qty2;

                DataRow chartRow2 = dt.NewRow();

                chartRow2[TargetPlanCompareData.CATEGORY]    = QtyType.PLAN.ToString();
                chartRow2[TargetPlanCompareData.TARGET_DATE] = date;
                chartRow2[TargetPlanCompareData.QTY]         = planQty;

                dt.Rows.Add(chartRow2);

                // DIFF
                float qty3 = 0.0f;
                item.Diffs.TryGetValue(date, out qty3);
                diffQty += qty3;

                DataRow chartRow3 = dt.NewRow();

                chartRow3[TargetPlanCompareData.CATEGORY]    = QtyType.DIFF.ToString();
                chartRow3[TargetPlanCompareData.TARGET_DATE] = date;
                chartRow3[TargetPlanCompareData.QTY]         = diffQty;

                dt.Rows.Add(chartRow3);
            }
        }
예제 #2
0
        //

        //Store a compare item
        public JsonResult AddItem(CompareItem input)
        {
            var items    = GetSessionItems();
            var existing = items.FirstOrDefault(m => m.Id == input.Id && m.Type == input.Type);

            if (existing == null)
            {
                //Don't allow too many items to be compared
                if (items.Count() >= 10)
                {
                    return(JsonHelper.GetJsonWithWrapper(null, false, "You can only compare up to 10 items. Please remove one or more items and try again.", null));
                }

                //Add the item
                items.Add(new CompareItem()
                {
                    Id    = input.Id,
                    Type  = input.Type.ToLower(),
                    Title = input.Title
                });

                UpdateSessionItems(items);

                return(JsonHelper.GetJsonWithWrapper(items));
            }
            else
            {
                return(JsonHelper.GetJsonWithWrapper(null, false, "That item is already in the list of items to compare!", null));
            }
        }
예제 #3
0
        protected override CompareSyncMessageEventArgs DoBehaviorAction(CompareItem item)
        {
            CompareSyncMessageEventArgs result = new CompareSyncMessageEventArgs();

            switch (item.CompareState)
            {
            case CompareStateType.Different:
            case CompareStateType.LeftOrphan:
                string dir = Path.GetDirectoryName(Path.Combine(this.Worker.RightCompareRootPath, item.RelativePath));
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
                File.Copy(item.Left.FullPath, item.Right.FullPath, true);
                result.SyncActionText = string.Format("'{0}' copied to '{1}'", item.RelativePath, item.RightCompareRootPath);
                result.SyncAction     = SyncActionType.Copied;
                break;

            case CompareStateType.RightOrphan:
                File.Delete(item.Right.FullPath);
                result.SyncActionText = string.Format("'{0}' deleted from '{1}'", item.RelativePath, item.RightCompareRootPath);
                result.SyncAction     = SyncActionType.Deleted;
                break;
            }
            return(result);
        }
        public void AddToCompare(int productid)
        {
            //pobiera aktualny stan koszyka z sesji
            var cart = this.GetCompare();
            //sprawdzamy czy ten product co chcemy dodac do koszyka jest w nim czy nie
            var cartItem = cart.Find(c => c.Product.ProductId == productid);

            if (cartItem != null)
            {
            }

            else
            {
                // znajdz produkt i dodaj do karty zamowienia
                var productToAdd = db.Products.Where(a => a.ProductId == productid).SingleOrDefault();
                if (productToAdd != null)
                {
                    //jesli znaleziono
                    var newCartItem = new CompareItem()
                    {
                        Product = productToAdd
                    };
                    //dodaj do karty
                    cart.Add(newCartItem);
                }
            }

            //zapisujemy ponownie stan listy w sesji
            session.Set(CompareSessionKey, cart);
        }
예제 #5
0
        private CompareItem CompareWithAnother(Property property1, Property property2)
        {
            Preconditions.NotNull(property1, "property1");
            Preconditions.NotNull(property2, "property2");
            Preconditions.Check <NotSupportedException>(property1.Name.Equals(property2.Name, StringComparison.InvariantCulture), "Should not compare to property with different name.");

            return(CompareItem.WithBothData(property1.Name,
                                            property1.Select(item => FieldToCompare(item.Value)).ToList(),
                                            property2.Select(item => FieldToCompare(item.Value)).ToList()));
        }
예제 #6
0
 private CompareFile NewCompareFile(string fileName)
 {
     return(new CompareFile("fileName",
                            new List <CompareItem>()
     {
         CompareItem.WithData1("property", new List <CompareValue>()
         {
             new CompareValue("name", "value")
         })
     }));
 }
예제 #7
0
        //

        //Remove a compare item
        public JsonResult RemoveItem(CompareItem input)
        {
            var items    = GetSessionItems();
            var existing = items.FirstOrDefault(m => m.Id == input.Id && m.Type == input.Type);

            if (existing != null)
            {
                items.Remove(existing);
                UpdateSessionItems(items);
                return(JsonHelper.GetJsonWithWrapper(items));
            }
            else
            {
                return(JsonHelper.GetJsonWithWrapper(null, false, "Item not found!", null));
            }
        }
예제 #8
0
파일: Work.cs 프로젝트: caryx/goldsample
        bool filter(List <StockDayData> dataList, int current, int count, CompareItem compare)
        {
            if (current - count - 1 < 0)
            {
                return(false);
            }

            for (int i = 0; i < count; ++i)
            {
                if (!compare(dataList[current - i - 1], dataList[current - i]))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #9
0
		public CompareSyncMessageEventArgs SyncItem(CompareItem item)
		{
			CompareSyncMessageEventArgs result = new CompareSyncMessageEventArgs();
			switch(item.CompareState)
			{
				case CompareStateType.Unknown:
				case CompareStateType.Match:
					result.SyncActionText = string.Format("No action taken on '{0}'", item.RelativePath);
					result.SyncAction = SyncActionType.None;
					break;
				case CompareStateType.LeftOrphan:
				case CompareStateType.RightOrphan:
				case CompareStateType.Different:
					result = DoBehaviorAction(item);
					break;
			}
			return result;
		}
예제 #10
0
        private void FillData(XtraPivotGridHelper.DataViewTable dataViewTable, CompareItem item, string targetDate, CompareItem total, QtyType qtyType)
        {
            string category = qtyType.ToString();
            float  qty      = 0.0f;

            if (ShowAccumulativeQty)
            {
                qty = item.GetAccQty(targetDate, qtyType);
            }
            else
            {
                qty = item.GetQty(targetDate, qtyType);
            }

            dataViewTable.DataTable.Rows.Add(
                item.SHOP_ID,
                item.STEP_ID,
                item.PRODUCT_ID,
                item.OWNER_TYPE,
                category,
                string.Format("{0:#,##0}", item.GetTotalQty(qtyType)),
                targetDate,
                qty);

            //Total
            var infos = qtyType == QtyType.TARGET ? total.Targets : total.Plans;

            if (qtyType == QtyType.DIFF)
            {
                infos = total.Diffs;
            }

            float prevQty = 0;

            if (infos.TryGetValue(targetDate, out prevQty))
            {
                infos[targetDate] += qty;
            }
            else
            {
                infos.Add(targetDate, 0);
            }
        }
예제 #11
0
        protected override CompareSyncMessageEventArgs DoBehaviorAction(CompareItem item)
        {
            CompareSyncMessageEventArgs result = new CompareSyncMessageEventArgs();

            switch (item.CompareState)
            {
            case CompareStateType.Different:
            case CompareStateType.LeftOrphan:
                result.SyncActionText = string.Format("'{0}' will be copied to '{1}'", item.RelativePath, item.RightCompareRootPath);
                result.SyncAction     = SyncActionType.Copied;
                break;

            case CompareStateType.RightOrphan:
                result.SyncActionText = string.Format("'{0}' will be deleted from '{1}'", item.RelativePath, item.RightCompareRootPath);
                result.SyncAction     = SyncActionType.Deleted;
                break;
            }
            return(result);
        }
            public void File_NotExist()
            {
                var service  = Container.GetExportedValue <IExcelReportDocumentType>();
                var document = service.New();

                document.NewSheet(
                    new CompareFile("test1",
                                    new List <CompareItem>()
                {
                    CompareItem.WithData1("property", new List <CompareValue>()
                    {
                        new CompareValue("name", "value")
                    })
                }),
                    "path1", "path2", new ExcelReportConfigurationDocument());

                Assert.IsFalse(File.Exists(EXCEL_REPORT_FILE_NAME));
                service.Save(document, EXCEL_REPORT_FILE_NAME);
                Assert.IsTrue(File.Exists(EXCEL_REPORT_FILE_NAME));
            }
예제 #13
0
    public override Control Reconcile(IEnumerable<PricingItem> mlpSource_, IEnumerable<PricingItem> dsSource_)
    {
      var allCodes = mlpSource_.Union(dsSource_).Select(x => x.SymmetryCode).Distinct();

      var lines = new System.ComponentModel.BindingList<CompareItem>();

      foreach(var symCode in allCodes)
      {
        var mlpItem = mlpSource_.Where(x => x.SymmetryCode.Equals(symCode)).FirstOrDefault();

        var dsItem = dsSource_.Where(x => x.SymmetryCode.Equals(symCode))
          // want to see the underlying price source (will be tweb most of the time, else reuters)
          .Where(x => x.QuoteSourceCode.Equals("SYM")).FirstOrDefault();

        var line = new CompareItem();

        if(mlpItem!=null)
        {
          line.SetCommon(mlpItem);
          line.MLPPrice = mlpItem.Value;
        }

        if(dsItem!=null)
        {
          line.SetCommon(dsItem);
          line.DSSnapCode = dsItem.SnapCode;
          line.DSPrice = dsItem.Value;
          //line.DSSources = string.Join(",", dsSource_.Where(x => x.SymmetryCode.Equals(symCode) && !x.QuoteSourceCode.Equals("SYM")).Select(x => x.QuoteSourceCode).OrderBy(x=>x).ToArray());
          line.DSSources = string.Join(", ", dsSource_.Where(x => x.SymmetryCode.Equals(symCode) && !x.QuoteSourceCode.Equals("SYM")).OrderBy(x=>x.QuoteSourceCode).Select(x => string.Format("{0}:{1}", x.QuoteSourceCode, x.Value)).ToArray());
        }
        lines.Add(line);
      }

      var control = new CurveCompareControl();
      control.Create(lines);
      //control.DisplayInShowForm(string.Format("{0} curve", m_codeBase));
      return control;
    }
예제 #14
0
    /// <summary>
    /// Binds the data.
    /// </summary>
    public void BindData()
    {
        string[] mcs = CommonHelper.GetCompareMetaClasses();
        CompareGroupsRepeater.DataSource = mcs;
        CompareGroupsRepeater.DataBind();

        rptrHeaderImage.DataBind();
        rptrHeaderPurchaseLink.DataBind();

        List <CompareItem> listCompare = new List <CompareItem>();

        if (CurrentMetaClass != null)
        {
            MetaFieldCollection metaFields = CurrentMetaClass.UserMetaFields;
            if (metaFields != null && metaFields.Count > 0)
            {
                foreach (MetaField metaField in metaFields)
                {
                    string useInComparingAttribute = metaField.Attributes["UseInComparing"];
                    if (!string.IsNullOrEmpty(useInComparingAttribute) && bool.Parse(useInComparingAttribute))
                    {
                        CompareItem compareItem = new CompareItem();
                        compareItem.Title = metaField.FriendlyName;

                        List <string> items = new List <string>();
                        foreach (Entry product in ProductsToCompare)
                        {
                            string compareValue = String.Empty;

                            ItemAttribute item = product.ItemAttributes[metaField.Name];
                            if (item != null && item.Value != null && item.Value.Length > 0)
                            {
                                compareValue = item.Value[0];
                            }
                            items.Add(compareValue);
                        }

                        if (items.Count > 1)
                        {
                            for (int i = 1; i < items.Count; i++)
                            {
                                if (String.Compare(items[i - 1], items[i], true) != 0)
                                {
                                    break;
                                }

                                if (i == items.Count - 1)
                                {
                                    compareItem.EqualValues = true;
                                }
                            }
                        }

                        compareItem.Attributes = items.ToArray();
                        listCompare.Add(compareItem);
                    }
                }
            }
        }

        rptrMainTable.DataSource = listCompare;
        rptrMainTable.DataBind();
    }
예제 #15
0
        public override void ModifyTabPages(TabControl tabControl)
        {
            TabPage page = new TabPage
            {
                Tag  = tabControl.TabCount + 1,
                Text = "Compare Items"
            };
            CompareItem compArt = new CompareItem
            {
                Dock = DockStyle.Fill
            };

            page.Controls.Add(compArt);
            tabControl.TabPages.Add(page);

            TabPage page2 = new TabPage
            {
                Tag  = tabControl.TabCount + 1,
                Text = "Compare Land"
            };
            CompareLand compLand = new CompareLand
            {
                Dock = DockStyle.Fill
            };

            page2.Controls.Add(compLand);
            tabControl.TabPages.Add(page2);

            TabPage page3 = new TabPage
            {
                Tag  = tabControl.TabCount + 1,
                Text = "Compare CliLocs"
            };
            CompareCliLoc compCli = new CompareCliLoc
            {
                Dock = DockStyle.Fill
            };

            page3.Controls.Add(compCli);
            tabControl.TabPages.Add(page3);

            TabPage page4 = new TabPage
            {
                Tag  = tabControl.TabCount + 1,
                Text = "Compare Hues"
            };
            CompareHues compH = new CompareHues
            {
                Dock = DockStyle.Fill
            };

            page4.Controls.Add(compH);
            tabControl.TabPages.Add(page4);

            TabPage page5 = new TabPage
            {
                Tag  = tabControl.TabCount + 1,
                Text = "Compare Gumps"
            };
            CompareGump compG = new CompareGump
            {
                Dock = DockStyle.Fill
            };

            page5.Controls.Add(compG);
            tabControl.TabPages.Add(page5);

            TabPage page6 = new TabPage
            {
                Tag  = tabControl.TabCount + 1,
                Text = "Compare Map"
            };
            CompareMap compM = new CompareMap
            {
                Dock = DockStyle.Fill
            };

            page6.Controls.Add(compM);
            tabControl.TabPages.Add(page6);
            TabPage page7 = new TabPage
            {
                Tag  = tabControl.TabCount + 1,
                Text = "Compare Texture"
            };
            CompareTexture compTexture = new CompareTexture
            {
                Dock = DockStyle.Fill
            };

            page7.Controls.Add(compTexture);
            tabControl.TabPages.Add(page7);
        }
예제 #16
0
        public void DisplayDirectoryResults(CompareText SourceDiffList, CompareText DestinationDiffList,
                                            ArrayList ResultLines)
        {
            CompareItem lviS;
            CompareItem lviD;

            ListFiles1 = new List <CompareItem>();
            ListFiles2 = new List <CompareItem>();

            sourceDiffList      = SourceDiffList;
            destinationDiffList = DestinationDiffList;
            resultLines         = ResultLines;

            int cnt = 1;

            DifferenceLines = new ArrayList();

            string numberMask = "000";

            if (sourceDiffList.Count() > 999 && sourceDiffList.Count() > sourceDiffList.Count())
            {
                for (int x = 0; x < sourceDiffList.Count().ToString().Length; x++)
                {
                    numberMask = numberMask + "0";
                }
            }
            else if (destinationDiffList.Count() > 999)
            {
                for (int x = 0; x < destinationDiffList.Count().ToString().Length; x++)
                {
                    numberMask = numberMask + "0";
                }
            }


            foreach (CompareResultSpan drs in resultLines)
            {
                switch (drs.Status)
                {
                case CompareResultSpanStatus.DeleteSource:
                    for (int i = 0; i < drs.Length; i++)
                    {
                        lviS = new CompareItem(cnt.ToString(numberMask));
                        lviD = new CompareItem(cnt.ToString(numberMask));

                        DifferenceLines.Add(cnt);

                        lviS.CompareResultTag = CompareItem.CompareResult.Add;
                        lviD.CompareResultTag = CompareItem.CompareResult.Add;
                        lviS.ItemSourceTag    = CompareItem.ItemSource.Original;
                        lviD.ItemSourceTag    = CompareItem.ItemSource.NotInOriginal;

                        summary.LinesLeftOnly++;

                        //Green
                        lviS.BackColor = Color.FromArgb(208, 236, 204);
                        lviD.BackColor = Color.FromArgb(208, 236, 204);

                        lviS.SubItems.Add((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Line);
                        lviS.SubItems.Add((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Size);
                        lviS.SubItems.Add(
                            (sourceDiffList.GetByIndex(drs.SourceIndex + i)).Type.ToString());
                        lviS.SubItems.Add((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Path);

                        if ((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Type == PathType.Directory)
                        {
                            lviS.ImageIndex = 0;
                        }
                        else
                        {
                            lviS.ImageIndex = 1;
                        }

                        lviD.SubItems.Add("");

                        ListFiles1.Add(lviS);
                        ListFiles2.Add(lviD);
                        cnt++;
                    }

                    break;

                case CompareResultSpanStatus.NoChange:
                    for (int i = 0; i < drs.Length; i++)
                    {
                        lviS = new CompareItem(cnt.ToString(numberMask));
                        lviD = new CompareItem(cnt.ToString(numberMask));

                        lviS.CompareResultTag = CompareItem.CompareResult.Equal;
                        lviD.CompareResultTag = CompareItem.CompareResult.Equal;
                        lviS.ItemSourceTag    = CompareItem.ItemSource.Original;
                        lviD.ItemSourceTag    = CompareItem.ItemSource.Original;

                        summary.LinesMatch++;

                        lviS.BackColor = Color.White;
                        lviD.BackColor = Color.White;

                        lviS.SubItems.Add((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Line);
                        lviS.SubItems.Add((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Size);
                        lviS.SubItems.Add(
                            (sourceDiffList.GetByIndex(drs.SourceIndex + i)).Type.ToString());
                        lviS.SubItems.Add((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Path);

                        if ((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Type ==
                            PathType.Directory)
                        {
                            lviS.ImageIndex = 0;
                        }
                        else
                        {
                            lviS.ImageIndex = 1;
                        }

                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Line);
                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Size);
                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Type.
                            ToString());
                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Path);


                        if ((destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Type ==
                            PathType.Directory)
                        {
                            lviD.ImageIndex = 0;
                        }
                        else
                        {
                            lviD.ImageIndex = 1;
                        }



                        ListFiles1.Add(lviS);
                        ListFiles2.Add(lviD);
                        cnt++;
                    }

                    break;

                case CompareResultSpanStatus.AddDestination:
                    for (int i = 0; i < drs.Length; i++)
                    {
                        lviS = new CompareItem(cnt.ToString(numberMask));
                        lviD = new CompareItem(cnt.ToString(numberMask));

                        DifferenceLines.Add(cnt);

                        lviS.CompareResultTag = CompareItem.CompareResult.Delete;
                        lviD.CompareResultTag = CompareItem.CompareResult.Delete;
                        lviS.ItemSourceTag    = CompareItem.ItemSource.NotInOriginal;
                        lviD.ItemSourceTag    = CompareItem.ItemSource.Original;

                        summary.LinesRightOnly++;

                        //Gray
                        lviS.BackColor = Color.FromArgb(224, 224, 224);
                        //Light Coral
                        lviD.BackColor = Color.FromArgb(241, 213, 214);

                        lviS.SubItems.Add("");


                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Line);
                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Size);
                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Type.
                            ToString());
                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Path);

                        if ((destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Type ==
                            PathType.Directory)
                        {
                            lviD.ImageIndex = 0;
                        }
                        else
                        {
                            lviD.ImageIndex = 1;
                        }



                        ListFiles1.Add(lviS);
                        ListFiles2.Add(lviD);

                        cnt++;
                    }

                    break;

                case CompareResultSpanStatus.Replace:
                    for (int i = 0; i < drs.Length; i++)
                    {
                        lviS = new CompareItem(cnt.ToString(numberMask));
                        lviD = new CompareItem(cnt.ToString(numberMask));

                        lviS.CompareResultTag = CompareItem.CompareResult.Replace;
                        lviD.CompareResultTag = CompareItem.CompareResult.Replace;
                        lviS.ItemSourceTag    = CompareItem.ItemSource.Original;
                        lviD.ItemSourceTag    = CompareItem.ItemSource.Original;

                        summary.LinesDifferent++;

                        DifferenceLines.Add(cnt);

                        //Green
                        lviS.BackColor = Color.FromArgb(208, 236, 204);
                        lviD.BackColor = Color.FromArgb(208, 236, 204);

                        lviS.SubItems.Add((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Line);
                        lviS.SubItems.Add((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Size);
                        lviS.SubItems.Add(
                            (sourceDiffList.GetByIndex(drs.SourceIndex + i)).Type.ToString());
                        lviS.SubItems.Add((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Path);


                        if ((sourceDiffList.GetByIndex(drs.SourceIndex + i)).Type ==
                            PathType.Directory)
                        {
                            lviS.ImageIndex = 0;
                        }
                        else
                        {
                            lviS.ImageIndex = 1;
                        }



                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Line);
                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Size);
                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Type.
                            ToString());
                        lviD.SubItems.Add(
                            (destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Path);

                        if ((destinationDiffList.GetByIndex(drs.DestinationIndex + i)).Type ==
                            PathType.Directory)
                        {
                            lviD.ImageIndex = 0;
                        }
                        else
                        {
                            lviD.ImageIndex = 1;
                        }



                        ListFiles1.Add(lviS);
                        ListFiles2.Add(lviD);
                        cnt++;
                    }

                    break;
                }
            }
        }
예제 #17
0
        private void LoadData_Plan(Dictionary <string, CompareItem> results)
        {
            string filter2 = string.Empty;

            if (this.shopIdComboBox.Text != Consts.ALL)
            {
                filter2 = string.Format("SHOP_ID = '{0}'", this.shopIdComboBox.Text);
            }

            DataTable dt = _result.LoadOutput(TargetPlanCompareData.DATA_TABLE_4, filter2);

            var mainStdStepList = GetMainStdStepList(this.TargetAreaID);

            _stepIndexs = new Dictionary <string, int>();

            foreach (DataRow row in dt.Rows)
            {
                TargetPlanCompareData.StepMove sm = new TargetPlanCompareData.StepMove(row);

                if (this.TargetAreaID != sm.AreaID)
                {
                    continue;
                }

                if (sm.CompareTargetDate < StartTime)
                {
                    continue;
                }

                if (sm.CompareTargetDate > EndTime)
                {
                    continue;
                }

                if (this.TargetShopID != "ALL")
                {
                    if (!sm.ShopID.ToUpper().Contains(this.TargetShopID))
                    {
                        continue;
                    }
                }

                if (sm.OwnerType != OwnerType)
                {
                    continue;
                }

                if (Products.Contains(sm.ProductID) == false)
                {
                    continue;
                }

                if (IsOnlyMainStep)
                {
                    if (mainStdStepList.Contains(sm.StepID) == false)
                    {
                        continue;
                    }
                }

                if (this.TargetStdStep != Consts.ALL && sm.StepID != this.TargetStdStep)
                {
                    continue;
                }

                string key = sm.ShopID + sm.ProductID + sm.StepID;

                string stepKey = sm.StepID;
                _stepIndexs[stepKey] = sm.StdStepSeq;

                CompareItem compItem;
                if (!results.TryGetValue(key, out compItem))
                {
                    compItem = new CompareItem(sm.ShopID, sm.ProductID, sm.StepID);
                    _resultDict.Add(key, compItem);

                    compItem.PRODUCT_ID = sm.ProductID;
                    compItem.STEP_ID    = sm.StepID;
                    compItem.SHOP_ID    = sm.ShopID;
                    compItem.OWNER_TYPE = sm.OwnerType;
                }

                if (sm.StepID == "9900")
                {
                    Console.WriteLine();
                }

                compItem.AddQty(sm.TargetDate, sm.OutQty, QtyType.PLAN);
            }
        }
예제 #18
0
        public override void ModifyTabPages(TabControl tabcontrol)
        {
            TabPage page = new TabPage();

            page.Tag  = tabcontrol.TabCount + 1;
            page.Text = "Compare Items";
            CompareItem compArt = new CompareItem();

            compArt.Dock = System.Windows.Forms.DockStyle.Fill;
            page.Controls.Add(compArt);
            tabcontrol.TabPages.Add(page);

            TabPage page2 = new TabPage();

            page2.Tag  = tabcontrol.TabCount + 1;
            page2.Text = "Compare Land";
            CompareLand compLand = new CompareLand();

            compLand.Dock = System.Windows.Forms.DockStyle.Fill;
            page2.Controls.Add(compLand);
            tabcontrol.TabPages.Add(page2);

            TabPage page3 = new TabPage();

            page3.Tag  = tabcontrol.TabCount + 1;
            page3.Text = "Compare CliLocs";
            CompareCliLoc compCli = new CompareCliLoc();

            compCli.Dock = System.Windows.Forms.DockStyle.Fill;
            page3.Controls.Add(compCli);
            tabcontrol.TabPages.Add(page3);

            TabPage page4 = new TabPage();

            page4.Tag  = tabcontrol.TabCount + 1;
            page4.Text = "Compare Hues";
            CompareHues compH = new CompareHues();

            compH.Dock = System.Windows.Forms.DockStyle.Fill;
            page4.Controls.Add(compH);
            tabcontrol.TabPages.Add(page4);

            TabPage page5 = new TabPage();

            page5.Tag  = tabcontrol.TabCount + 1;
            page5.Text = "Compare Gumps";
            CompareGump compG = new CompareGump();

            compG.Dock = System.Windows.Forms.DockStyle.Fill;
            page5.Controls.Add(compG);
            tabcontrol.TabPages.Add(page5);

            TabPage page6 = new TabPage();

            page6.Tag  = tabcontrol.TabCount + 1;
            page6.Text = "Compare Map";
            CompareMap compM = new CompareMap();

            compM.Dock = System.Windows.Forms.DockStyle.Fill;
            page6.Controls.Add(compM);
            tabcontrol.TabPages.Add(page6);
            TabPage page7 = new TabPage();

            page7.Tag  = tabcontrol.TabCount + 1;
            page7.Text = "Compare Texture";
            CompareTexture compTexture = new CompareTexture();

            compTexture.Dock = System.Windows.Forms.DockStyle.Fill;
            page7.Controls.Add(compTexture);
            tabcontrol.TabPages.Add(page7);
        }
예제 #19
0
        private CompareItem NothingWithCompareData(Property property)
        {
            Preconditions.NotNull(property, "property");

            return(CompareItem.WithData2(property.Name, property.Select(item => FieldToCompare(item.Value)).ToList()));
        }
예제 #20
0
		protected abstract CompareSyncMessageEventArgs DoBehaviorAction(CompareItem item);
예제 #21
0
 protected override CompareSyncMessageEventArgs DoBehaviorAction(CompareItem item)
 {
     return(new CompareSyncMessageEventArgs());
 }
예제 #22
0
        private void FillData(XtraPivotGridHelper.DataViewTable dataViewTable)
        {
            CompareItem total = new CompareItem("TOTAL", "", "");

            foreach (CompareItem item in _resultDict.Values)
            {
                item.SetAccQty();

                foreach (var targetDate in item.Dates)
                {
                    FillData(dataViewTable, item, targetDate, total, QtyType.TARGET);

                    FillData(dataViewTable, item, targetDate, total, QtyType.PLAN);

                    FillData(dataViewTable, item, targetDate, total, QtyType.DIFF);
                }
            }

            //Total
            _resultDict.Add("TOTAL", total);

            List <float> totalTargetList = new List <float>();
            List <float> totalPlanList   = new List <float>();

            foreach (var item in _resultDict.Values)
            {
                totalTargetList.Add(item.TARGET_TOTAL);
                totalPlanList.Add(item.PLAN_TOTAL);
            }

            float totalTarge = totalTargetList.Sum();
            float totalPlan  = totalPlanList.Sum();

            foreach (KeyValuePair <string, float> pair in total.Targets)
            {
                dataViewTable.DataTable.Rows.Add(
                    total.SHOP_ID,
                    total.STEP_ID,
                    total.PRODUCT_ID,
                    total.OWNER_TYPE,
                    QtyType.TARGET.ToString(),
                    string.Format("{0:#,##0}", totalTarge),
                    pair.Key,
                    pair.Value
                    );
            }

            foreach (KeyValuePair <string, float> pair in total.Plans)
            {
                dataViewTable.DataTable.Rows.Add(
                    total.SHOP_ID,
                    total.STEP_ID,
                    total.PRODUCT_ID,
                    total.OWNER_TYPE,
                    QtyType.PLAN.ToString(),
                    string.Format("{0:#,##0}", totalPlan),
                    pair.Key,
                    pair.Value
                    );
            }
        }
        private void FillItem(IXLWorksheet worksheet, int rowId, IList <string> columns, CompareItem compareItems, ExcelReportConfigurationDocument config)
        {
            var cell = worksheet.Cell(rowId, config.SkipColumn + 1);

            cell.Value = compareItems.PropertyName;

            if (!compareItems.HasData1)
            {
                FillNewItem(worksheet, rowId, columns, compareItems.Data.ToDictionary(item => item.Key, item => item.Value.Item2), config);
                return;
            }

            if (!compareItems.HasData2)
            {
                FillRemovedItem(worksheet, rowId, columns, compareItems.Data.ToDictionary(item => item.Key, item => item.Value.Item1), config);
                return;
            }

            FillDifferentItem(worksheet, rowId, columns, compareItems.Data, config);
        }
예제 #24
0
        /// <summary>
        /// 날짜 재림차순으로 정렬
        /// </summary>
        public void sortByDate()
        {
            IComparer myCompare = new CompareItem();

            arrList.Sort(myCompare);
        }
예제 #25
0
        private void LoadData_Target(Dictionary <string, CompareItem> results)
        {
            string filter = string.Empty;

            if (this.shopIdComboBox.Text != Consts.ALL)
            {
                filter = string.Format("SHOP_ID = '{0}'", this.shopIdComboBox.Text);
            }

            DataTable stepTargets = _result.LoadOutput(TargetPlanCompareData.DATA_TABLE_2, filter);

            string shopID = this.shopIdComboBox.Text == ComboHelper.ALL ? "" : this.shopIdComboBox.Text.ToUpper();

            var mainStdStepList = GetMainStdStepList(this.TargetAreaID);

            foreach (DataRow row in stepTargets.Rows)
            {
                TargetPlanCompareData.StepTarget st = new TargetPlanCompareData.StepTarget(row);

                if (st.ProductID == "TH645A1AB100" && st.StepID == "9900")
                {
                    Console.WriteLine();
                }

                if (st.StepType != "MAIN")
                {
                    continue;
                }

                if (this.TargetAreaID != st.AreaID)
                {
                    continue;
                }


                if (st.CampareTargetDate < StartTime)
                {
                    continue;
                }

                if (st.CampareTargetDate > EndTime)
                {
                    continue;
                }

                if (this.TargetShopID != "ALL")
                {
                    if (!st.ShopID.ToUpper().Contains(this.TargetShopID))
                    {
                        continue;
                    }
                }

                if (OwnerType != "OwnerP")
                {
                    continue;
                }

                if (Products.Contains(st.ProductID) == false)
                {
                    continue;
                }

                if (IsOnlyMainStep)
                {
                    if (mainStdStepList.Contains(st.StepID) == false)
                    {
                        continue;
                    }
                }

                if (this.TargetStdStep != Consts.ALL && st.StepID != this.TargetStdStep)
                {
                    continue;
                }

                string key = st.ShopID + st.ProductID + st.StepID;

                CompareItem compItem;
                if (_resultDict.TryGetValue(key, out compItem) == false)
                {
                    compItem = new CompareItem(st.ShopID, st.ProductID, st.StepID);
                    results.Add(key, compItem);

                    compItem.SHOP_ID    = st.ShopID;
                    compItem.PRODUCT_ID = st.ProductID;
                    compItem.STEP_ID    = st.StepID;
                    compItem.OWNER_TYPE = "OwnerP";
                }

                compItem.AddQty(st.TargetDate, st.OutTargetQty, QtyType.TARGET);
            }
        }