Example #1
0
        /// <summary>
        /// 绑定数据报表。并为其增加【小计】【总计】行。
        /// </summary>
        /// <typeparam name="T">报表记录对象的类型</typeparam>
        /// <param name="dgw">要绑定的DataGridView</param>
        /// <param name="list">数据行对象列表。执行完成后,将在该列表的最后添加一个【小计】对象。</param>
        /// <param name="statColumns">需要进行统计的列</param>
        /// <param name="totalRow">在有分页的情况下,【总计】的行对象</param>
        /// <param name="abs4Column">对目标列进行统计时,是否取其绝对值进行统计</param>
        /// <param name="isDisplayCol">是否显示列</param>
        /// <param name="DistinguishSize">区分是否是尺码列</param>
        public static void BindSource4Reports <T>(DataGridViewPagingSumCtrl ctrl, DataGridView dgw, IList <T> orgList, string[] statColumns, T totalRow, bool[] abs4Column, bool isPaging, bool isDisplayCol = true, bool DistinguishSize = true) where T : class, new()
        {
            ctrl.ClearSummary();
            ctrl.abs4Column = abs4Column;
            if (orgList == null || orgList.Count == 0)
            {
                orgList = null;
                ctrl.SetDataSource(orgList, isDisplayCol, DistinguishSize);
                return;
            }
            if (statColumns == null || statColumns.Length == 0)
            {
                ctrl.SetDataSource(orgList, isDisplayCol, DistinguishSize);
                return;
            }

            // List<T> list = new List<T>();
            List <T> calList = new List <T>();

            //  list.AddRange(orgList);
            Type type = typeof(T);

            foreach (string column in statColumns)
            {
                PropertyInfo pro = type.GetProperty(column);
                if (pro == null)
                {
                    throw new Exception(string.Format("Class [{0}] does not contain property [{1}] .", CJBasic.Helpers.TypeHelper.GetClassSimpleName(type), column));
                }

                if (!pro.CanRead || !pro.CanWrite)
                {
                    throw new Exception(string.Format("Property [{0}] of class [{1}] must be readable and writable.", column, CJBasic.Helpers.TypeHelper.GetClassSimpleName(type)));
                }
            }

            if (isPaging)
            {
                AddSumRow1(dgw, orgList, calList, statColumns, abs4Column);
            }
            if (totalRow != null)
            {
                IStatisticabled obj = totalRow as IStatisticabled;
                if (obj != null)
                {
                    obj.IsStatistics = true;
                }
                calList.Add(totalRow);
            }

            if (dgw.RowHeadersWidth < 70)
            {
                dgw.RowHeadersWidth = 70;
            }

            ctrl.SetDataSource(orgList, isDisplayCol, DistinguishSize);
            ctrl.ShowSummary(dgw, calList, statColumns);
        }
        private void Initialize()
        {
            List <ListItem <int> > stateList = new List <ListItem <int> >();

            this.pagePara1 = new GetShopBenefitReportsPara();
            dataGridViewPagingSumCtrl.SetDataSource <DayBenefitReportDetail>(null);
            dataGridViewPagingSumCtrl1.SetDataSource <RechargeRecord>(null);
        }
Example #3
0
        private void CostumeManageCtrl_Load(object sender, EventArgs e)
        {
            try
            {
                dataGridViewPagingSumCtrl.SetDataSource <SalesAnalysis>(null);
                pagePara = new GetPfRetailAnalysisPara();
                // this.skinComboBoxShopID.Initialize(false, CommonGlobalCache.IsGeneralStoreRetail != "1", CommonGlobalCache.BusinessAccount.OnlineEnabled);

                pfCustomerComboBox1.Initialize(false, true, -1);
                if (TypeValue1.HeaderText == "TypeValue1")
                {
                    TypeValue1.HeaderText   = "客户";
                    this.TypeValue1.Visible = false;
                }

                if (TypeValue2.HeaderText == "TypeValue2")
                {
                    TypeValue2.HeaderText   = "品牌";
                    this.TypeValue2.Visible = false;
                }
                if (TypeValue3.HeaderText == "TypeValue3")
                {
                    TypeValue3.HeaderText   = "供应商";
                    this.TypeValue3.Visible = false;
                }
                if (TypeValue4.HeaderText == "TypeValue4")
                {
                    TypeValue4.HeaderText   = "品牌";
                    this.TypeValue4.Visible = false;
                }
                if (TypeValue5.HeaderText == "TypeValue5")
                {
                    TypeValue5.HeaderText   = "大类";
                    this.TypeValue5.Visible = false;
                }
                if (TypeValue6.HeaderText == "TypeValue6")
                {
                    TypeValue6.HeaderText   = "小类";
                    this.TypeValue6.Visible = false;
                }
                if (TypeValue7.HeaderText == "TypeValue7")
                {
                    TypeValue7.HeaderText   = "款号";
                    this.TypeValue7.Visible = false;
                }
                if (TypeValue8.HeaderText == "TypeValue8")
                {
                    TypeValue8.HeaderText   = "商品名称";
                    this.TypeValue8.Visible = false;
                }

                if (!HasPermission(RolePermissionEnum.查看_毛利))
                {
                    dataGridViewPagingSumCtrl.AppendNotShowInColumnSettings(retailBenefitRateDataGridViewTextBoxColumn);
                }
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
        }