// Token: 0x0600041B RID: 1051 RVA: 0x0003C1CC File Offset: 0x0003A3CC private void displayFields(ConsumeCardEntity cce) { if (cce == null) { this.nameTB.Text = ""; this.userIdTB.Text = ""; this.phoneNumTB.Text = ""; this.permanentUserIdTB.Text = ""; this.identityCardNumTB.Text = ""; this.addressTB.Text = ""; this.userAreaNumTB.Text = ""; this.usrePersonsTB.Text = ""; this.surplusNumTB.Text = ""; return; } string value = string.Concat(cce.UserId); this.db.AddParameter("userId", value); DataRow dataRow = this.db.ExecuteRow("SELECT * FROM usersTable WHERE userId=@userId"); if (dataRow != null) { this.nameTB.Text = dataRow["username"].ToString(); this.phoneNumTB.Text = dataRow["phoneNum"].ToString(); this.identityCardNumTB.Text = dataRow["identityId"].ToString(); this.addressTB.Text = dataRow["address"].ToString(); this.userAreaNumTB.Text = dataRow["userArea"].ToString(); this.usrePersonsTB.Text = dataRow["userPersons"].ToString(); this.userIdTB.Text = dataRow["userId"].ToString(); this.permanentUserIdTB.Text = dataRow["permanentUserId"].ToString(); this.surplusNumTB.Text = cce.TotalRechargeNumber.ToString(); return; } this.displayFields(null); }
// Token: 0x06000393 RID: 915 RVA: 0x0002961C File Offset: 0x0002781C private ConsumeCardEntity parseCard(bool beep) { if (this.parentForm != null) { uint[] array = this.parentForm.readCard(beep); if (array != null && this.parentForm.getCardType(array[0]) == 1U) { if (this.parentForm.getCardAreaId(array[0]).CompareTo(ConvertUtils.ToUInt32(this.parentForm.getSettings()[0])) != 0) { WMMessageBox.Show(this, "区域ID不匹配!"); return(null); } ConsumeCardEntity consumeCardEntity = new ConsumeCardEntity(); consumeCardEntity.parseEntity(array); this.db.AddParameter("userId", ConvertUtils.ToInt64(consumeCardEntity.UserId).ToString()); DataRow dataRow = this.db.ExecuteRow("SELECT * FROM cardData WHERE userId=@userId"); if (dataRow != null && (ulong)this.parentForm.getCardID() != (ulong)(Convert.ToInt64(dataRow[2]))) { WMMessageBox.Show(this, "此卡为挂失卡或者其他用户卡!"); return(null); } return(consumeCardEntity); } else if (array != null) { WMMessageBox.Show(this, "此卡为其他卡片类型!"); } } return(null); }
private ConsumeCardEntity parseCard(bool beep) { uint[] array = readCard(beep); this.arrayReadCard = array; if (array != null && getCardType(array[0]) == 1U) { if (getCardAreaId(array[0]).CompareTo(ConvertUtils.ToUInt32(this.areaId, 10)) != 0) { WMMessageBox.Show(this, "区域ID不匹配!"); this.ReaderOk = false; return(null); } ConsumeCardEntity consumeCardEntity = new ConsumeCardEntity(); consumeCardEntity.parseEntity(array); DbUtil dbUtil = new DbUtil(); dbUtil.AddParameter("userId", ConvertUtils.ToInt64(consumeCardEntity.UserId).ToString()); DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM cardData WHERE userId=@userId"); this.cardData = dataRow; if (dataRow != null && (ulong)getCardID() != (ulong)(Convert.ToInt64(dataRow[2]))) { WMMessageBox.Show(this, "此卡为挂失卡或者其他用户卡!"); this.ReaderOk = false; return(null); } return(consumeCardEntity); } else if (array != null) { WMMessageBox.Show(this, "此卡为其他卡片类型!"); this.ReaderOk = false; } return(null); }
// Token: 0x0600041D RID: 1053 RVA: 0x0003C4B4 File Offset: 0x0003A6B4 private void enterBtn_Click(object sender, EventArgs e) { this.enterBtn.Enabled = false; if (this.cce == null) { WMMessageBox.Show(this, "请先读取用户卡!"); return; } if (this.parentForm != null) { ConsumeCardEntity consumeCardEntity = this.parseCard(false); if (consumeCardEntity != null) { if (this.cce.UserId != consumeCardEntity.UserId) { WMMessageBox.Show(this, "与读取的卡片内容不符,请检查是否更换了卡片!"); return; } consumeCardEntity.DeviceHead.ChangeMeterFlag = 1U; consumeCardEntity.DeviceHead.DeviceIdFlag = 1U; consumeCardEntity.DeviceHead.ConsumeFlag = 0U; this.parentForm.writeCard(consumeCardEntity.getEntity()); WMMessageBox.Show(this, "重置成功!"); } } }
// Token: 0x060003A1 RID: 929 RVA: 0x0002B634 File Offset: 0x00029834 private void refundManualReadCardBtn_Click(object sender, EventArgs e) { if (this.parentForm != null) { ConsumeCardEntity consumeCardEntity = this.parseCard(false, 1U); if (consumeCardEntity != null) { this.initUserInfoDGV("userId", consumeCardEntity.UserId.ToString()); } } }
// Token: 0x0600044D RID: 1101 RVA: 0x00040EEC File Offset: 0x0003F0EC private void readCardBtn_Click(object sender, EventArgs e) { if (this.parentForm != null) { ConsumeCardEntity consumeCardEntity = this.parseCard(true); if (consumeCardEntity != null) { this.fillAllWidget(string.Concat(consumeCardEntity.UserId)); } } }
private bool checkOtherStatus(ConsumeCardEntity cce) { if (cce != null && cce.DeviceHead.BatteryStatus == 1U) { WMMessageBox.Show(this, "注意 : 表电池电量低!"); return(true); } if (cce != null && cce.DeviceHead.ValveStatus == 1U) { WMMessageBox.Show(this, "注意 : 阀门坏!"); return(true); } return(true); }
private void label4_Click_1(object sender, EventArgs e) { this.ReaderOk = true; ConsumeCardEntity consumeCardEntity = this.parseCard(true); if (consumeCardEntity != null) { if (!this.checkOtherStatus(consumeCardEntity)) { return; } DbUtil db = new DbUtil(); db.AddParameter("userId", string.Concat(consumeCardEntity.UserId)); DataRow dataRow = db.ExecuteRow("SELECT * FROM metersTable WHERE meterId=@userId"); this.meters = dataRow; if (dataRow == null) { WMMessageBox.Show(this, "没有找到相应的表信息!"); this.ReaderOk = false; return; } db.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString()); DataRow dataRow2 = db.ExecuteRow("SELECT * FROM usersTable WHERE permanentUserId=@permanentUserId"); this.users = dataRow2; if (dataRow2 == null) { WMMessageBox.Show(this, "没有找到相应的用户信息!"); this.ReaderOk = false; return; } if (dataRow2["isActive"].ToString() == "2") { WMMessageBox.Show(this, "用户为注销状态,无法操作!"); this.ReaderOk = false; return; } if (this.ReaderOk) { MainForm main = new MainForm(); main.setWelcomeForm(this); main.initData(this.meters, this.users, this.cardData, this.setting, this.arrayReadCard); main.ShowDialog(this); } } }
private ConsumeCardEntity getConsumeCardEntity() { ConsumeCardEntity consumeCardEntity = new ConsumeCardEntity(); consumeCardEntity.CardHead = this.getCardHeadEntity(); consumeCardEntity.DeviceHead = this.getDeviceHeadEntity(); consumeCardEntity.UserId = ConvertUtils.ToUInt32(this.userIdTB.Text.Trim(), 10); if (!string.IsNullOrEmpty(this.payNumTBText.Trim())) { consumeCardEntity.TotalRechargeNumber = ConvertUtils.ToUInt32(this.payNumTBText.Trim()); } else { consumeCardEntity.TotalRechargeNumber = 0U; } consumeCardEntity.ConsumeTimes = this.consumeTimes; return(consumeCardEntity); }
// Token: 0x06000427 RID: 1063 RVA: 0x0003D8AC File Offset: 0x0003BAAC private void readCardBtn_Click(object sender, EventArgs e) { if (!MainForm.DEBUG) { ConsumeCardEntity consumeCardEntity = this.parseCard(true); if (consumeCardEntity != null) { this.fillAllWidget(string.Concat(consumeCardEntity.UserId)); this.initDGV("userId", string.Concat(consumeCardEntity.UserId)); return; } } else { this.fillAllWidget("1"); this.initDGV("userId", "1"); } }
// Token: 0x060003A5 RID: 933 RVA: 0x0002B970 File Offset: 0x00029B70 private ConsumeCardEntity parseCard(bool beep, uint cardType) { if (this.parentForm != null) { uint[] array = this.parentForm.readCard(beep); if (array != null && this.parentForm.getCardType(array[0]) == cardType) { if (this.parentForm.getCardAreaId(array[0]).CompareTo(ConvertUtils.ToUInt32(this.parentForm.getSettings()[0], 10)) != 0) { WMMessageBox.Show(this, "区域ID不匹配!"); return(null); } ConsumeCardEntity consumeCardEntity = new ConsumeCardEntity(); consumeCardEntity.parseEntity(array); return(consumeCardEntity); } else if (array != null) { WMMessageBox.Show(this, "此卡为其他卡片类型!"); } } return(null); }
private void showPayForm(object sender, EventArgs e, string amount = null) { this.resetTimeOut(); if (!this.payWaySelect) { WMMessageBox.Show(this, "请选择支付方式!"); return; } if (string.IsNullOrWhiteSpace(amount)) { // 计算支付金额以及购买量 calculateFee(((Button)sender).Text.Trim()); } else { calculateFee(amount); } // 验证 double num3 = ConvertUtils.ToDouble(this.limitPursuitTB.Text); double num4 = ConvertUtils.ToDouble(this.payNumTBText.Trim()); if (num4 < 0.0) { WMMessageBox.Show(this, "购买量不得小于0!"); return; } if (num4 > num3 && num3 != 0.0) { WMMessageBox.Show(this, "超出该用户类型限购量!"); return; } ConsumeCardEntity consumeCardEntity = null; int num5 = isValidCard(false); if (num5 == 2) { consumeCardEntity = this.parseCard(false); if (consumeCardEntity == null) { return; } } if (consumeCardEntity == null) { return; } if (consumeCardEntity != null) { if (consumeCardEntity != null && consumeCardEntity.DeviceHead.DeviceIdFlag == 0U) { WMMessageBox.Show(this, "此卡未开户,不能写入数据!"); return; } if (consumeCardEntity != null && consumeCardEntity.DeviceHead.ConsumeFlag == 0U) { WMMessageBox.Show(this, "此卡未刷卡,不能写入数据!"); return; } } PayForm payForm = new PayForm(); payForm.setMainForm(this); payForm.setWelcomeForm(this.welcomeForm); string time = DateTime.Now.ToLocalTime().ToString(); string timestamp = DateTime.Parse(time).ToString("yyyyMMddHHmmss"); string body = $"购买热量:{this.payNumTBText}kWh"; string ip = HeMaPay.GetLocalIp(); DbUtil db = new DbUtil(); db.AddParameter("pay", this.payWay.ToString()); db.AddParameter("total_amount", this.dueNumTBText); db.AddParameter("body", body); db.AddParameter("create_time", timestamp); db.AddParameter("create_ip", ip); long out_order_no = db.ExecuteNonQueryAndReturnLastInsertRowId("INSERT INTO he_ma_pay(pay, total_amount, body, create_time, create_ip) values (@pay, @total_amount, @body, @create_time, @create_ip)"); string payRequest = HeMaPay.Percreate(this.payWay, out_order_no.ToString(), this.dueNumTBText, body, timestamp, ip); if (!string.IsNullOrWhiteSpace(payRequest)) { JObject retPayObJ = JObject.Parse(payRequest.ToString()); if (retPayObJ["code"].ToString().Equals("200")) { JObject data = JObject.Parse(retPayObJ["data"].ToString()); if (data["sub_code"].ToString().Equals("SUCCESS")) { // 下单成功, 数据入库 updatePayResult(db, out_order_no, payRequest, 0); string qr_code = data["qr_code"].ToString().Trim(); string way = ""; if (payWay == PayWay.WECHAT) { way = "微信"; } else if (payWay == PayWay.ALIPAY) { way = "支付宝"; } this.timer1.Stop(); this.timer1.Enabled = false; /**** * dueNum 金额 * payNum 购买量 * */ payForm.setInit(this.dueNumTBText, this.payNumTBText, qr_code, out_order_no, way, timestamp); payForm.ShowDialog(this); } else { WMMessageBox.Show(this, data["sub_msg"].ToString() + "!"); return; } } else { WMMessageBox.Show(this, "下单失败!"); return; } } else { WMMessageBox.Show(this, "网络异常,请稍后再试!"); return; } }
// Token: 0x060003DE RID: 990 RVA: 0x00033378 File Offset: 0x00031578 private void readCardBtn_Click(object sender, EventArgs e) { bool flag = true; if (parentForm == null) { return; } ConsumeCardEntity consumeCardEntity = parseCard(true); if (consumeCardEntity == null) { return; } if (consumeCardEntity.DeviceHead.ConsumeFlag == 0) { flag = false; } string text = string.Concat(consumeCardEntity.UserId); DateTime now = DateTime.Now; db.AddParameter("userId", text); DataRow dataRow = db.ExecuteRow("SELECT * FROM metersTable WHERE meterId=@userId"); if (dataRow == null) { WMMessageBox.Show(this, "没有找到相应的表信息!"); return; } db.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString()); DataRow dataRow2 = db.ExecuteRow("SELECT * FROM usersTable WHERE permanentUserId=@permanentUserId"); if (dataRow2 == null) { WMMessageBox.Show(this, "没有找到该用户!"); return; } double num = ConvertUtils.ToUInt32(dataRow2["totalPursuitNum"].ToString()); fillBaseInfoWidget(dataRow2); if (flag) { db.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString()); db.AddParameter("lastReadInfo", "1"); db.AddParameter("totalNum", string.Concat(consumeCardEntity.TotalReadNum)); DataRow dataRow3 = db.ExecuteRow("SELECT * FROM userCardLog WHERE permanentUserId=@permanentUserId AND totalNum=@totalNum AND lastReadInfo=@lastReadInfo ORDER BY operationId DESC"); if (dataRow3 == null) { db.AddParameter("time", string.Concat((now - WMConstant.DT1970).TotalSeconds)); db.AddParameter("userHead", string.Concat(consumeCardEntity.CardHead.getEntity())); db.AddParameter("deviceHead", string.Concat(consumeCardEntity.DeviceHead.getEntity())); db.AddParameter("userId", text ?? ""); db.AddParameter("pursuitNum", "0"); db.AddParameter("totalNum", string.Concat(consumeCardEntity.TotalReadNum)); db.AddParameter("consumeTimes", string.Concat(consumeCardEntity.ConsumeTimes)); db.AddParameter("operator", MainForm.getStaffId()); db.AddParameter("operateType", "2"); db.AddParameter("totalPayNum", "0"); db.AddParameter("unitPrice", "0"); db.AddParameter("lastReadInfo", "1"); db.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString()); db.ExecuteNonQuery("INSERT INTO userCardLog(time, userHead, deviceHead, userId, pursuitNum, totalNum, consumeTImes, operator, operateType, totalPayNum, unitPrice, lastReadInfo, permanentUserId) VALUES (@time, @userHead, @deviceHead, @userId, @pursuitNum, @totalNum, @consumeTImes, @operator, @operateType,@totalPayNum, @unitPrice, @lastReadInfo, @permanentUserId)"); } } db.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString()); db.AddParameter("operateType", "2"); db.AddParameter("lastReadInfo", "0"); DataTable dataTable = db.ExecuteQuery("SELECT * FROM userCardLog WHERE permanentUserId=@permanentUserId AND operateType!=@operateType AND lastReadInfo=@lastReadInfo ORDER BY operationId DESC"); if (dataTable != null && dataTable.Rows != null && dataTable.Rows.Count > 0) { fillPursuitInfoWidget(dataTable.Rows[0]); lastPursuitInfo = dataTable.Rows[0]; if (num > 0.0 && num < ConvertUtils.ToDouble(lastPursuitInfo["pursuitNum"].ToString()) / 10.0) { WMMessageBox.Show(this, "用户已经退购!"); return; } DateTime d = WMConstant.DT1970.AddSeconds(ConvertUtils.ToDouble(lastPursuitInfo["time"].ToString())); TimeSpan timeSpan = now - d; db.AddParameter("typeId", dataRow2["userTypeId"].ToString()); dataRow2 = db.ExecuteRow("SELECT * FROM userTypeTable WHERE typeId=@typeId"); if (dataRow2 == null) { WMMessageBox.Show(this, "没有找到对应用户类型!"); return; } overZeroValue = ConvertUtils.ToDouble(dataRow2["overZeroValue"].ToString()); uint totalReadNum = consumeCardEntity.TotalReadNum; overZeroFlag = consumeCardEntity.DeviceHead.OverZeroFlag; consumeTimes = ConvertUtils.ToUInt32(lastPursuitInfo["consumeTimes"].ToString()); if (!flag) { num -= ConvertUtils.ToDouble(lastPursuitInfo["pursuitNum"].ToString()) / 10.0; consumeTimes--; double num2 = ConvertUtils.ToDouble(lastPursuitInfo["totalNum"].ToString()) / 10.0; DeviceHeadEntity deviceHeadEntity = new DeviceHeadEntity(); deviceHeadEntity.parseEntity(ConvertUtils.ToUInt32(lastPursuitInfo["deviceHead"].ToString())); overZeroFlag = deviceHeadEntity.OverZeroFlag; } int surplusNum = consumeCardEntity.DeviceHead.getSurplusNum(); lastSurplusNumTB.Text = surplusNum.ToString(); totalReadNumTB.Text = consumeCardEntity.TotalReadNum.ToString(); totalPursuitNumTB.Text = num.ToString(); db.AddParameter("userId", text); dataRow2 = db.ExecuteRow("SELECT * FROM cardData WHERE userId=@userId"); if (dataRow2 == null) { WMMessageBox.Show(this, "没有找到用户卡片信息!"); return; } ic_id = ConvertUtils.ToUInt32(dataRow2["cardId"].ToString()); enterByManualBtn.Enabled = true; enterByAutoBtn.Enabled = true; } else { WMMessageBox.Show(this, "没有找到消费记录!"); } }
// Token: 0x060003EC RID: 1004 RVA: 0x00035448 File Offset: 0x00033648 private void writeCard() { ConsumeCardEntity consumeCardEntity = new ConsumeCardEntity(); CardHeadEntity cardHeadEntity = new CardHeadEntity(); cardHeadEntity.parseEntity(ConvertUtils.ToUInt32(this.lastPursuitInfo["userHead"].ToString())); consumeCardEntity.CardHead = cardHeadEntity; DeviceHeadEntity deviceHeadEntity = new DeviceHeadEntity(); deviceHeadEntity.parseEntity(ConvertUtils.ToUInt32(this.lastPursuitInfo["deviceHead"].ToString())); deviceHeadEntity.ReplaceCardFlag = 1U; if (this.forceStatus_CB.SelectedIndex <= 0) { deviceHeadEntity.ForceStatus = 0U; } else { deviceHeadEntity.ForceStatus = (uint)this.forceStatus_CB.SelectedIndex; } consumeCardEntity.DeviceHead = deviceHeadEntity; consumeCardEntity.UserId = ConvertUtils.ToUInt32(this.lastPursuitInfo["userId"].ToString()); consumeCardEntity.TotalRechargeNumber = ConvertUtils.ToUInt32(this.lastPursuitInfo["pursuitNum"].ToString()); uint num = ConvertUtils.ToUInt32(this.lastPursuitInfo["operateType"].ToString()); if (num == 3U) { uint num2 = ConvertUtils.ToUInt32(this.lastPursuitInfo["consumeTimes"].ToString()); consumeCardEntity.ConsumeTimes = num2 - 1U; } else { consumeCardEntity.ConsumeTimes = ConvertUtils.ToUInt32(this.lastPursuitInfo["consumeTimes"].ToString()); } if (num == 4U) { consumeCardEntity.DeviceHead.RefundFlag = 1U; consumeCardEntity.DeviceHead.ConsumeFlag = 1U; consumeCardEntity.DeviceHead.DeviceIdFlag = 1U; } long num3; if (!MainForm.DEBUG) { num3 = (long)this.parentForm.writeCard(consumeCardEntity.getEntity()); if (num3 != 0L) { WMMessageBox.Show(this, "写卡失败!"); return; } } DateTime now = DateTime.Now; TimeSpan timeSpan = now - WMConstant.DT1970; long num4 = (long)timeSpan.TotalSeconds; this.db.AddParameter("time", ConvertUtils.ToInt64(timeSpan.TotalSeconds).ToString()); this.db.AddParameter("userHead", ConvertUtils.ToInt64(consumeCardEntity.CardHead.getEntity()).ToString()); this.db.AddParameter("deviceHead", ConvertUtils.ToInt64(consumeCardEntity.DeviceHead.getEntity()).ToString()); this.db.AddParameter("userId", ConvertUtils.ToInt64(consumeCardEntity.UserId).ToString()); this.db.AddParameter("pursuitNum", ConvertUtils.ToInt64(consumeCardEntity.TotalRechargeNumber).ToString()); this.db.AddParameter("unitPrice", "0"); this.db.AddParameter("totalNum", ConvertUtils.ToInt64(consumeCardEntity.TotalReadNum).ToString()); this.db.AddParameter("consumeTimes", ConvertUtils.ToInt64(consumeCardEntity.ConsumeTimes).ToString()); this.db.AddParameter("operator", MainForm.getStaffId()); this.db.AddParameter("operateType", "2"); this.db.AddParameter("totalPayNum", "0"); this.db.AddParameter("permanentUserId", this.lastPursuitInfo["permanentUserId"].ToString()); num3 = this.db.ExecuteNonQueryAndReturnLastInsertRowId("INSERT INTO userCardLog(time, userHead, deviceHead, userId, pursuitNum, unitPrice, totalNum, consumeTImes, operator, operateType, totalPayNum, permanentUserId) VALUES (@time, @userHead, @deviceHead, @userId, @pursuitNum, @unitPrice, @totalNum, @consumeTImes, @operator, @operateType, @totalPayNum, @permanentUserId)"); uint num5 = MainForm.DEBUG ? 123U : this.parentForm.getCardID(); this.db.AddParameter("cardId", string.Concat(num5)); this.db.AddParameter("operator", MainForm.getStaffId()); this.db.AddParameter("userId", ConvertUtils.ToInt64(consumeCardEntity.UserId).ToString()); this.db.ExecuteNonQuery("UPDATE cardData SET cardId=@cardId WHERE userId=@userId"); this.db.AddParameter("userId", ConvertUtils.ToInt64(consumeCardEntity.UserId).ToString()); this.db.AddParameter("userName", this.nameTB.Text); this.db.AddParameter("pursuitNum", "0"); this.db.AddParameter("unitPrice", "0"); this.db.AddParameter("totalPrice", this.replaceCardFeeTB.Text.Trim()); this.db.AddParameter("payType", "2"); this.db.AddParameter("dealType", "0"); this.db.AddParameter("operator", MainForm.getStaffId()); this.db.AddParameter("operateTime", string.Concat(num4)); this.db.AddParameter("userCardLogId", string.Concat(num3)); this.db.AddParameter("permanentUserId", this.lastPursuitInfo["permanentUserId"].ToString()); this.db.AddParameter("realPayNum", ConvertUtils.ToDouble(this.realPayNumTB.Text.Trim()).ToString("0.00") ?? ""); this.db.ExecuteNonQuery("INSERT INTO payLogTable(userId,userName,pursuitNum,unitPrice,totalPrice,payType,dealType,operator,operateTime,userCardLogId, permanentUserId, realPayNum) VALUES (@userId,@userName,@pursuitNum,@unitPrice,@totalPrice,@payType,@dealType,@operator,@operateTime,@userCardLogId, @permanentUserId, @realPayNum)"); this.clearAllBtn_Click(new object(), new EventArgs()); WMMessageBox.Show(this, "补卡完成!"); }
/** * 读卡 * */ private void displayFields() { ConsumeCardEntity consumeCardEntity = this.parseCard(true); if (consumeCardEntity != null) { if (!this.checkOtherStatus(consumeCardEntity)) { return; } DataRow dataRow; if (this.firstLoad) { dataRow = this.meters; } else { string text = string.Concat(consumeCardEntity.UserId); this.dbUtil.AddParameter("userId", text); dataRow = this.dbUtil.ExecuteRow("SELECT * FROM metersTable WHERE meterId=@userId"); } if (dataRow == null) { WMMessageBox.Show(this, "没有找到相应的表信息!"); return; } DataRow dataRow2; if (this.firstLoad) { dataRow2 = this.users; } else { this.dbUtil.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString()); dataRow2 = this.dbUtil.ExecuteRow("SELECT * FROM usersTable WHERE permanentUserId=@permanentUserId"); } if (dataRow2 == null) { WMMessageBox.Show(this, "没有找到相应的用户信息!"); return; } if (dataRow2["isActive"].ToString() == "2") { WMMessageBox.Show(this, "用户为注销状态,无法操作!"); return; } this.userNameTB.Text = dataRow2["username"].ToString(); this.userIdTB.Text = dataRow2["userId"].ToString(); this.phoneNumTB.Text = dataRow2["phoneNum"].ToString(); this.addressTB.Text = dataRow2["address"].ToString(); this.userAreaNumTBText = dataRow2["userArea"].ToString(); string value = dataRow2["userTypeId"].ToString(); string value2 = dataRow2["userPriceConsistId"].ToString(); string querySql3 = "SELECT * FROM userTypeTable WHERE typeId=@userTypeId"; this.dbUtil.AddParameter("userTypeId", value); DataRow userTypeRow = this.dbUtil.ExecuteRow(querySql3); if (userTypeRow != null) { this.hardwareParaTB.Text = userTypeRow["hardwareInfo"].ToString(); this.alertNumTB.Text = userTypeRow["alertValue"].ToString(); this.closeValveValueTB.Text = userTypeRow["closeValue"].ToString(); this.limitPursuitTB.Text = userTypeRow["limitValue"].ToString(); this.settingNumTB.Text = userTypeRow["setValue"].ToString(); this.onoffOneDayTB.Text = WMConstant.OnOffOneDayList[(int)((IntPtr)ConvertUtils.ToInt64(userTypeRow["onoffOneDayValue"].ToString()))]; this.powerDownFlagTB.Text = WMConstant.PowerDownOffList[(int)((IntPtr)ConvertUtils.ToInt64(userTypeRow["powerDownFlag"].ToString()))]; this.intervalTimeTB.Text = userTypeRow["intervalTime"].ToString(); this.overZeroTB.Text = userTypeRow["overZeroValue"].ToString(); this.limitPursuitNum = ConvertUtils.ToUInt32(userTypeRow["limitValue"].ToString()); if (this.limitPursuitNum == 0U) { this.limitPursuitNum = 10000000U; } } // 加载购买记录 loadAllRegisterDGV(dataRow2["userId"].ToString()); string querySql4 = "SELECT * FROM priceConsistTable WHERE priceConsistId=@priceConsistId"; this.dbUtil.AddParameter("priceConsistId", value2); this.priceConsistRow = this.dbUtil.ExecuteRow(querySql4); if (this.priceConsistRow != null) { string text3 = this.priceConsistRow["priceConstistName"].ToString(); this.priceTypeTBText = text3; this.calculateTypeTBText = WMConstant.CalculateTypeList[(int)((IntPtr)(ConvertUtils.ToInt64(this.priceConsistRow["calAsArea"].ToString())))]; this.unitPrice = ConvertUtils.ToDouble(this.priceConsistRow["priceConstistValue"].ToString()); } string text4 = dataRow2["userBalance"].ToString(); this.avaliableBalanceTBText = text4; this.balanceTBText = text4; return; } }
public void PaySucceed(string result, JObject retQueryObj, JObject retQueryDetailObj, string out_order_no, string create_time) { this.timer1.Enabled = true; this.TimeOut = this.MainFormTimeOut; this.timer1.Start(); // 支付成功 dbUtil.AddParameter("out_order_no", out_order_no); dbUtil.AddParameter("status", "2"); dbUtil.AddParameter("query", result); dbUtil.ExecuteNonQuery("UPDATE he_ma_pay SET query=@query,status=@status WHERE out_order_no=@out_order_no"); long num = 0L; ConsumeCardEntity consumeCardEntity = null; int num5 = isValidCard(); double buyer_pay_amount = ConvertUtils.ToDouble(retQueryDetailObj["buyer_pay_amount"].ToString().Trim()); if (num5 == 2) { consumeCardEntity = this.parseCard(false); if (consumeCardEntity == null) { bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount); if (!refund_status) { WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!"); } return; } } if (consumeCardEntity == null) { bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount); if (!refund_status) { WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!"); } return; } if (consumeCardEntity != null) { if (consumeCardEntity != null && consumeCardEntity.DeviceHead.DeviceIdFlag == 0U) { bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount); if (!refund_status) { WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!"); } WMMessageBox.Show(this, "此卡未开户,不能写入数据!"); return; } if (consumeCardEntity != null && consumeCardEntity.DeviceHead.ConsumeFlag == 0U) { bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount); if (!refund_status) { WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!"); } WMMessageBox.Show(this, "此卡未刷卡,不能写入数据!"); return; } } string tagUserId = this.userIdTB.Text.Trim(); if (!tagUserId.Equals(consumeCardEntity.UserId.ToString())) { bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount); if (!refund_status) { WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!"); } WMMessageBox.Show(this, "卡片与用户信息错误!"); return; } ConsumeCardEntity consumeCardEntity2 = this.getConsumeCardEntity(); consumeCardEntity2.DeviceHead.ConsumeFlag = 0U; consumeCardEntity2.ConsumeTimes += 1U; if (consumeCardEntity != null) { consumeCardEntity2.DeviceHead.RefundFlag = consumeCardEntity.DeviceHead.RefundFlag; consumeCardEntity2.DeviceHead.ValveCloseStatusFlag = consumeCardEntity.DeviceHead.ValveCloseStatusFlag; consumeCardEntity2.DeviceHead.ReplaceCardFlag = consumeCardEntity.DeviceHead.ReplaceCardFlag; consumeCardEntity2.DeviceHead.SurplusNumH = consumeCardEntity.DeviceHead.SurplusNumH; consumeCardEntity2.DeviceHead.SurplusNumL = consumeCardEntity.DeviceHead.SurplusNumL; } // 开启非阻塞 Program.MsgBoxNonBlocking = true; // 阻塞标记置为空 Program.MsgBoxMessage = ""; num = (long)this.writeCard(consumeCardEntity2.getEntity()); // 关闭非阻塞 Program.MsgBoxNonBlocking = false; // 阻塞标记不为空 执行响应的后续操作并提醒用户 if (!string.IsNullOrWhiteSpace(Program.MsgBoxMessage)) { bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount); if (!refund_status) { WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!"); } WMMessageBox.Show(this, Program.MsgBoxMessage); Program.MsgBoxMessage = ""; return; } if (num == 0L) { dbUtil.AddParameter("userId", ConvertUtils.ToInt64(consumeCardEntity2.UserId).ToString()); DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM metersTable WHERE meterId=@userId"); dbUtil.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString()); DataRow dataRow2 = dbUtil.ExecuteRow("SELECT * FROM usersTable WHERE permanentUserId=@permanentUserId"); ulong num12 = ConvertUtils.ToUInt64(dataRow2["totalPursuitNum"].ToString()); num12 += (ulong)consumeCardEntity2.TotalRechargeNumber; List <string> list = new List <string>(); Dictionary <string, string> usersTableUpdate = new Dictionary <string, string>(); usersTableUpdate.Add("totalPursuitNum", string.Concat(num12)); usersTableUpdate.Add("userBalance", "0"); // 用户信息更新语句拼接 string usersUpdate = DictToMySqlUpdate(usersTableUpdate, "usersTable", "permanentUserId='" + dataRow["permanentUserId"].ToString() + "'"); list.Add(usersUpdate); TimeSpan timeSpan = DateTime.Now - DT1970; Dictionary <string, string> userCardLogParam = new Dictionary <string, string>(); userCardLogParam.Add("time", ConvertUtils.ToInt64(timeSpan.TotalSeconds).ToString()); userCardLogParam.Add("userHead", ConvertUtils.ToInt64(consumeCardEntity2.CardHead.getEntity()).ToString()); userCardLogParam.Add("deviceHead", ConvertUtils.ToInt64(consumeCardEntity2.DeviceHead.getEntity()).ToString()); userCardLogParam.Add("userId", ConvertUtils.ToInt64(consumeCardEntity2.UserId).ToString()); userCardLogParam.Add("pursuitNum", ConvertUtils.ToInt64(consumeCardEntity2.TotalRechargeNumber).ToString()); userCardLogParam.Add("totalNum", ConvertUtils.ToInt64(consumeCardEntity2.TotalReadNum).ToString()); userCardLogParam.Add("consumeTimes", ConvertUtils.ToInt64(consumeCardEntity2.ConsumeTimes).ToString()); userCardLogParam.Add("operator", Program.staffId); userCardLogParam.Add("operateType", "1"); userCardLogParam.Add("totalPayNum", string.Concat(buyer_pay_amount)); userCardLogParam.Add("unitPrice", this.getPriceConsistValue().ToString("0.00")); userCardLogParam.Add("permanentUserId", dataRow["permanentUserId"].ToString()); // 用户卡日志插入语句拼接 string userCardLog = DictToMySqlInsert(userCardLogParam, "userCardLog"); list.Add(userCardLog); // 用户卡日志插入的ID string selectNum2 = $"(SELECT MAX(operationId) FROM `usercardlog` WHERE userId = '{ConvertUtils.ToInt64(consumeCardEntity2.UserId).ToString()}' )"; Dictionary <string, string> operationLogParam = new Dictionary <string, string>(); operationLogParam.Add("userId", ConvertUtils.ToInt64(consumeCardEntity2.UserId).ToString()); operationLogParam.Add("cardType", ConvertUtils.ToInt64(1.0).ToString()); operationLogParam.Add("operationId", "operationIdParam123"); operationLogParam.Add("operator", Program.staffId); operationLogParam.Add("time", ConvertUtils.ToInt64(timeSpan.TotalSeconds).ToString()); // 用户操作日志插入语句拼接 string operationLog = DictToMySqlInsert(operationLogParam, "operationLog"); operationLog = operationLog.Replace("'operationIdParam123'", selectNum2); list.Add(operationLog); Dictionary <string, string> payLogTableParam = new Dictionary <string, string>(); payLogTableParam.Add("userId", ConvertUtils.ToInt64(consumeCardEntity2.UserId).ToString()); payLogTableParam.Add("userName", dataRow2["username"].ToString()); payLogTableParam.Add("pursuitNum", ConvertUtils.ToInt64(consumeCardEntity2.TotalRechargeNumber).ToString()); payLogTableParam.Add("unitPrice", this.getPriceConsistValue().ToString("0.00")); payLogTableParam.Add("totalPrice", string.Concat(buyer_pay_amount)); payLogTableParam.Add("payType", string.Concat(1)); payLogTableParam.Add("dealType", "0"); payLogTableParam.Add("operator", Program.staffId); payLogTableParam.Add("operateTime", ConvertUtils.ToInt64(timeSpan.TotalSeconds).ToString() ?? ""); payLogTableParam.Add("userCardLogId", "userCardLogIdParam123"); payLogTableParam.Add("permanentUserId", dataRow["permanentUserId"].ToString()); payLogTableParam.Add("realPayNum", string.Concat(buyer_pay_amount)); // 支付日志插入语句拼接 string payLogTable = DictToMySqlInsert(payLogTableParam, "payLogTable"); payLogTable = payLogTable.Replace("'userCardLogIdParam123'", selectNum2); list.Add(payLogTable); // 执行SQL语句 -- 事务 int count = dbUtil.ExecuteSqlTran(list); // 执行SQL语句失败 if (count == 0) { bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount); if (!refund_status) { WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!"); } // 取消写卡 long numx = (long)this.writeCard(consumeCardEntity.getEntity()); Console.WriteLine(numx + "数据存储失败! 写卡的数据恢复到写卡之前"); WMMessageBox.Show(this, "数据存储失败!"); return; } // 重新加载充值信息 this.loadAllRegisterDGV(string.Concat(consumeCardEntity2.UserId)); showPaySucceed(); } else { bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount); if (!refund_status) { WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!"); } return; } }
// Token: 0x0600038B RID: 907 RVA: 0x00028DDC File Offset: 0x00026FDC private void readCardBtn_Click(object sender, EventArgs e) { if (this.parentForm.isEmptyCard()) { this.messageRichTextBox.Text = "空白卡"; return; } uint[] array = this.parentForm.readCard(); if (array != null) { string text = ""; uint cardType = this.parentForm.getCardType(array[0]); uint num = cardType; switch (num) { case 1U: { ConsumeCardEntity consumeCardEntity = new ConsumeCardEntity(); consumeCardEntity.parseEntity(array); string value = string.Concat(consumeCardEntity.UserId); DbUtil dbUtil = new DbUtil(); dbUtil.AddParameter("userId", value); DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM metersTable WHERE meterId=@userId"); if (dataRow == null) { WMMessageBox.Show(this, "没有找到相应的表信息!"); } else { dbUtil.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString()); DataRow dataRow2 = dbUtil.ExecuteRow("SELECT * FROM usersTable WHERE permanentUserId=@permanentUserId"); if (dataRow2 != null) { text = string.Concat(new string[] { "设备号:", dataRow2["userId"].ToString(), "\n姓名:", dataRow2["username"].ToString(), "\n联系方式:", dataRow2["phoneNum"].ToString(), "\n证件号码:", dataRow2["identityId"].ToString(), "\n地址:", dataRow2["address"].ToString(), "\n用户面积:", dataRow2["userArea"].ToString(), "\n人口数:", dataRow2["userPersons"].ToString() }); } } text = text + "\n\n" + consumeCardEntity.ToString(); goto IL_2A5; } case 2U: { TransCardEntity transCardEntity = new TransCardEntity(); transCardEntity.parseEntity(array); text = transCardEntity.ToString(); goto IL_2A5; } case 3U: { RefundCardEntity refundCardEntity = new RefundCardEntity(); refundCardEntity.parseEntity(array); text = refundCardEntity.ToString(); goto IL_2A5; } case 4U: { SettingCardEntity settingCardEntity = new SettingCardEntity(); settingCardEntity.parseEntity(array); text = settingCardEntity.ToString(); goto IL_2A5; } case 5U: { ClearCardEntity clearCardEntity = new ClearCardEntity(); clearCardEntity.parseEntity(array); text = clearCardEntity.ToString(); goto IL_2A5; } case 6U: break; case 7U: case 8U: { ForceValveOperationCardEntity forceValveOperationCardEntity = new ForceValveOperationCardEntity(); forceValveOperationCardEntity.parseEntity(array); text = forceValveOperationCardEntity.ToString(); goto IL_2A5; } default: if (num != 31U) { goto IL_2A5; } break; } CheckCardEntityV3 checkCardEntityV = new CheckCardEntityV3(); checkCardEntityV.parseEntity(array); text = checkCardEntityV.ToString(); IL_2A5: this.messageRichTextBox.Text = text; } }