コード例 #1
0
        public CouponBindLogPagedSearchRD BindCouponLog(CouponBindLogPagedSearchRP couponBindLogPagedSearchRP)
        {
            CouponBindLogPagedSearchRD couponBindLogPagedSearchRD = new CouponBindLogPagedSearchRD();

            DataSet dataSet = this._currentDAO.BindCouponLog(couponBindLogPagedSearchRP.CouponTypeID, couponBindLogPagedSearchRP.CouponName, couponBindLogPagedSearchRP.CouponCode, couponBindLogPagedSearchRP.VipCriteria, couponBindLogPagedSearchRP.BindingBeginTime, couponBindLogPagedSearchRP.BindingEndTime, couponBindLogPagedSearchRP.Operator, couponBindLogPagedSearchRP.PageIndex, couponBindLogPagedSearchRP.PageSize);

            if (Utils.IsDataSetValid(dataSet))
            {
                var list = DataTableToObject.ConvertToList <BindCouponEntity>(dataSet.Tables[0]);
                couponBindLogPagedSearchRD.CouponList = list.ToArray();

                couponBindLogPagedSearchRD.TotalPage  = int.Parse(dataSet.Tables[1].Rows[0][0].ToString());
                couponBindLogPagedSearchRD.TotalCount = int.Parse(dataSet.Tables[1].Rows[0][1].ToString());
            }

            if (couponBindLogPagedSearchRD.CouponList != null)
            {
                foreach (BindCouponEntity item in couponBindLogPagedSearchRD.CouponList)
                {
                    item.CreateTime = item.CreateTime != "" ? Convert.ToDateTime(item.CreateTime).ToLongDateString().ToString() : "";
                }
            }

            return(couponBindLogPagedSearchRD);
        }
コード例 #2
0
        public DataTable GetExportBindData(CouponBindLogPagedSearchRP couponBindLogPagedSearchRP)
        {
            DataSet dataSet   = new DataSet();
            string  pageSize  = "999999999"; //int.Parse(manageCouponSearchRP.PageSize)
            string  pageIndex = "0";         //int.Parse(manageCouponSearchRP.PageIndex)

            dataSet = this._currentDAO.BindCouponLog(couponBindLogPagedSearchRP.CouponTypeID, couponBindLogPagedSearchRP.CouponName, couponBindLogPagedSearchRP.CouponCode, couponBindLogPagedSearchRP.VipCriteria, couponBindLogPagedSearchRP.BindingBeginTime, couponBindLogPagedSearchRP.BindingEndTime, couponBindLogPagedSearchRP.Operator, pageIndex, pageSize);

            DataTable dataTable = dataSet.Tables[0];

            //删除不需要的列
            dataTable.Columns.Remove("VipCouponMapping");
            dataTable.Columns.Remove("VIPID");
            dataTable.Columns.Remove("CouponID");
            dataTable.Columns.Remove("UrlInfo");
            dataTable.Columns.Remove("IsDelete");
            dataTable.Columns.Remove("LastUpdateBy");
            dataTable.Columns.Remove("LastUpdateTime");
            dataTable.Columns.Remove("CreateBy");

            //给列命名
            dataTable.Columns["RowNo"].ColumnName          = "序号";
            dataTable.Columns["CouponCode"].ColumnName     = "优惠券号";
            dataTable.Columns["CouponName"].ColumnName     = "优惠券名称";
            dataTable.Columns["Operator"].ColumnName       = "操作人";
            dataTable.Columns["VipName"].ColumnName        = "会员名";
            dataTable.Columns["CreateTime"].ColumnName     = "分发日期";
            dataTable.Columns["CouponTypeName"].ColumnName = "优惠券类型";

            if (dataSet != null)
            {
                return(dataTable);
            }
            else
            {
                return(null);
            }
        }