public ActionResult CreateGasCard(Admin_Create_GasCard CGasCard) { if (ModelState.IsValid) { try { var statusId = transportationContext.GasCardStatuses.Where(Gs => Gs.StatusName == CGasCard.StatusName).Select(i => i.StatusId).FirstOrDefault(); if (statusId != 0) { //instantiate object GasCard gasCard = new GasCard(); //set gasCard.GasCardName = CGasCard.GasCardName; gasCard.GasCardNum = CGasCard.GasCardNum; gasCard.GasCardPin = CGasCard.GasCardPin; gasCard.StatusId = statusId; //add transportationContext.GasCards.Add(gasCard); //save transportationContext.SaveChanges(); return(RedirectToAction("Index")); } return(new HttpStatusCodeResult(Response.StatusCode = 400)); } catch { return(new HttpStatusCodeResult(Response.StatusCode = 400)); } } return(View()); }
private void load() { try { SysBLL.Player("燃气卡写入.wav"); card = Payment.GasPayParam.GasCard; icParams = Payment.GasPayParam.IcParams; if (card.cardType == 1) { //金卡 img1.Source = jinImage; } else { //先锋卡 img1.Source = xianfengImage; } payThread = new Thread(delegate() { pay(); }); payThread.Start(); } catch (Exception ex) { log.Write("error:FormGasGoldenCardStep07:load():" + ex.Message); exit("充值失败,请稍后再试..."); } }
/// <summary> /// 读先锋卡 /// </summary> /// <param name="cardNo"></param> /// <returns></returns> public Card getCardInfo(string cardNo) { if (SysBLL.isGasCRT) { CJ201.Open_Com(2, 9600, 8, 0, 0); } else { CJ201.Close_Com(CJ201.handle); } try { iccardClass ic = new lzocx2Lib.iccardClass(); ic.port = (short)port; int ret = ic.read_card_lz1(); if (ret == 0) { Thread.Sleep(1000); GasCard card = new GasCard(); card.CardNo = ic.userid; card.GasValue = ic.gasnum; return(card); } throw new Exception(); } catch (Exception ex) { throw new WtException(WtExceptionCode.Card.GAS_READ_CARD, ex.Message); } }
/// <summary> /// 读金卡 /// </summary> /// <param name="cardNo"></param> /// <returns></returns> public Card getCardInfo(string cardNo) { try { CJ201.Close_Com(CJ201.handle); StringBuilder vskh = new StringBuilder(260); int vlql = 0; int vlzyql = 0; StringBuilder lpInfo = new StringBuilder(260); string port = SysConfigHelper.readerNode("CJ201"); CJ201.handle = CJ201.Open_Com(Int32.Parse(port), 9600, 8, 0, 0); int ret = CJ201.GoldCard_Read_zz(CJ201.handle, vskh, ref vlql, ref vlzyql, lpInfo); //关闭端口 CJ201.Close_Com(CJ201.handle); if (vskh.Length > 2) { GasCard card = new GasCard(); card.CardNo = vskh.ToString(); card.GasValue = vlql; card.Total = vlzyql; return(card); } throw new Exception(); } catch (Exception ex) { throw new WtException(WtExceptionCode.Card.GAS_READ_CARD, ex.Message); } finally { CJ201.Close_Com(CJ201.handle); } }
private void read() { try { isRead = false; PrintInfo("读取中,请稍后..."); SysBLL.Player("读取中.wav"); XianfengBLL xfCard = new XianfengBLL(); GasCard card = (GasCard)(xfCard.getCardInfo(null)); string cardNo = card.CardNo; card.cardType = 2; Payment.GasPayParam.GasCard = card; GasInterface gasInterface = new GasInterface(); SysBLL.Authcode = gasInterface.GasLogin(); //执行下一步 //new FormJump().openForm(senderLoad, eLoad, this, new FormGasGoldenCardStep3(card)); ConfigSysParam.gifBusiness = GifBusiness.gas_IC; Util.JumpUtil.jumpCommonPage("FormGasGoldenCardStep03"); return; } catch (ThreadAbortException ae) { } catch (WtException e) { PrintInfo("读取失败,请重试..."); } catch (Exception e) { String msg = WtException.formatMsg(WtExceptionCode.Card.UNION_READ_CARD, e.Message); PrintInfo("读取失败,请重试..."); } finally { isRead = true; } }
private string isCardTypeRq(GasCard card) { //金卡卡内充值 if (card.cardType == 1) { return("RQ005"); } //先锋卡内充值 else if (card.cardType == 2) { return("RQ005"); } else { return(""); } }
public ActionResult EditGasCard(GasCard gasCard) { try { if (ModelState.IsValid) { transportationContext.Entry(gasCard).State = System.Data.Entity.EntityState.Modified; transportationContext.SaveChanges(); return(RedirectToAction("Index", "Admin")); } return(View(gasCard)); } catch { return(View()); } }
private void read() { try { isRead = false; PrintInfo("读取中,请稍后..."); SysBLL.Player("读取中.wav"); GasCard card = (GasCard)(jinCard.getCardInfo(null)); string cardNo = card.CardNo; card.cardType = 1; Payment.GasPayParam.GasCard = card; GasInterface gasInterface = new GasInterface(); SysBLL.Authcode = gasInterface.GasLogin(); //int rechageNum = 10; //if (!jinCard.Recharge(card.CardNo, rechageNum)) //{ // throw new Exception(); //} //执行下一步 //new FormJump().openForm(senderLoad, eLoad, this, new FormGasGoldenCardStep3(card)); ConfigSysParam.gifBusiness = GifBusiness.gas_IC; Util.JumpUtil.jumpCommonPage("FormGasGoldenCardStep03"); return; } catch (ThreadAbortException ae) { log.Write("error:金卡读卡异常:" + ae.Message); } catch (WtException e) { PrintInfo("读取失败,请重试..."); } catch (Exception e) { PrintInfo("读取失败,请重试..."); } finally { isRead = true; } }