Ejemplo n.º 1
0
        public CouponManagePagedSearchRD ManageCouponPagedSearch(CouponManagePagedSearchRP manageCouponSearchRP)
        {
            CouponManagePagedSearchRD rd = new CouponManagePagedSearchRD();
            DataSet dataSet = new DataSet();

            dataSet = _currentDAO.ManageCouponPagedSearch(manageCouponSearchRP.CouponTypeID, manageCouponSearchRP.CouponName, manageCouponSearchRP.CouponUseStatus, manageCouponSearchRP.CouponStatus, manageCouponSearchRP.BeginTime, manageCouponSearchRP.EndTime, manageCouponSearchRP.CouponCode, manageCouponSearchRP.Comment, manageCouponSearchRP.UseTime, manageCouponSearchRP.CreateByName, manageCouponSearchRP.UseEndTime, int.Parse(manageCouponSearchRP.PageIndex), int.Parse(manageCouponSearchRP.PageSize));
            if (dataSet.Tables.Count == 2)
            {
                var couponList = (from d in dataSet.Tables[0].AsEnumerable()
                                  select new CouponManageEntity
                {
                    CouponID = d["CouponID"].ToString(),
                    CouponTypeName = d["CouponTypeName"].ToString(),
                    CouponName = d["CouponName"].ToString(),
                    CouponCode = d["CouponCode"].ToString(),
                    CouponUseStatus = d["CouponUseStatus"].ToString(),
                    BeginTime = d["BeginDate"].ToString() != "" ? Convert.ToDateTime(d["BeginDate"].ToString()).ToLongDateString().ToString() : "",
                    EndTime = d["EndDate"].ToString() != "" ? Convert.ToDateTime(d["EndDate"].ToString()).ToLongDateString().ToString() : "",
                    CouponStatus = d["Status"].ToString(),
                    IsDelete = d["IsDelete"].ToString(),
                    CreateByName = d["CreateByName"].ToString(),
                    Comment = d["Comment"].ToString(),
                    UseTime = d["UseTime"].ToString() != "" ? Convert.ToDateTime(d["UseTime"].ToString()).ToLongDateString().ToString() : ""
                });

                rd.CouponList = couponList.ToArray();
                rd.TotalPage  = int.Parse(dataSet.Tables[1].Rows[0][0].ToString());
                rd.TotalCount = int.Parse(dataSet.Tables[1].Rows[0][1].ToString());
            }

            return(rd);
        }
Ejemplo n.º 2
0
        public CouponManagePagedSearchRD GetCouponList(GetCouponListRP getCouponListRP)
        {
            CouponManagePagedSearchRD rd = new CouponManagePagedSearchRD();

            DataSet dataSet = new DataSet();

            dataSet = this.GetCouponList(getCouponListRP.VipID, "");
            if (Utils.IsDataSetValid(dataSet))
            {
                var couponList = (from d in dataSet.Tables[0].AsEnumerable()
                                  where d["Status"].ToString() == "0"
                                  select new CouponManageEntity
                {
                    CouponID = d["CouponID"].ToString(),
                    CouponTypeName = d["CouponTypeName"].ToString(),
                    CouponName = d["CouponName"].ToString(),
                    CouponCode = d["CouponCode"].ToString(),
                    BeginTime = d["BeginDate"].ToString() != "" ? Convert.ToDateTime(d["BeginDate"].ToString()).ToLongDateString().ToString() : "",
                    EndTime = d["EndDate"].ToString() != "" ? Convert.ToDateTime(d["EndDate"].ToString()).ToLongDateString().ToString() : ""
                });

                rd.CouponList = couponList.ToArray();
            }
            return(rd);
        }
Ejemplo n.º 3
0
        public DataTable GetExportData(CouponManagePagedSearchRP manageCouponSearchRP)
        {
            CouponManagePagedSearchRD rd = new CouponManagePagedSearchRD();
            DataSet dataSet   = new DataSet();
            int     pageSize  = 999999999; //int.Parse(manageCouponSearchRP.PageSize)
            int     pageIndex = 0;         //int.Parse(manageCouponSearchRP.PageIndex)

            dataSet = _currentDAO.ManageCouponPagedSearch(manageCouponSearchRP.CouponTypeID, manageCouponSearchRP.CouponName, manageCouponSearchRP.CouponUseStatus, manageCouponSearchRP.CouponStatus, manageCouponSearchRP.BeginTime, manageCouponSearchRP.EndTime, manageCouponSearchRP.CouponCode, manageCouponSearchRP.Comment, manageCouponSearchRP.UseTime, manageCouponSearchRP.CreateByName, manageCouponSearchRP.UseEndTime, pageIndex, pageSize);

            DataTable dataTable = dataSet.Tables[0];

            //删除不需要的列
            dataTable.Columns.Remove("CouponID");
            dataTable.Columns.Remove("CouponDesc");
            dataTable.Columns.Remove("CouponTypeID");
            dataTable.Columns.Remove("BeginDate");
            dataTable.Columns.Remove("EndDate");
            dataTable.Columns.Remove("CouponUrl");
            dataTable.Columns.Remove("ImageUrl");
            dataTable.Columns.Remove("Status");

            dataTable.Columns.Remove("CreateTime");
            dataTable.Columns.Remove("CreateBy");
            dataTable.Columns.Remove("LastUpdateTime");
            dataTable.Columns.Remove("LastUpdateBy");
            dataTable.Columns.Remove("IsDelete");
            dataTable.Columns.Remove("CouponPwd");
            dataTable.Columns.Remove("CollarCardMode");
            dataTable.Columns.Remove("CustomerID");

            dataTable.Columns.Remove("IsDel");
            dataTable.Columns.Remove("CouponUseStatus");
            dataTable.Columns.Remove("CoupnName");
            dataTable.Columns.Remove("DoorID");

            for (int i = 1; i <= 50; i++)
            {
                dataTable.Columns.Remove("Col" + i);
            }

            dataTable.Columns["RowNo"].ColumnName          = "序号";
            dataTable.Columns["CouponCode"].ColumnName     = "优惠券号";
            dataTable.Columns["CouponName"].ColumnName     = "优惠券名称";
            dataTable.Columns["CreateByName"].ColumnName   = "核销人";
            dataTable.Columns["Comment"].ColumnName        = "组单号";
            dataTable.Columns["UseTime"].ColumnName        = "核销日期";
            dataTable.Columns["CouponTypeName"].ColumnName = "优惠券类型";

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