public static tgPerson QueryPersonByID(int id) { ItgPerson factory = StatisticstgPerson.GetFactory(); tgPerson Person = factory.QueryPersonByID(id); return(Person); }
public static bool UpdatePerson(tgPerson modle) { ItgPerson factory = StatisticstgPerson.GetFactory(); bool result = factory.Update(modle); if (result) { OperateLogServices.AddOperateLog(OperateType.Update, string.Format("personId:{0},personName:{1},parkingname:{2}", modle.id, modle.name, modle.PKName)); } return(result); }
public bool Add(tgPerson modle, DbOperator operators) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("insert into PersonTg(name,phone,bz,count,PKID,PKName)"); sb.AppendFormat("values(@name,@phone,@bz,'0',@PKID,@PKName)"); operators.ClearParameters(); operators.AddParameter("name", modle.name); operators.AddParameter("phone", modle.phone); operators.AddParameter("bz", modle.bz); operators.AddParameter("PKID", modle.PKID); operators.AddParameter("PKName", modle.PKName); return(operators.ExecuteNonQuery(sb.ToString()) > 0); }
public bool Update(tgPerson modle, DbOperator operators) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("update PersonTg set name=@name,phone=@phone,bz=@bz,PKID=@PKID,PKName=@PKName "); sb.AppendFormat("where id=@id"); operators.ClearParameters(); operators.AddParameter("name", modle.name); operators.AddParameter("phone", modle.phone); operators.AddParameter("bz", modle.bz); operators.AddParameter("id", modle.id); operators.AddParameter("PKID", modle.PKID); operators.AddParameter("PKName", modle.PKName); return(operators.ExecuteNonQuery(sb.ToString()) > 0); }
public tgPerson QueryPersonByID(int id) { tgPerson person = new tgPerson(); string strSql = "select * from PersonTg where id=@id"; using (DbOperator dboperator = ConnectionManager.CreateReadConnection()) { dboperator.ClearParameters(); dboperator.AddParameter("id", id); using (DbDataReader dr = dboperator.ExecuteReader(strSql)) { if (dr.Read()) { person = DataReaderToModel <tgPerson> .ToModel(dr); } } } return(person); }
public JsonResult EdittgPerson(tgPerson modle) { bool result = false; try { if (Request["title"] == "增加") { result = tgPersonServices.Addperson(modle); if (!result) { throw new Exception(); } return(Json(prompt.Success("添加成功!"))); } else { result = tgPersonServices.UpdatePerson(modle); return(Json(prompt.Success("修改成功!"))); } }catch (Exception ex) { return(Json(prompt.Error(ex.Message))); } }
public bool Update(tgPerson modle) { using (DbOperator operators = ConnectionManager.CreateConnection()) { return(Update(modle, operators)); } }
/// <summary> /// 订单支付通道 /// </summary> public void Index() { ReturnMessage returnMsg = new ReturnMessage() { Return_Code = "SUCCESS", Return_Msg = "" }; string xmlString = GetXmlString(Request); NotifyMessage message = null; try { TxtLogServices.WriteTxtLogEx("WeiXinPayNotify", xmlString); //此处应记录日志 message = XmlHelper.Deserialize <NotifyMessage>(xmlString); XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlString); Dictionary <string, string> dic = new Dictionary <string, string>(); string sign = string.Empty; foreach (XmlNode node in doc.FirstChild.ChildNodes) { if (node.Name.ToLower() != "sign") { dic.Add(node.Name, node.InnerText); } else { sign = node.InnerText; } } //处理通知 decimal orderId; if (!dic.ContainsKey("out_trade_no") || !decimal.TryParse(dic["out_trade_no"], out orderId)) { throw new MyException("支付回调订单编号格式不正确"); } OnlineOrder order = OnlineOrderServices.QueryByOrderId(orderId); if (order == null) { throw new MyException("订单存在,orderId:" + orderId); } UnifiedPayModel model = UnifiedPayModel.CreateUnifiedModel(order.CompanyID); if (!model.ValidateMD5Signature(dic, sign)) { throw new Exception("签名未通过!"); } if (!dic.ContainsKey("transaction_id")) { throw new MyException("支付流水号不存在"); } string payTradeNo = dic["transaction_id"]; DateTime payTime = DateTime.Now; if (dic.ContainsKey("time_end") && dic["time_end"].Length == 14) { string strDate = dic["time_end"].Insert(4, "-").Insert(7, "-").Insert(10, " ").Insert(13, ":").Insert(16, ":"); if (!DateTime.TryParse(strDate, out payTime)) { payTime = DateTime.Now; } } string payAccount = string.Empty; if (dic.ContainsKey("attach") && dic["attach"] == "MWEB" && dic.ContainsKey("openid") && !string.IsNullOrWhiteSpace(dic["openid"])) { payAccount = dic["openid"]; } else if (dic.ContainsKey("attach") && dic["attach"].Length > 0) { //统计二维码推广订单信息 string sAgendID = dic["attach"]; tgPerson person = tgPersonServices.QueryPersonByID(int.Parse(sAgendID)); TgOrder to = new TgOrder(); to.OrderID = order.OrderID; to.PKID = order.PKID; to.PKName = order.PKName; to.PlateNo = order.PlateNo; to.Amount = order.Amount; to.RealPayTime = payTime; to.PersonId = person.id; to.PersonName = person.name; TgOrderService.Addperson(to); } //if (Request.Cookies["SmartSystem_WeiXinTg_personid"] != null) //{ //} WeiXinInerface.ParkingFeeService.DeleteParkingFee(order.PlateNo + order.PKID); OnlineOrderServices.PaySuccess(orderId, payTradeNo, payTime, payAccount); } catch (MyException ex) { ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPayNotify", "支付通知出错:" + ex.Message, ex, LogFrom.WeiXin); //此处记录异常日志 returnMsg.Return_Code = "FAIL"; returnMsg.Return_Msg = ex.Message; } catch (Exception ex) { ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPayNotify", "支付通知出错", ex, LogFrom.WeiXin); //此处记录异常日志 returnMsg.Return_Code = "FAIL"; returnMsg.Return_Msg = ex.Message; } Response.Write(returnMsg.ToXmlString()); Response.End(); }