예제 #1
0
파일: Voucher.cs 프로젝트: windygu/flamingo
        /// <summary>
        /// 获得代用券信息
        /// </summary>
        /// <param name="voucherbatchid"></param>
        /// <returns></returns>
        public static Flamingo.Entity.Para_Voucher GetVoucherSubstitute(string voucherbatchid)
        {
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@_VoucherBatchId", MySqlDbType.VarChar, 10)
            };
            parameters[0].Value = voucherbatchid;
            DataTable dt = DbHelperMySQL.RunProcedure("proc_voucherbatch_getByVoucherBatchId", parameters, "getByVoucherBatchId").Tables[0];

            Flamingo.Entity.Para_Voucher model = new Entity.Para_Voucher();

            if (dt.Rows.Count > 0)
            {
                model.VoucherBatchId   = dt.Rows[0]["VoucherBatchId"].ToString();
                model.VoucherName      = dt.Rows[0]["VoucherName"].ToString();
                model.VoucherTypeId    = Int32.Parse(dt.Rows[0]["VoucherTypeId"].ToString());
                model.VoucherType      = dt.Rows[0]["VoucherTypeName"].ToString();
                model.BeginDate        = DateTime.Parse(dt.Rows[0]["ReleaseDate"].ToString());
                model.EndDate          = DateTime.Parse(dt.Rows[0]["ExpireDate"].ToString());
                model.Price            = float.Parse(dt.Rows[0]["UnitPrice"].ToString());
                model.SerialScope      = dt.Rows[0]["SerialScope"].ToString();
                model.VoucherPrice     = float.Parse(dt.Rows[0]["VoucherPrice"].ToString());
                model.VoucherSubTypeId = Int32.Parse(dt.Rows[0]["VoucherSubTypeId"].ToString());
                model.VoucherSubType   = dt.Rows[0]["VoucherSubTypeName"].ToString();
                model.AllowUse         = true;
                model.ErrorMsg         = string.Empty;
            }
            return(model);
        }
예제 #2
0
파일: Voucher.cs 프로젝트: windygu/flamingo
        /// <summary>
        /// 获得票券信息(优惠券/兑换券)
        /// </summary>
        /// <param name="voucherid">票券ID(编号)</param>
        /// <returns></returns>
        public static Flamingo.Entity.Para_Voucher GetVoucher(string voucherid)
        {
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@_VoucherId", MySqlDbType.VarChar, 16),
                new MySqlParameter("@_HasUsed",   MySqlDbType.Bit)
            };
            parameters[0].Value     = voucherid;
            parameters[1].Direction = ParameterDirection.Output;
            DataTable dt = DbHelperMySQL.RunProcedure("proc_voucherbatch_getByVoucherId", parameters, "getByVoucherId").Tables[0];
            bool      tf = parameters[1].Value.ToString().Trim() == "1" ? true : false;

            Flamingo.Entity.Para_Voucher model = new Entity.Para_Voucher();

            if (dt.Rows.Count > 0)
            {
                model.VoucherBatchId   = dt.Rows[0]["VoucherBatchId"].ToString();
                model.VoucherId        = voucherid;
                model.VoucherName      = dt.Rows[0]["VoucherName"].ToString();
                model.VoucherTypeId    = Int32.Parse(dt.Rows[0]["VoucherTypeId"].ToString());
                model.VoucherType      = dt.Rows[0]["VoucherTypeName"].ToString();
                model.BeginDate        = DateTime.Parse(dt.Rows[0]["ReleaseDate"].ToString());
                model.EndDate          = DateTime.Parse(dt.Rows[0]["ExpireDate"].ToString());
                model.Price            = float.Parse(dt.Rows[0]["UnitPrice"].ToString());
                model.SerialScope      = dt.Rows[0]["SerialScope"].ToString();
                model.TemplateId       = 0;// Int32.Parse(dt.Rows[0]["TemplateId"].ToString());
                model.VoucherPrice     = float.Parse(dt.Rows[0]["VoucherPrice"].ToString());
                model.VoucherSubTypeId = Int32.Parse(dt.Rows[0]["VoucherSubTypeId"].ToString());
                model.VoucherSubType   = dt.Rows[0]["VoucherSubTypeName"].ToString();
                model.AllowUse         = true;
                model.ErrorMsg         = string.Empty;
                if (tf == true)
                {
                    model.AllowUse = false;
                    model.ErrorMsg = "票券已被使用";
                }
            }
            return(model);
        }