Beispiel #1
0
        public void Create(string hengTittle, string TopTittle, ComSearch comSearch)
        {
            #region 通过ID生成存储表单,并显示

            //模拟生成行标题存储区域
            StackPanel stack1 = new StackPanel();
            //模拟生成列标题存储区域
            StackPanel stack2 = new StackPanel();
            //通过遍历添加行标题
            foreach (var item in TongJiItem.TongJiItemList)
            {
                if (item.Tittle == hengTittle)
                {
                    //生成统计子项
                    TongJiItem tongjiItem = new TongJiItem(item.Tittle, item.StrProperty, false);
                    //一级标题字段
                    tongjiItem.ItemChild = item.ItemChild;
                    //二级标题字段
                    tongjiItem.ItemChild2 = item.ItemChild2;
                    //加载统计子项
                    stack1.Children.Add(tongjiItem);
                    break;
                }
            }

            //通过遍历添加列标题
            foreach (var item in TongJiItem.TongJiItemList)
            {
                if (item.Tittle == TopTittle)
                {
                    //生成统计子项
                    TongJiItem tongjiItem = new TongJiItem(item.Tittle, item.StrProperty, false);
                    //一级标题字段
                    tongjiItem.ItemChild = item.ItemChild;
                    //二级标题字段
                    tongjiItem.ItemChild2 = item.ItemChild2;
                    //加载统计子项
                    stack2.Children.Add(tongjiItem);
                    break;
                }
            }
            //生成存储表单
            TitleInit(scv, stack1, stack2, comSearch);

            #endregion
        }
Beispiel #2
0
        /// <summary>
        /// 处理月份字段
        /// </summary>
        /// <param name="item"></param>
        void MonthDealWidth(TongJiItem item)
        {
            try
            {
                if (_comSearch == null)
                {
                    return;
                }

                ////获取时间控件
                //var startTime = this._comSearch.startEndTime1;
                //获取开始日期
                var starData = this._comSearch.HuanBistartData;
                //获取结束日期
                var endData = this._comSearch.HuanBiEndData;


                //得到相差年份
                var count = (endData.Year - starData.Year) * 12;

                DateTime date = starData;
                //得到相差月份
                count = (endData.Month + 1 - starData.Month) + count;

                item.ItemChild2 = new TongJiItemChild();

                item.ItemChild = new TongJiItemChild();

                item.ItemChild2.ParentPropertyName = "startData,EndData";

                List <string> sumTitleList = new List <string>();
                for (int cou = 0; cou < count; cou++)
                {
                    var realYear  = date.AddMonths(cou).ToString("yyyy年");
                    var realMonth = date.AddMonths(cou).ToString("MM月");

                    sumTitleList.Add(realYear);
                    item.ItemChild2.PropertyList.Add(realMonth);
                }

                item.ItemChild.PropertyList.AddRange(_DeleteSameProperty(sumTitleList));

                foreach (var chid in item.ItemChild.PropertyList)
                {
                    item.ItemChild2.DicPropertyCaml.Add(chid, new List <string>());
                    for (int cou = 0; cou < count; cou++)
                    {
                        var realYear  = date.AddMonths(cou).ToString("yyyy年");
                        var realMonth = date.AddMonths(cou).ToString("MM月");

                        if (chid.Equals(realYear))
                        {
                            item.ItemChild2.DicPropertyCaml[chid].Add(realMonth);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MethodLb.CreateLog(this.GetType().FullName, "MonthDealWidth", ex.ToString(), item);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 元素点击弹回时
        /// </summary>
        void element_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (sender is TongJiItem)
                {
                    TongJiItem item = sender as TongJiItem;

                    isDrag = false;

                    #region 拖动完毕时发生变化

                    item.Cursor = Cursors.Arrow;
                    GetRootParent(item, 4).SetValue(Canvas.ZIndexProperty, 0);
                    item.SetValue(Canvas.ZIndexProperty, 0);

                    if (item.StrStyle == "borStyle1")
                    {
                        //拖到行区域
                        if (item.Margin.Left > gridLayouRoot.ColumnDefinitions[0].ActualWidth + gridLayouRoot.ColumnDefinitions[2].ActualWidth)
                        {
                            if (DragLeftToRightComplete != null)
                            {
                                DragLeftToRightComplete(this, item);
                            }
                        }
                        //拖到列区域
                        else if (item.Margin.Left > gridLayouRoot.ColumnDefinitions[0].ActualWidth)
                        {
                            DragLeftToCenterComplete(this, item);
                        }
                        else
                        {
                            item.Margin = new Thickness(0);
                        }
                    }
                    else if (item.StrStyle == "borStyle2")
                    {
                        //还原
                        if (item.Margin.Right > gridLayouRoot.ColumnDefinitions[2].ActualWidth)
                        {
                            if (DragCenterToLeftComplete != null)
                            {
                                DragCenterToLeftComplete(this, item);
                            }
                        }
                        else if (item.Margin.Left > gridLayouRoot.ColumnDefinitions[2].ActualWidth)
                        {
                            if (DragCenterToRightComplete != null)
                            {
                                DragCenterToRightComplete(this, item);
                            }
                        }
                        else
                        {
                            item.Margin = new Thickness(0);
                        }
                    }
                    else
                    {
                        //还原
                        if (item.Margin.Right > gridLayouRoot.ColumnDefinitions[3].ActualWidth + gridLayouRoot.ColumnDefinitions[4].ActualWidth + gridLayouRoot.ColumnDefinitions[5].ActualWidth)
                        {
                            if (DragRightToLeftComplete != null)
                            {
                                DragRightToLeftComplete(this, item);
                            }
                        }
                        else if (item.Margin.Right > gridLayouRoot.ColumnDefinitions[4].ActualWidth + gridLayouRoot.ColumnDefinitions[5].ActualWidth)
                        {
                            if (DragRightToCenterComplete != null)
                            {
                                DragRightToCenterComplete(this, item);
                            }
                        }
                        else
                        {
                            item.Margin = new Thickness(0);
                        }
                    }

                    #endregion

                    //释放焦点
                    item.ReleaseMouseCapture();

                    item.Margin = new Thickness(0);
                }
            }
            catch (Exception ex)
            {
                MethodLb.CreateLog(this.GetType().FullName, "element_MouseLeftButtonUp", ex.ToString(), sender, e);
            }
        }