Ejemplo n.º 1
0
        public List <GiftVoucher> Search()
        {
            List <GiftVoucher> VoucherList = new List <GiftVoucher>();

            //System.Data.DataTable dTable = new DataTable();
            System.Data.DataSet dSet = new DataSet();
            try
            {
                string errorMessage = string.Empty;
                // dTable = GetSelectedRecords(Common.ToXml(this), SP_GIFTVOUCHER_SEARCH, ref errorMessage);
                dSet = GetSelectedRecordsDataSet(Common.ToXml(this), SP_GIFTVOUCHER_SEARCH, ref errorMessage);
                if (dSet != null && dSet.Tables.Count > 0)
                {
                    foreach (System.Data.DataRow drow in dSet.Tables[0].Rows)
                    {
                        GiftVoucher _voucher = CreateVoucherObject(drow);
                        if (dSet.Tables[1] != null)
                        {
                            _voucher.GetVoucherItemDetailList(dSet.Tables[1]);
                        }
                        if (dSet.Tables[2] != null)
                        {
                            _voucher.GetVoucherDetailList(dSet.Tables[2]);
                        }
                        VoucherList.Add(_voucher);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(VoucherList);
        }
Ejemplo n.º 2
0
 private GiftVoucher CreateVoucherObject(DataRow dr)
 {
     try
     {
         GiftVoucher voucher = new GiftVoucher();
         voucher.CreatedBy   = Convert.ToInt32(dr[CON_FIELD_CREATEDBY]);
         voucher.CreatedDate = Convert.ToString(dr[CON_FIELD_CREATEDDATE]);
         //voucher.ItemCode = Convert.ToString(dr[CON_FIELD_ITEMCODE]);
         //voucher.ItemDescription = Convert.ToString(dr[CON_FIELD_ITEMDESC]);
         //voucher.ItemID = Convert.ToInt32(dr[CON_FIELD_ITEMID]);
         voucher.MinBuyAmount       = Convert.ToDecimal(dr[CON_FIELD_MINBUYAMOUNT]);
         voucher.VoucherCode        = Convert.ToString(dr[CON_FIELD_VOUCHERCODE]);
         voucher.VoucherDescription = Convert.ToString(dr[CON_FIELD_VOUCHERDESCRIPTION]);
         voucher.VoucherName        = Convert.ToString(dr[CON_FIELD_VOUCHERNAME]);
         voucher.ModifiedBy         = Convert.ToInt32(dr[CON_FIELD_MODIFYBY]);
         voucher.ModifiedDate       = Convert.ToDateTime(dr[CON_FIELD_MODIFYDATE]);
         return(voucher);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }