Пример #1
0
        /// <summary>
        /// 会员储值
        /// </summary>
        /// <param name="branch_id"></param>
        /// <param name="securitycode"></param>
        /// <param name="cardno"></param>
        /// <param name="serial"></param>
        /// <param name="Amount"></param>
        /// <param name="transtype"></param>
        /// <param name="chargetype"></param>
        /// <returns></returns>
        public static TCandaoRet_StoreCardDeposit StoreCardDeposit(string branch_id, string securitycode, string cardno, string serial, decimal Amount, int transtype, int chargetype)
        {
            TCandaoRet_StoreCardDeposit ret = new TCandaoRet_StoreCardDeposit();
            string       address            = String.Format("http://{0}/member/deal/StoreCardDeposit.json", WebServiceReference.Candaomemberserver);
            StringWriter sw     = new StringWriter();
            JsonWriter   writer = new JsonTextWriter(sw);

            writer.WriteStartObject();
            writer.WritePropertyName("SecurityCode");
            writer.WriteValue(securitycode);
            writer.WritePropertyName("Serial");
            writer.WriteValue(serial);
            writer.WritePropertyName("branch_id");
            writer.WriteValue(branch_id);
            writer.WritePropertyName("cardno");
            writer.WriteValue(cardno);
            writer.WritePropertyName("Amount");
            writer.WriteValue(Amount);
            writer.WritePropertyName("TransType");
            writer.WriteValue(transtype.ToString());
            writer.WritePropertyName("ChargeType");
            writer.WriteValue(chargetype.ToString());
            writer.WriteEndObject();
            writer.Flush();
            AllLog.Instance.I(string.Format("【StoreCardDeposit】 reqeust:{0}。", sw));
            String jsonResult = RestClient.Post_Rest(address, sw);

            AllLog.Instance.I(string.Format("【StoreCardDeposit】 result:{0}。", jsonResult));
            JObject ja = null;

            ret.Ret = true;
            try
            {
                ja = (JObject)JsonConvert.DeserializeObject(jsonResult);
            }
            catch { ret.Ret = false; return(ret); }
            ret.Retcode = ja["Retcode"].ToString();
            ret.Ret     = ret.Retcode.Equals("0");
            ret.Retinfo = ja["RetInfo"].ToString();
            if (!ret.Retcode.Equals("0"))
            {
                return(ret);
            }
            ret.Tracecode        = ja["TraceCode"].ToString();
            ret.StoreCardbalance = decimal.Parse(ja["StoreCardBalance"].ToString());
            ret.Giftamount       = decimal.Parse(ja["GiftAmount"].ToString());
            ret.Integral         = 0;// decimal.Parse();//ja["Integral"].ToString()
            return(ret);
        }
Пример #2
0
        private void button27_Click(object sender, EventArgs e)
        {
            if (!checkInput())
            {
                return;
            }
            try
            {
                this.Cursor = Cursors.WaitCursor;
                if (rgpPayType.SelectedIndex < 0)
                {
                    Warning("请选择收款方式!");
                    return;
                }
                if (edtAmount.Text.Trim().Length <= 0)
                {
                    Warning("请输入储值金额!");
                    edtAmount.Focus();
                    edtAmount.SelectAll();
                    edtCurr = edtAmount;
                    return;
                }
                if (float.Parse(edtAmount.Text) <= 0)
                {
                    Warning("请输入正确的金额!");
                    edtAmount.Focus();
                    edtCurr = edtAmount;
                    edtAmount.SelectAll();
                    return;
                }
                if (!AskQuestion("确定储值 " + edtAmount.Text + " 吗?"))
                {
                    return;
                }

                lblAmount.Text = "卡余额:";
                String mmtext = "";
                TCandaoRet_StoreCardDeposit ret = CanDaoMemberClient.StoreCardDeposit(Globals.branch_id, "", _memberInfo.Cardno, Globals.branch_id, decimal.Parse(edtAmount.Text), 0, rgpPayType.SelectedIndex);
                if (!ret.Ret)
                {
                    Warning(ret.Retinfo);
                    return;
                }
                else
                {
                    lblAmount.Text = "卡余额:" + ret.StoreCardbalance.ToString();
                    edtAmount.Text = "";
                    edtAmount.Focus();
                    //打印交易凭条
                    try
                    {
                        TMemberStoredInfo memberstoreinfo = new TMemberStoredInfo();
                        memberstoreinfo.Cardno = _memberInfo.Cardno;
                        memberstoreinfo.Treport_membertitle = WebServiceReference.WebServiceReference.Report_membertitle;
                        memberstoreinfo.Pzh = ret.Tracecode;
                        DateTime date = DateTime.Now;
                        date = DateTime.Now;
                        string datestr = string.Format("{0:yyyy-MM-dd}", date);
                        memberstoreinfo.Date = datestr;
                        datestr = string.Format("{0:hh:mm}", date);
                        memberstoreinfo.Time   = datestr;
                        memberstoreinfo.Store  = ret.StoreCardbalance.ToString();
                        memberstoreinfo.Point  = "0";// ret.Integral.ToString();//ret.Giftamount.ToString();
                        memberstoreinfo.Amount = edtAmount.Text;
                        ReportsFastReport.ReportPrint.PrintMemberStore(memberstoreinfo);
                    }
                    catch { }
                    Warning("储值成功,交易流水号:" + ret.Tracecode);
                    return;
                }
            }
            finally { this.Cursor = Cursors.Default; }
        }