public IActionResult Delete(string saveName) { saveName = saveName.ToLower(); DirectoryInfo directoryInfo = new DirectoryInfo(FileHelper.GetUploadPath(string.Empty)); FileInfo foundFileInfo = directoryInfo.GetFiles(saveName, SearchOption.AllDirectories).FirstOrDefault(); if (foundFileInfo == null) { foundFileInfo = directoryInfo.GetFiles(StringEncode.EncodeMy(saveName), SearchOption.AllDirectories).FirstOrDefault(); } if (foundFileInfo == null) { foundFileInfo = directoryInfo.GetFiles(HttpUtility.UrlDecode(saveName), SearchOption.AllDirectories).FirstOrDefault(); } if (foundFileInfo != null) { try { foundFileInfo.Delete(); return(new JsonResult("{\"datas\":\"\",\"message\": \"删除成功\",\"success\": true }")); } catch (Exception ex) { LogerHelper.Error(ex.ToString(), "Delete"); return(new JsonResult("{\"datas\":\"\",\"message\": \"删除失败+" + ex.Message + "+\",\"success\": false }")); } } return(NotFound()); }
public Order updateStatus(Order order) { if (order != null) { using (DataContext db = new SqlserverContext()) { Table <Order> T_Order = db.GetTable <Order>(); //Order orders = (from c in T_Order where c.UserID == userId && c.ID == orderId select c) as Order; Order orders = T_Order.FirstOrDefault <Order>(x => x.ID.Equals(order.ID)); LogerHelper.debug(orders.UserID); if (orders != null) { Order order1 = T_Order.FirstOrDefault <Order>(x => x.ID.Equals(order.ID)); order1.State = (int)Commons.Type.USING; db.SubmitChanges(); LogerHelper.debug("还车修改订单状态成功!" + orders.State); if (orders != null) { return(orders); } } else { LogerHelper.debug("还车修改订单状态失败!"); } } } else { LogerHelper.debug("输入order为空"); } return(null); }
public void Stop() { LogerHelper.DefaultInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " Stop"); Stream inputStream = Request.GetBufferedInputStream(); StopRealTime real = RealTimeAnalysis.analysisStop(inputStream); if (RealTimeThread.dic.ContainsKey(real.TerminalId)) { CarInfo info = RealTimeThread.dic[real.TerminalId] as CarInfo; if (info != null) { info.Power = int.Parse(real.Power); info.Voltage = int.Parse(real.Voltage); info.Current = int.Parse(real.Current); info.Temperature = int.Parse(real.Temperature); RealTimeThread.dic[real.TerminalId] = info; } } else { CarInfo c = new CarInfo(); c.Power = int.Parse(real.Power); c.Voltage = int.Parse(real.Voltage); c.Current = int.Parse(real.Current); c.Temperature = int.Parse(real.Temperature); RealTimeThread.dic.Add(real.TerminalId, c); } if (real != null) { orderbll.uploadStopRealTime(real); } }
//1.add priviledges according to types //2.add to db and local memory public void addPrivilege(UserLogin bases) { // DbTransaction tran = null; // DbConnection conn = null; //Privileges pri = null; try { if (bases != null) {//普通用户 //if (Commons.NORMAL_USER.Equals(bases)) //{ // pri = new Privileges() { ID = Guid.NewGuid(), UserId = bases.ID, Privilege = Common.Commons.NORMAL_USER }; // HashOperator.getInstance().Set<Privileges>("Privileges", bases.ID, pri); // MsgQueueManager.SendPriMessage(pri); //} ////公司用户 //else if (Common.Commons.COMPANY_USER.Equals(Convert.ToInt32(bases))) //{ // pri = new Privileges() { ID = System.Guid.NewGuid(), UserId = bases.ID, Privilege = Common.Commons.COMPANY_USER }; // HashOperator.getInstance().Set<Privileges>("Privileges", bases.ID, pri); // MsgQueueManager.SendPriMessage(pri); //} //else //{ // //其他用户 //} } } catch (Exception ex) { LogerHelper.DefaultInfo(ex.Source + ":" + ex.ToString()); } }
public static void UpdateProdLineMaterialRcvCount(string _materialNo, byte _productLineNo, string _orderNo, int _receivedCount) {//string _materialNo, byte _productionLineNo, string _orderNo, int _usedCount if (_productLineNo > 0 && _productLineNo < 10 && _orderNo.Length > 0 && _materialNo.Length > 0 && _receivedCount > 0) { int _recordNo = ProductionLineMaterialBLL.GetProdLineMaterialRecord(_materialNo, _productLineNo, _orderNo); if (_recordNo > 0) { int _previousReceivedCount = ProductionLineMaterialBLL.GetProdLineMaterialReceivedCount(_materialNo, _productLineNo, _orderNo); if (ProductionLineMaterialBLL.UpdateProdLineMaterialReceivedCount(_materialNo, _productLineNo, _orderNo, _receivedCount + _previousReceivedCount)) { LogerHelper.ToLog("新物料箱更新database " + _orderNo + ":" + _materialNo + "," + _receivedCount + "+" + _previousReceivedCount, false); } else { LogerHelper.ToLog("更新databse出错 " + _orderNo + ":" + _materialNo + "," + _receivedCount + "+" + _previousReceivedCount, false); } } else { if (ProductionLineMaterialBLL.InsertProdLineMaterial(_materialNo, MaterialInfoBLL.GetMaterialName(_materialNo), 0, _productLineNo, _receivedCount, _orderNo)) { LogerHelper.ToLog("新物料写入database " + _orderNo + ":" + _materialNo + "," + _receivedCount, false); } else { LogerHelper.ToLog("写databse出错 " + _orderNo + ":" + _materialNo + "," + _receivedCount, false); } } } }
static void Main(string[] args) { try { IPAddress ip = IPAddress.Parse("10.176.114.99"); using (var stream = new StreamWriter(@"E:\本机ip.txt")) { stream.WriteLine(Dns.GetHostEntry(Dns.GetHostName()).AddressList[1].ToString()); } sokertServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); sokertServer.Bind(new IPEndPoint(ip, myPoint)); sokertServer.Listen(10); Console.WriteLine("创建{0}成功!", sokertServer.LocalEndPoint.ToString()); Thread myThread = new Thread(ListenClientConnect); myThread.Start(); Console.Read(); } catch (Exception ex) { string ss = LogerHelper.GetMethodInfo(); LogerHelper.WriteLog(ex, "", ss); } }
protected override void OnAuthorization(AuthorizationContext filterContext) { string log = this.ToLog4Start(); base.OnAuthorization(filterContext); LogerHelper.DefaultInfo(log); }
public ActionResult Register(UserReg infos, HttpPostedFileBase UserDriverLicense) { LogerHelper.debug("/User/Register" + infos.LoginID + " " + infos.LoginPwd); DefaultResult result = new DefaultResult(); try { //判断是普通用户 if (String.IsNullOrWhiteSpace(infos.LoginID) || String.IsNullOrWhiteSpace(infos.LoginPwd) || String.IsNullOrWhiteSpace(infos.CardId) || UserDriverLicense == null || String.IsNullOrWhiteSpace(infos.appkey) || String.IsNullOrWhiteSpace(infos.phone) || String.IsNullOrWhiteSpace(infos.zone) || String.IsNullOrWhiteSpace(infos.code) ) { //注册信息不全,返回json字符串{‘’:‘’} result.Code = "0101"; result.Data = ""; result.Message = "用户注册输入参数有空值"; //账号:11位数字 //密码:以字母开头,长度在6~18之间,只能包含字符、数字和下划线。 } //else if (!(Regex.IsMatch(info.Telephone,@"^[0-9]{11}$")&&Regex.IsMatch(info.Password,@"^[0-9a-zA-Z]{32}$"))) //{ // json.Data = new UserRegResult() { Code = "00", Response = "00", Data = "00", Message = "输入参数格式不对" }; //} else { string DriverLicensePath = string.Empty; DriverLicensePath = SaveFile(UserDriverLicense, DriverLicensePath); infos.UserDriveLicense = DriverLicensePath; //创建普通用户并增加权限 UserLogin logins = userbll.UserRegHandler(infos); if (logins != null) {//账号不存在 //USER_MANAGER.addPrivilege(current); result.Code = "0000"; result.Data = ""; result.Message = "用户注册成功"; LogHelper.OutPut(this.Url.RequestContext, "用户注册成功"); } else {//账号存在 result.Code = "0001"; result.Data = ""; result.Message = "用户注册失败"; LogHelper.OutPut(this.Url.RequestContext, "用户注册失败"); } } } catch (Exception e) { result.Code = "0201"; result.Data = ""; result.Message = "系统繁忙,请联系客服"; LogHelper.Exception(this.Url.RequestContext, e); //注册出现异常 } return(Json(result)); }
private void btn_LogSearch_Click(object sender, EventArgs e) { if (this.textBox_Log_Keyword.Text.Trim().Length > 0) { this.lsvSysLog.Items.Clear(); string allSysLog = LogerHelper.ReadAutoTestLogFile(); string[] sysLogArray = allSysLog.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int i = sysLogArray.Length - 1; i >= 0; i--) { if (sysLogArray[i].ToString().Contains(textBox_Log_Keyword.Text.Trim())) { ListViewItem lsvStationSubItem = new ListViewItem(); lsvStationSubItem.Text = (sysLogArray.Length - i).ToString(); lsvStationSubItem.SubItems.Add(sysLogArray[i].Trim()); this.lsvSysLog.Items.Add(lsvStationSubItem); } } } else { LoadSysLogAndShowFromDB(); // or LoadSysLogAndShowFromFile } }
//记录输入参数日志 public static void Input(params object[] p) { foreach (object t in p) { //如果参数是对象,输出序列化后对象 //如过参数是一个或多个字符串 LogerHelper.debug(ObjectToJson(t)); } }
public static string Process(FileInfo fiold, string waterText) { try { using (var fs = fiold.Open(FileMode.Open, FileAccess.Read)) { System.Drawing.Image img = System.Drawing.Image.FromStream(fs); } } catch (Exception ex) { return(""); } LogerHelper.Debug("saveFileLogs", "后缀名:" + fiold.Extension + ":::文件名:" + fiold.Name); try { if (!string.IsNullOrWhiteSpace(waterText)) { string oldpath = fiold.FullName; string newpath = fiold.FullName; AttachmentCenter.UtilsHelp.Watermark.AddWaterText(fiold.FullName, waterText, newpath, 118, 18); LogerHelper.Debug("saveFileLogs", ":::水印文件名:" + fiold.Name); } } catch (Exception e) { LogerHelper.Error(e.Message, "FileProcess", e); throw new Exception("水印添加失败!" + e.Message); } try { var tName = fiold.FullName.Insert(fiold.FullName.LastIndexOf('.'), "Thumbnail"); ThumbnailConfig config = Controllers.ConfigHelper.GetSetting <ThumbnailConfig>("Thumbnail"); switch (config.ThumbnailType) { case 0: { Thumbnail.MakeSquareImage(fiold.FullName, tName, (int)config.MaxLength); break; } case 1: { Thumbnail.MakeThumbnailImage(fiold.FullName, tName, config.MaxLength, config.MaxLength); break; } } return(new FileInfo(tName).Name); } catch (Exception ex) { LogerHelper.Error(ex.Message, "FileProcess", ex); } return(""); }
public void Authorization() { try { LogerHelper.DefaultInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 收到终端授权请求"); Stream inputStream = Request.GetBufferedInputStream(); Stream outputStream = Response.OutputStream; AuthorizationRequest real = RealTimeAnalysis.analysisAuthorizationReq(inputStream); if (RealTimeThread.dic.ContainsKey(real.TerminalId)) { CarInfo info = RealTimeThread.dic[real.TerminalId] as CarInfo; if (info == null) { info.Power = int.Parse(real.Power); info.Voltage = int.Parse(real.Voltage); info.Current = int.Parse(real.Current); info.Temperature = int.Parse(real.Temperature); RealTimeThread.dic[real.TerminalId] = info; } } else { CarInfo c = new CarInfo(); c.Power = int.Parse(real.Power); c.Voltage = int.Parse(real.Voltage); c.Current = int.Parse(real.Current); c.Temperature = int.Parse(real.Temperature); RealTimeThread.dic.Add(real.TerminalId, c); } if (real != null) { byte[] outs = orderbll.uploadAuthorization(real); Thread.Sleep(1000); if (outs != null) { outputStream.WriteByte(0xd3); outputStream.WriteByte(0xd3); outputStream.Write(outs, 0, outs.Length); LogerHelper.DefaultInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 下发终端授权响应" + ByteUtils.byteToHexStr(outs)); //修改订单状态为已使用 outputStream.Flush(); } } outputStream.Close(); inputStream.Close(); }catch (Exception e) { LogerHelper.exception("error occured!", e); } }
public bool cupPayment(Cup cup) { if (!String.IsNullOrWhiteSpace(cup.txnType) && !String.IsNullOrWhiteSpace(cup.txnTime) && !String.IsNullOrWhiteSpace(cup.respCode) && !String.IsNullOrWhiteSpace(cup.merId) && !String.IsNullOrWhiteSpace(cup.orderId) && !String.IsNullOrWhiteSpace(cup.payType) && !String.IsNullOrWhiteSpace(cup.payCardNo) && cup.txnAmt != 0) { //1.发送到消息队列 2.存入缓存 //交易成功 if (cup.respCode.Equals(Commons.CUP_SUCCESS)) { Order order = alipayDb.QueryOrder(cup.orderId) as Order; //存在该订单 if (order != null) { Recharge charge = new Recharge() { ID = Guid.NewGuid().ToString(), UserID = order.UserID, OrderID = cup.orderId, //单位:分 Amount = cup.txnAmt, Creater = Commons.orderHandler.USER.ToString(), CreateTime = DateTime.Now.ToString(), PayOrderID = cup.queryId, Remark = "银联消费类交易交易", Type = (int)Commons.PayType.RECHARGE }; OrderLog orderlog = new OrderLog() { CarID = order.CarID, CreateTime = DateTime.Now.ToString(), OrderID = cup.orderId, Remark = "银联订单支付完成", State = (int)Commons.Type.USING, Time = DateTime.Now.ToString(), UserID = order.UserID }; cupQueue.SendCup(cup); cupQueue.SendRecharge(charge); LogerHelper.debug("银联操作成功"); //cupQueue.SendOrderLog(orderlog); return(true); } } } return(false); }
public bool alipayPayment(Com.ChinaPalmPay.Platform.RentCar.Model.Alipay alipay) { //验证是否是支付宝发出的通知 //如果alipay通知正确,存入消息队列 if (!String.IsNullOrWhiteSpace(alipay.out_trade_no) && alipay.total_fee != 0 && !String.IsNullOrWhiteSpace(alipay.trade_status) && !String.IsNullOrWhiteSpace(alipay.trade_no)) { //1.发送到消息队列 2.存入缓存 //交易成功 if (alipay.trade_status.Equals(Commons.success) || alipay.trade_status.Equals(Commons.finished)) { Order order = alipayDb.QueryOrder(alipay.out_trade_no); if (order != null) { Recharge charge = new Recharge() { ID = Guid.NewGuid().ToString(), UserID = order.UserID, OrderID = alipay.out_trade_no, //单位:分 Amount = alipay.total_fee * 100, Creater = Commons.orderHandler.USER.ToString(), CreateTime = DateTime.Now.ToString(), PayOrderID = alipay.trade_no, Remark = "支付宝交易", Type = (int)Commons.PayType.RECHARGE }; OrderLog orderlog = new OrderLog() { CarID = order.CarID, CreateTime = DateTime.Now.ToString(), OrderID = alipay.out_trade_no, Remark = "支付宝订单支付完成", State = (int)Commons.Type.USING, Time = DateTime.Now.ToString(), UserID = order.UserID }; alipayQueue.Send(alipay); alipayQueue.Send(charge); //alipayQueue.Send(orderlog); LogerHelper.debug("支付宝操作成功"); return(true); } } } return(false); }
private void txt_userId_Validating(object sender, EventArgs e) { LogerHelper.WriteLog("账号验证开始"); if (string.IsNullOrEmpty(txt_userId.Text.Trim())) { txt_userId_ValidateBox.Visible = true; txt_userId_ValidateBox.Text = "账号不能为空!"; txt_userId_ValidateBox.ForeColor = Color.Red; txt_userId.Focus(); } else { txt_userId_ValidateBox.Visible = false; txt_userId_ValidateBox.Text = ""; } }
public static void UpdateProdLineMaterialUsdCount(string _materialNo, byte _productLineNo, string _orderNo, int _usedCount) {//string _materialNo, byte _productionLineNo, string _orderNo, int _usedCount if (_productLineNo > 0 && _productLineNo < 10 && _orderNo.Length > 0 && _materialNo.Length > 0) { int _previousUsedCount = ProductionLineMaterialBLL.GetProdLineMaterialUsedCount(_materialNo, _productLineNo, _orderNo); int _previousUsedCounter = ProductionLineMaterialBLL.GetProdLineMaterialUsedCounter(_materialNo, _productLineNo, _orderNo); if (ProductionLineMaterialBLL.UpdateProdLineMaterialUsedCount(_materialNo, _productLineNo, _orderNo, _previousUsedCount + _usedCount, _previousUsedCounter + _usedCount)) { LogerHelper.ToLog("物料消耗更新database " + _orderNo + ":" + _materialNo + "," + _previousUsedCount + "-" + _usedCount, false); } else { LogerHelper.ToLog("物料消耗更新database 出错 " + _orderNo + ":" + _materialNo + "," + _previousUsedCount + "-" + _usedCount, false); } } }
public ActionResult PayNotifyUrl() { try { string[] strs = Request.RawUrl.ToString().Split("/".ToCharArray()); string userID = strs[strs.Length - 1]; LogerHelper.DefaultInfo(strs[strs.Length - 1]); NotifyHandler resHandler = new NotifyHandler(Request.InputStream); Hashtable table = resHandler.Parameters; ArrayList akeys = new ArrayList(table.Keys); akeys.Sort(); foreach (string k in akeys) { string v = (string)table[k]; LogerHelper.DefaultInfo(v); } string openid = resHandler.GetParameter("openid"); string total_fee = resHandler.GetParameter("total_fee"); string out_trade_no = resHandler.GetParameter("out_trade_no"); LogerHelper.DefaultInfo("total_fee: " + total_fee); LogerHelper.DefaultInfo("out_trade_no: " + out_trade_no); resHandler.SetKey(Mch_Id); //验证请求是否从微信发过来(安全) // if (resHandler.IsTenpaySign()) // { //正确的订单处理 LogerHelper.DefaultInfo("nofify ok"); //此处userid是回调url最后一个参数 if (paymentbll.chargePayment(userID, Convert.ToInt32(total_fee), out_trade_no, (int)Commons.PayType.RECHARGE)) { LogerHelper.debug("微信支付成功!"); } // WebHelper.Post(LocalContext.platformUrl + "/Pay/Recharge", "UserID=" + (Common.GlobalMap[openid] as UserInformation).userid + "Amount=" + total_fee + "PayOrderID=" + out_trade_no + "Type=1"); // } // else // { //错误的订单处理 // LogerHelper.DefaultInfo("nofify no"); // } } catch (Exception ex) { LogerHelper.DefaultInfo("ex: " + ex.ToString()); } return(Content("success")); }
//***********************用户注册DB操作BEGIN********************************* public UserLogin Create(UserGroup Base, UserLogin login, User info, UserRegister register) { //DbTransaction tran = null; //DbConnection conn = null; //内存中不包含该用户,保存用户信息 if (Base != null && info != null && login != null && register != null) { using (DataContext db = new SqlserverContext()) { Table <UserGroup> T_UserGroup = db.GetTable <UserGroup>(); Table <UserLogin> T_UserLogin = db.GetTable <UserLogin>(); Table <User> T_User = db.GetTable <User>(); Table <UserRegister> T_UserRegister = db.GetTable <UserRegister>(); //conn = db.Connection; //if (conn.State == ConnectionState.Closed) //{ // conn.Open(); // tran = conn.BeginTransaction(); //} T_UserGroup.InsertOnSubmit(Base); T_UserLogin.InsertOnSubmit(login); T_User.InsertOnSubmit(info); T_UserRegister.InsertOnSubmit(register); //tran.Commit(); db.SubmitChanges(); LogerHelper.debug("REGESTER SUCCESS"); //conn.Close(); return(login); //注册账号已经存在 } } // ctx.Connection.Close(); //数据保存出错 //HashOperator.getInstance().Set<UserGroup>("InsertUserBaseError", Base.ID, Base); //HashOperator.getInstance().Set<User>("InsertUserInfoError", info.UserGroupID, info); //保存失败,继续存储,保证数据库与内存数据实现同步 //Thread oThread = new Thread(delegate() //{ // List<UserGroup> _userbase = HashOperator.getInstance().GetAll<UserGroup>("InsertUserBaseError"); // List<User> _userinfo = HashOperator.getInstance().GetAll<User>("InsertUserInfoError"); // SaveOrUpdateError.insertUser(_userbase, _userinfo); //}); //oThread.Name = "INSERT_User"; //oThread.Start(); //存储日志 return(null); }
private string SaveFile(HttpPostedFileBase file, string path) { try { if (file != null) { string legalCard = Guid.NewGuid().ToString().Replace("-", "") + "_" + Path.GetFileName(file.FileName); //string paths=AppDomain.CurrentDomain.BaseDirectory; path = "/upload/images/" + legalCard; file.SaveAs(Server.MapPath("~" + path)); } } catch (Exception ex) { LogerHelper.exception("图片上传失败!", ex); } return(path); }
private void LoadSysLogAndShowFromFile() { this.lsvSysLog.Items.Clear(); string allSysLog = LogerHelper.ReadAutoTestLogFile(); string[] sysLogArray = allSysLog.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int i = sysLogArray.Length - 1; i >= 0; i--) { ListViewItem lsvStationSubItem = new ListViewItem(); lsvStationSubItem.Text = (sysLogArray.Length - i).ToString(); lsvStationSubItem.SubItems.Add(sysLogArray[i].Trim()); this.lsvSysLog.Items.Add(lsvStationSubItem); } }
public Order SelectOrder(string userId, string orderId) { LogerHelper.DefaultInfo(string.Format("SelectOrder:{0}---{1}", userId, orderId)); if (!String.IsNullOrWhiteSpace(userId) && !String.IsNullOrWhiteSpace(orderId)) { using (DataContext db = new SqlserverContext()) { Table <Order> T_Order = db.GetTable <Order>(); //Order orders = (from c in T_Order where c.UserID == userId && c.ID == orderId select c) as Order; Order orders = T_Order.FirstOrDefault <Order>(x => x.UserID.Equals(userId) && x.ID.Equals(orderId)); if (orders != null) { LogerHelper.DefaultInfo(string.Format("SelectOrder11:{0}", orders.ID)); return(orders); } } } return(null); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { LogerHelper.Debug("Configure"); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseCors(builder => builder.WithHeaders(HeaderNames.ContentType, "x-custom-header") .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); DefaultFilesOptions defaultFilesOptions = new DefaultFilesOptions(); defaultFilesOptions.DefaultFileNames.Clear(); defaultFilesOptions.DefaultFileNames.Add("index.html"); app.UseDefaultFiles(defaultFilesOptions); string absolute = FileHelper.GetUploadPath(""); app.UseStaticFiles(new StaticFileOptions() { FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(absolute), RequestPath = "/Upload" //注:此处指定访问前缀,不能使用~符号开头 }); app.UseStaticFiles(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action}"); }); }
public ActionResult verifyOpenId(string openid) { DefaultResult result = new DefaultResult(); try { if (!String.IsNullOrWhiteSpace(openid)) { User user = userbll.queryOpenIdHandler(openid); if (user != null) { LogerHelper.debug("查询openid" + openid); result.Code = "0000"; result.Data = new { UserId = user.UserId, PhoneNumber = user.PhoneNumber, Password = user.Password, CardID = user.CardID, UserDriverLicense = Properties.getHost() + user.UserDriverLicense, UserStatus = user.UserStatus }; result.Message = "微信账号openId已存在"; LogHelper.OutPut(this.Url.RequestContext, new { UserId = user.UserId, PhoneNumber = user.PhoneNumber, Password = user.Password, CardID = user.CardID, UserDriverLicense = Properties.getHost() + user.UserDriverLicense, UserStatus = user.UserStatus }); } else { result.Code = "0001"; result.Data = null; result.Message = "微信账号openId不存在"; LogHelper.OutPut(this.Url.RequestContext, "微信账号openId不存在"); } } else { result.Code = "0101"; result.Data = ""; result.Message = "微信账号openid参数为null"; } } catch (Exception e) { result.Code = "0201"; result.Data = ""; result.Message = "系统繁忙,请联系客服"; LogHelper.Exception(this.Url.RequestContext, e); } return(Json(result)); }
private void dateTime_StartTime_ValueChangedFromFile(object sender, EventArgs e) { this.lsvSysLog.Items.Clear(); string selectedDate = dateTime_StartTime.Value.ToShortDateString(); string allSysLog = LogerHelper.ReadAutoTestLogFile(); string[] sysLogArray = allSysLog.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int i = sysLogArray.Length - 1; i >= 0; i--) { if (sysLogArray[i].ToString().Contains(selectedDate)) { ListViewItem lsvStationSubItem = new ListViewItem(); lsvStationSubItem.Text = (sysLogArray.Length - i).ToString(); lsvStationSubItem.SubItems.Add(sysLogArray[i].Trim()); this.lsvSysLog.Items.Add(lsvStationSubItem); } } }
// GET: /Pay/ /**充值或消费或付款**/ //IOS侧微信支付回调 //192.168.0.5:8787/Pay/Recharge public ActionResult Charge(string UserID, int?Amount, string PayOrderID, int?Type) { string response = Request.Params.ToString(); LogerHelper.DefaultInfo("微信回调"); LogerHelper.DefaultInfo(response); string rrr = Request.Form.ToString(); LogerHelper.DefaultInfo("POST:" + rrr); if (paymentbll.chargePayment(UserID, Amount, PayOrderID, Type)) { LogerHelper.debug("微信支付成功!"); } return(Content("cccc")); //if (!String.IsNullOrWhiteSpace(UserID) && !String.IsNullOrWhiteSpace(UserID) // &&!String.IsNullOrWhiteSpace(UserID) && !String.IsNullOrWhiteSpace(UserID)) //{ //} //return null; }
public CarStat addCarStat(OrderLog order) { LogerHelper.DefaultInfo("addCarStat:" + order.OrderID); //增加车状态 using (DataContext db = new SqlserverContext()) { Table <CarStat> T_PILE = db.GetTable <CarStat>(); CarStat stat = new CarStat(); CarStat c = (from m in T_PILE where m.CarID == order.CarID select m).FirstOrDefault(); stat.id = Guid.NewGuid().ToString().Replace("-", ""); stat.stat = (int)Commons.CatStatus.idle; stat.UserID = order.UserID; stat.CarID = order.CarID; stat.PilesID = c.PilesID; stat.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); T_PILE.InsertOnSubmit(stat); db.SubmitChanges(); LogerHelper.debug("还车 Add CarStat 成功!"); return(stat); } }
public void Run() { LogerHelper.DefaultInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " RUN"); Stream inputStream = Request.GetBufferedInputStream(); RunRealTime real = RealTimeAnalysis.analysisRun(inputStream); real.sampleTime = string.Format("{0:yyyyMMddHHmmssfff}", DateTime.Now); if (RealTimeThread.dic.ContainsKey(real.TerminalId)) { CarInfo info = RealTimeThread.dic[real.TerminalId] as CarInfo; if (info != null) { info.Power = real.batteryInfo; info.Voltage = real.voltage; info.Speed = real.speed; info.Mile = real.mile; info.Longitude = real.longitude; info.Latitude = real.latitude; RealTimeThread.dic[real.TerminalId] = info; } } else { CarInfo c = new CarInfo(); c.Power = real.batteryInfo; c.Voltage = real.voltage; c.Speed = real.speed; c.Mile = real.mile; c.Longitude = real.longitude; c.Latitude = real.latitude; RealTimeThread.dic.Add(real.TerminalId, c); } if (real != null) { orderbll.uploadRunRealTime(real); } }
public void OpenCloseGate() { LogerHelper.DefaultInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 收到终端开门请求"); try { Stream inputStream = Request.GetBufferedInputStream(); //byte[] src = new byte[42]; //int offset = 0; //int result = 0; //int cnt = 0; //while ((result = inputStream.ReadByte()) != -1) //{ // cnt++; // src[offset] = (byte)result; // offset++; //} // LogerHelper.debug("平台收到数据:"+ByteUtils.byteToHexStr(src)); OpenOrCloseGateRequest opens = RealTimeAnalysis.openOrCloseGate(inputStream); opens.CreateTime = DateTime.Now; orderbll.uploadOpenOrCloseGate(opens); }catch (Exception e) { LogHelper.Exception(this.Url.RequestContext, e); } }
public ActionResult WeChatUserReg(string PhoneNumber, string Password, string IDCardNo, string OpenID, HttpPostedFileBase UserDriverLicense) { LogerHelper.debug("/User/WeChatUserReg " + PhoneNumber + " " + Password + " " + IDCardNo + " " + OpenID + " " + UserDriverLicense); DefaultResult result = new DefaultResult(); try { if (!String.IsNullOrWhiteSpace(PhoneNumber) && !String.IsNullOrWhiteSpace(Password) && !String.IsNullOrWhiteSpace(OpenID) && !String.IsNullOrWhiteSpace(IDCardNo) && UserDriverLicense != null) { User userByCardID = db_manager.getUserByCardID(IDCardNo); //if (userByCardID!=null && userByCardID.PhoneNumber == PhoneNumber) { // result.Code = "0005"; // result.Data = null; // result.Message = "身份证已存在,手机号码不一致"; // LogHelper.OutPut(this.Url.RequestContext, "微信用户绑定失败"); // return Json(result); //} //User userByPhoneNumber = db_manager.getUserByPhoneNumber(PhoneNumber); //if (userByPhoneNumber != null && userByPhoneNumber.CardID == IDCardNo) //{ // result.Code = "0006"; // result.Data = null; // result.Message = "手机号码已存在,身份证不一致"; // LogHelper.OutPut(this.Url.RequestContext, "微信用户绑定失败"); // return Json(result); //} if (userByCardID != null && !userByCardID.PhoneNumber.Equals(PhoneNumber)) { result.Code = "0005"; result.Data = null; result.Message = "身份证已存在,手机号码不一致"; LogHelper.OutPut(this.Url.RequestContext, "微信用户绑定失败"); return(Json(result)); } User userByPhoneNumber = db_manager.getUserByPhoneNumber(PhoneNumber); if (userByPhoneNumber != null && !userByPhoneNumber.CardID.Equals(IDCardNo)) { result.Code = "0006"; result.Data = null; result.Message = "手机号码已存在,身份证不一致"; LogHelper.OutPut(this.Url.RequestContext, "微信用户绑定失败"); return(Json(result)); } string DriverLicensePath = string.Empty; // filePicturePath = SaveFile(filePicture, filePicturePath); // info.PitcurePath = filePicturePath; DriverLicensePath = SaveFile(UserDriverLicense, DriverLicensePath); User use = userbll.WechatUserReg(PhoneNumber, Password, IDCardNo, OpenID, DriverLicensePath); if (use != null) { result.Code = "0000"; result.Data = new { userId = use.UserId, CardId = use.CardID, UserDriverLicense = Properties.getHost() + use.UserDriverLicense, UserStatus = use.UserStatus }; result.Message = "微信用户绑定成功"; LogHelper.OutPut(this.Url.RequestContext, new { userId = use.UserId, CardId = use.CardID, UserDriverLicense = Properties.getHost() + use.UserDriverLicense, UserStatus = use.UserStatus }); } else { result.Code = "0001"; result.Data = null; result.Message = "微信用户绑定失败"; LogHelper.OutPut(this.Url.RequestContext, "微信用户绑定失败"); } } else { result.Code = "0101"; result.Data = ""; result.Message = "微信用户绑定输入参数有空值"; } } catch (Exception ex) { LogerHelper.debug("绑定异常!" + ex.Message); result.Code = "0201"; result.Data = ""; result.Message = "系统繁忙,请联系客服"; LogHelper.Exception(this.Url.RequestContext, ex); } return(Json(result)); }
static void Main(string[] args) { LogerHelper.SetConfig(); Thread computePanelIn6 = new Thread(new ThreadStart(() => { BotControlPanelIn6Hours.Instance.Run(); })); Thread computePanelByDay = new Thread(new ThreadStart(() => { BotControlPanelByDay.Instance.Run(); })); Thread computeChart = new Thread(new ThreadStart(() => { ComputeProjectChart.Instance.Run(); })); Thread baiduBot = new Thread(new ThreadStart(() => { var br = new IW2SBotRegHelper(); br.Register(BotType.Baidu); BaiduSearchMng.Instance.SetBusy += () => br.SentStatus(1); BaiduSearchMng.Instance.SetReady += () => br.SentStatus(0); BaiduSearchMng.Instance.Run(); })); Thread weixinBot = new Thread(new ThreadStart(() => { WeiXinSearchTools weixin = new WeiXinSearchTools(); while (true) { bool IsOK; Console.Write("输入开始日期(yyyy-MM-dd):"); string startStr = Console.ReadLine(); DateTime startDate = new DateTime(); IsOK = DateTime.TryParse(startStr, out startDate); if (!IsOK) { continue; } else { weixin.StartDate = startDate; } Console.Write("输入结束日期(yyyy-MM-dd):"); string endStr = Console.ReadLine(); DateTime endDate = new DateTime(); IsOK = DateTime.TryParse(endStr, out endDate); if (!IsOK) { continue; } else { weixin.EndDate = endDate; Console.WriteLine("日期为:{0}至{1}".FormatStr(startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd"))); Console.Write("是否无误?(Y/N):"); string code = Console.ReadLine().ToUpper(); if (code == "Y") { break; } } } var br = new IW2SBotRegHelper(); br.Register(BotType.WeiXin); weixin.SetBusy += () => br.SentStatus(1); weixin.SetReady += () => br.SentStatus(0); weixin.SetError += () => br.SentStatus(3); weixin.Run(); })); Console.WriteLine("1、百度Bot\t2、百度图表预计算"); Console.WriteLine("3、控制台-分钟计算\t4、控制台-天计算"); Console.WriteLine("5、微信BOT"); Console.Write("输入命令:"); while (true) { string str = Console.ReadLine(); int num = Convert.ToInt32(str); if (num >= 1 && num <= 5) { switch (num) { case 1: //百度BOT baiduBot.Start(); break; case 2: //项目图表预计算 computeChart.Start(); break; case 3: //控制台最近6小时变化数计算 computePanelIn6.Start(); break; case 4: //控制台每天数据计算 computePanelByDay.Start(); break; case 5: weixinBot.Start(); break; } break; } } Console.Read(); }