public ActionResult md5(string txtkey) { ViewBag.txt = txtkey; ViewBag.md5_16 = MD5Helper.MD5_16(txtkey); ViewBag.md5_32 = MD5Helper.MD5_32(txtkey); string des = DESHelper.DESEncrypt(txtkey, DESHelper.GetKey()); ViewBag.des_E = des; ViewBag.des_D = DESHelper.DESDecrypt(des, DESHelper.GetKey()); //LoginLog one = new LoginLog(); //one.belong_to_company = "ecobio"; //one.login_time = DateTime.Now; //one.login_user_alias = txtkey; //string xml = XmlSerializerHelper.SaveXmlFromObj<LoginLog>(one); string mdc = Image64Base.GetImageStr("d:\\a.jpg"); ViewBag.xml = mdc; return(View()); }
public static OracleConnection Connect() { //连接缓冲池配置 /* * * Connection Lifetime 销毁时间,默认0 * Connection Reset 是否复位,默认true * Enlist 是否参与事务,默认true * Max Pool Size 最大链接数,默认100 * Min Pool Size 最小链接数,默认0 * Pooling 是否启用链接缓冲,默认true * */ string connectString = ConfigurationManager.ConnectionStrings["database"].ConnectionString; connectString = DESHelper.Decrypt(connectString); //解密 OracleConnection connect = new OracleConnection(connectString); //连接数据库 connect.Open(); return(connect); }
private string GetCardAuthXml(CardAuthEntity entity) { var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U if (entity.Deleted) { flag = "D"; } var door = _doorService.GetById(entity.DoorUUID); var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); xmlBuilder.Append("<Tpp2Fpp>"); xmlBuilder.Append("<ReqHeader>"); xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName()); xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes)); xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes)); xmlBuilder.Append("</ReqHeader>"); xmlBuilder.Append("<ReqBody>"); xmlBuilder.Append("<crkqx>"); xmlBuilder.AppendFormat("<crk_uuid>{0}</crk_uuid>", entity.CardUUID); xmlBuilder.AppendFormat("<dev_uuid>{0}</dev_uuid>", entity.DoorUUID); xmlBuilder.AppendFormat("<state>{0}</state>", "2"); //出入卡状态(0:初始化;1:操作中;2:正常;3:挂失;4:注销) xmlBuilder.AppendFormat("<stime>{0}</stime>", Constant.FormatDateTime(entity.ValidFrom)); xmlBuilder.AppendFormat("<etime>{0}</etime>", Constant.FormatDateTime(entity.ValidTo)); xmlBuilder.AppendFormat("<cuser>{0}</cuser>", Constant.LkbAccount); xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss")); xmlBuilder.AppendFormat("<udate>{0}</udate>", Constant.FormatDateTime(entity.UpdateTime)); xmlBuilder.AppendFormat("<area_uuid>{0}</area_uuid>", door.AreaUUID); //区域权限因子(二级) (定长为 4位) xmlBuilder.AppendFormat("<flag>{0}</flag>", flag); xmlBuilder.Append("</crkqx>"); xmlBuilder.Append("</ReqBody> "); xmlBuilder.Append("</Tpp2Fpp> "); return(xmlBuilder.ToString()); }
private void toolSave_Click(object sender, EventArgs e) { //保存 if (textBox2.Text.ToString().Trim() != "admin" || PubFunVar.LoginUserName == "admin") { var itrue = Convert.ToInt16(checkBox1.Checked); string strpwd = ""; strpwd = DESHelper.DesEncrypt(textBox5.Text.ToString()); var au = new ActUser { id = textBox1.Text.ToInt(), UserID = textBox2.Text.ToString(), UserName = textBox3.Text.ToString(), Detp = textBox4.Text.ToString(), PassWords = strpwd.ToString(), isStop = itrue }; au.Save(); //保存 toolSetTrue(true); groupBox2.Text = ""; groupBox2.Tag = ""; this.IsSaveds = false; } else { //无权修改此用户密码 MessageBox.Show("无权修改此用户密码!"); toolSetTrue(true); groupBox2.Text = ""; groupBox2.Tag = ""; this.IsSaveds = false; } }
static void Main(string[] args) { // 实例化创建消息命令类的对象。 CreateCommand ca1 = new CreateCommand(); CreateCommand ca2 = new CreateCommand(); CreateCommand ca3 = new CreateCommand(MessageType.Command, 0x00000001); CreateCommand ca4 = new CreateCommand(MessageType.CommandACK); CreateCommand ca5 = new CreateCommand(MessageType.CommandResult, 0x00000001); // 采用 DES 密钥加密。 DESHelper des = new DESHelper(); byte[] desKey = des.GetSecretKey(); CreateCommand ca6 = new CreateCommand(MessageType.Event, desKey, 0x00000001); CreateCommand ca7 = new CreateCommand(MessageType.EventACK); // 获取数据报文字节数组。 byte[] cmd1 = new byte[] { ca1.GetHeartbeatDataCommand() }; byte[] cmd2 = new byte[] { ca2.GetHeartbeatResponseCommand() }; byte[] cmd3 = ca3.GetRequestCommand(MessageId.RealTimeControlLuminaire, ParameterType.Brightness, "100"); byte[] cmd4 = ca4.GetResponseCommand(0x0); byte[] cmd5 = ca5.GetResultCommand(0x0, MessageId.RealTimeControlLuminaire, ErrorCode.Succeed, "成功"); byte[] cmd6 = ca6.GetEventCommand(MessageId.DataCollection, new List <Parameter> { new Parameter(ParameterType.DeviceCategory, "02"), new Parameter(ParameterType.DeviceType, "01"), new Parameter(ParameterType.SerialNumber, 0x00000001), new Parameter(ParameterType.LuminaireId, "00000001".ToByteArray(true)) }); byte[] cmd7 = ca7.GetEventResponseCommand(0x01); // 将字节数组转成十六进制字符串形式并打印。 Console.WriteLine("一、生成命令\n1、心跳包数据\n" + cmd1.ToHexString() + "\n\n2、心跳包响应\n" + cmd2.ToHexString() + "\n\n3、请求命令\n" + cmd3.ToHexString() + "\n\n4、响应命令\n" + cmd4.ToHexString() + "\n\n5、结果命令\n" + cmd5.ToHexString() + "\n\n6、事件命令\n" + cmd6.ToHexString() + "\n\n7、事件响应\n" + cmd7.ToHexString()); // 订阅消息报文处理事件。 ParseCommand pa1 = new ParseCommand(cmd1); ParseCommand pa2 = new ParseCommand(cmd2); ParseCommand pa3 = new ParseCommand(cmd3); ParseCommand pa4 = new ParseCommand(cmd4); ParseCommand pa5 = new ParseCommand(cmd5); // 采用 DES 密钥解密。 ParseCommand pa6 = new ParseCommand(cmd6, desKey); ParseCommand pa7 = new ParseCommand(cmd7); pa1.DatagramProcess += Oa_DatagramProcess; pa2.DatagramProcess += Oa_DatagramProcess; pa3.DatagramProcess += Oa_DatagramProcess; pa4.DatagramProcess += Oa_DatagramProcess; pa5.DatagramProcess += Oa_DatagramProcess; pa6.DatagramProcess += Oa_DatagramProcess; pa7.DatagramProcess += Oa_DatagramProcess; // 触发消息报文处理事件。 Console.WriteLine("\n\n二、解析命令\n1、心跳包数据"); pa1.OnDatagramProcess(); Console.WriteLine("\n2、心跳包响应"); pa2.OnDatagramProcess(); Console.WriteLine("\n3、请求命令"); pa3.OnDatagramProcess(); Console.WriteLine("\n4、响应命令"); pa4.OnDatagramProcess(); Console.WriteLine("\n5、结果命令"); pa5.OnDatagramProcess(); Console.WriteLine("\n6、事件命令"); pa6.OnDatagramProcess(); Console.WriteLine("\n7、事件响应"); pa7.OnDatagramProcess(); // 等待用户按键退出。 Console.ReadKey(); }
/// <summary> /// 保存账号信息 /// </summary> /// <param name="username">用户名</param> /// <param name="password">密码</param> /// <param name="server">游戏服务器</param> public void SaveAccounts(string username, string password, int server) { if (username.Trim() == "" || password == "") { return; } AccountList acc = new AccountList(); DESHelper des = new DESHelper(); acc.username = des.Encrypt(username); acc.password = des.Encrypt(password); acc.gameServer = server; XmlDocument xmlDoc = new XmlDocument(); XmlDeclaration Declaration = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null); XmlNode rootNode = null; XmlElement accounts = null; if (!File.Exists("config.xml")) { xmlDoc.AppendChild(Declaration); xmlDoc.CreateElement("Config"); xmlDoc.AppendChild(rootNode); accounts = xmlDoc.CreateElement("Accounts"); rootNode.AppendChild(accounts); } else { xmlDoc.Load("config.xml"); accounts = (XmlElement)xmlDoc.SelectSingleNode("/Config/Accounts"); } bool found = false; if (accountList != null) { for (int i = 0; i < accountList.Count; i++) { if (accountList[i].username == acc.username && accountList[i].gameServer == acc.gameServer) { accountList[i] = acc; found = true; break; } } } if (found) { XmlNodeList xnl = accounts.ChildNodes; foreach (XmlNode account in xnl) { XmlElement xe = (XmlElement)account; if (xe.GetAttribute("Username") == des.Encrypt(username) && int.Parse(xe.GetAttribute("Server")) == server) { xe.SetAttribute("Password", des.Encrypt(password)); break; } } } else { XmlElement account = xmlDoc.CreateElement("Account"); accounts.AppendChild(account); account.SetAttribute("Username", acc.username); account.SetAttribute("Password", acc.password); account.SetAttribute("Server", acc.gameServer.ToString()); } accounts.SetAttribute("LastServer", server.ToString()); accounts.SetAttribute("LastAccount", acc.username); xmlDoc.Save("config.xml"); }
/// <summary> /// login /// </summary> /// <param name="userName">the name user input</param> /// <param name="userPassword">the password user input</param> /// <returns></returns> private dynamic Login(string userName, string userPassword) { ResponseModel response = _userLogic.Login(DESHelper.DESDecrypt(userName), DESHelper.DESDecrypt(userPassword)); return(Response.AsText(JsonConvert.SerializeObject(response), "application/json;charset=UTF-8")); }
protected void Page_Load(object sender, EventArgs e) { string outString = ""; string yqStr = ""; string qst = ""; string phoneno = ""; bool isallok = false; double LoginMaxSecond = 120; double TotalSeconds = 0; string LoginMD5_key = ""; DateTime ddd = new DateTime(); bool wxdebug = false; EGO_Order_List order; OrderEgoBLL orderBLL = new OrderEgoBLL(); string orderno = ""; string fileName = ""; Json_Response_Base.UploadPic_resultPackage jrb = new Json_Response_Base.UploadPic_resultPackage(); if (!bool.TryParse(Request["debug"] ?? "", out wxdebug)) { wxdebug = false; } try { ResultPacket rp = new ResultPacket(); Json_Response_Base.resultPackage jrp = new Json_Response_Base.resultPackage(); switch (Request["action"]) { //收货地址验证码 case "addressvalidcode": rp = SMSBll.MakeSMSCodeAndSend(Request["mobileno"], JYH_SMSCode.EnumSMSTradeType.SaveAddress); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //收货地址验证码 case "loginvalidcode": rp = SMSBll.MakeSMSCodeAndSend(Request["mobileno"], (int)JYH_SMSCode.EnumSMSTradeType.PhoneLogin, Request["piccode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //收货地址验证码 case "oauthvalidcode": rp = SMSBll.MakeSMSCodeAndSend(Request["mobileno"], JYH_SMSCode.EnumSMSTradeType.BindMobileAndMobileReg); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //手机注册验证码 case "registervalidcode": rp = SMSBll.MakeSMSCodeAndSend(Request["mobileno"], (int)JYH_SMSCode.EnumSMSTradeType.PhoneRegister, Request["piccode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //重新设置密码 case "passwordreset": phoneno = Session["UserName"] == null ? (Request["phoneno"] ?? "") : Session["UserName"].ToString(); jrp = new LoginBLL().ResetPassWord(phoneno, Request["validcode"], Request["password"]); outString = JsonHelper.ToJsonString(jrp); break; //重置密码验证码 case "resetpasswordvalidcode": phoneno = Session["UserName"] == null ? (Request["mobileno"] ?? "") : Session["UserName"].ToString(); rp = SMSBll.MakeSMSCodeAndSend(phoneno, (int)JYH_SMSCode.EnumSMSTradeType.PasswordReset, Request["piccode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //手机注册验证码 case "lqfxtqvalidcode": rp = SMSBll.MakeSMSCodeAndSend(Request["mobileno"], (int)JYH_SMSCode.EnumSMSTradeType.LQFXTQ, Request["piccode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //用户登录 case "userlogin": try { jrp = new LoginBLL().CheckLogin(Request["username"], Request["password"]); outString = JsonHelper.ToJsonString(jrp); if (jrp.resultcode == "1") { try { //保存用户信息至本地 new LoginBLL().SyncJYHMemberInfo(Request["password"], "wap"); } catch (Exception exd) { //记录异常 ProjectLogBLL.NotifyProjectLog(string.Format("一元购-保存用户信息至本地--异常:{0}", exd.ToString()), "active:API.asp的" + Request["action"]); } } } catch (Exception ex) { jrp.resultcode = "98"; jrp.resultmessage = ex.ToString(); outString = JsonHelper.ToJsonString(jrp); } break; //手机登录 case "phonelogin": jrp = new LoginBLL().CheckPhoneLogin(Request["phoneno"], Request["validcode"]); if (jrp.resultcode == "1") { try { //保存用户信息至本地 new LoginBLL().SyncJYHMemberInfo("", "wap"); } catch (Exception exd) { //记录异常 ProjectLogBLL.NotifyProjectLog(string.Format("一元购-保存用户信息至本地--异常:{0}", exd.ToString()), "active:API.asp的" + Request["action"]); } } outString = JsonHelper.ToJsonString(jrp); break; //只使用手机号直接登录,from=web的需要验签,安卓和ios直接登录 case "phoneloginauto": if (Request["type"] == "web") { try { //测试 //jrp = new LoginBLL().CheckPhoneLoginApp(Request["phoneno"]); //outString = JsonHelper.ToJsonString(jrp); //验签 if (Request["phoneno"] != null && Request["tt"] != null && Request["mac"] != null) { //判断时间是否自有效期内 LoginMaxSecond = INITools.GetIniKeyValue("autologinurl", "LoginMaxSecond") == "" ? 0 : double.Parse(INITools.GetIniKeyValue("autologinurl", "LoginMaxSecond")); // ConfigurationManager.AppSettings["LoginMaxSecond"] == null ? 120 : double.Parse(ConfigurationManager.AppSettings["LoginMaxSecond"].ToString()); qst = Request["tt"]; if (qst == "") { jrp.resultcode = "99"; jrp.resultmessage = "缺少参数"; } else { TimeSpan ts = DateTime.Now - DateTime.Parse("1970-1-1"); TotalSeconds = ts.TotalSeconds; TotalSeconds = TotalSeconds - double.Parse(qst); if (TotalSeconds >= LoginMaxSecond || TotalSeconds < 0) { jrp.resultcode = "99"; jrp.resultmessage = "已失效"; } else { LoginMD5_key = INITools.GetIniKeyValue("autologinurl", "LoginMD5_key") == "" ? "" : INITools.GetIniKeyValue("autologinurl", "LoginMD5_key"); yqStr = Request["phoneno"] + qst + LoginMD5_key; //验签通过 if (DESHelper.Md5(yqStr) == Request["mac"].ToString()) { //判断是否有手机号 if (Request["phoneno"] != "") { } else { jrp.resultcode = "99"; jrp.resultmessage = "缺少手机号"; } } else { jrp.resultcode = "99"; jrp.resultmessage = "签名错误"; } } } } else { jrp.resultcode = "99"; jrp.resultmessage = "缺少参数"; } } catch (Exception edf) { jrp.resultcode = "99"; jrp.resultmessage = "程序异常"; } if (jrp.resultcode != "99") { //登录 jrp = new LoginBLL().CheckPhoneLoginApp(Request["phoneno"]); if (jrp.resultcode == "1") { try { //保存用户信息至本地 new LoginBLL().SyncJYHMemberInfo("", "wap"); } catch (Exception exd) { //记录异常 ProjectLogBLL.NotifyProjectLog(string.Format("一元购-保存用户信息至本地--web登录--异常:{0}", exd.ToString()), "active:API.asp的" + Request["action"]); } } outString = JsonHelper.ToJsonString(jrp); } else { //用户注销 try { new LoginBLL().UserLoginOut(); } catch (Exception sse) { } } } else { jrp = new LoginBLL().CheckPhoneLoginApp(Request["phoneno"]); if (jrp.resultcode == "1") { try { //保存用户信息至本地 new LoginBLL().SyncJYHMemberInfo("", "wap"); } catch (Exception exd) { //记录异常 ProjectLogBLL.NotifyProjectLog(string.Format("一元购-保存用户信息至本地--APP登录--异常:{0}", exd.ToString()), "active:API.asp的" + Request["action"]); } } } outString = JsonHelper.ToJsonString(jrp); break; //用户注销 case "userlogout": jrp = new LoginBLL().UserLoginOut(); outString = JsonHelper.ToJsonString(jrp); break; //手机注册 case "phonereg": jrp = new LoginBLL().CheckPhoneReg(Request["phoneno"], Request["validcode"], Request["password"]); outString = JsonHelper.ToJsonString(jrp); break; case "phonereg_lqfxtq": jrp = new LoginBLL().CheckPhoneReg(Request["phoneno"], Request["validcode"], Request["password"], JYH_SMSCode.EnumSMSTradeType.LQFXTQ, Request["sharephone"]); outString = JsonHelper.ToJsonString(jrp); break; //检测是否登录 case "checklogin": jrp = new LoginBLL().CheckLoginSession(); outString = JsonHelper.ToJsonString(jrp); break; //手机登录 case "phoneexist": if (LoginBLL.CheckPhoneExist(Request["phoneno"])) { jrp.resultcode = "99"; jrp.resultmessage = "已存在"; } else { jrp.resultcode = "1"; jrp.resultmessage = "不存在"; } outString = JsonHelper.ToJsonString(jrp); break; //获取地址列表 case "addresslist": string addressList = ""; rp = new OrderBLL().GetAddressList(out addressList); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = addressList; } break; //新增收货地址 case "addressadd": rp = new OrderBLL().AddAddressForOrder(Request["api_input"], Request["validcode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //修改收货地址 case "addressedit": rp = new OrderBLL().EditAddressForOrder(Request["api_input"], Request["validcode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //根据id获得地址 case "getaddressbyid": string addressByID = ""; rp = new OrderBLL().GetAddressByID(Request["addressid"], out addressByID); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = addressByID; if (outString == "") { jrp.resultcode = "1000"; jrp.resultmessage = "收货地址已删除,请重新设置收货地址"; outString = JsonHelper.ToJsonString(jrp); } } break; //获取默认收货地址 case "addressdefault": string addressDetail = ""; rp = new OrderBLL().GetAddressDefault(out addressDetail); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = addressDetail; if (outString == "") { jrp.resultcode = "1000"; jrp.resultmessage = "收货地址已删除,请重新设置收货地址"; outString = JsonHelper.ToJsonString(jrp); } } break; case "merchant_check": Merchant_PageBLL checkBll = new Merchant_PageBLL(); foreach (string key in Request.Form.Keys) { checkBll._paramList.Add(key, HttpUtility.UrlDecode(Request.Form[key])); } string from = Request["merchantcode"].ToString(); if (!string.IsNullOrEmpty(from)) { outString = checkBll.NotifyMerchantApiData(); if (outString == "-1") { from = ""; } else { if (JsonHelper.JsonToObject <Json_Response_Base.resultPackage>(outString).resultcode != "1") { from = ""; } } } checkBll.CheckMerchantValid(Request["host"].ToString(), Request["refer"].ToString(), from); if (Session["MerchantID_HJY"] != null) { jrp.resultcode = "1"; jrp.resultmessage = from; } else { jrp.resultcode = "99"; jrp.resultmessage = "已失效"; } outString = JsonHelper.ToJsonString(jrp); break; //获取拼团信息 case "getpininfo": string pinInfo = ""; rp = new PinBLL().GetPinListByEventCode(Request["eid"].ToString(), out pinInfo); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = pinInfo; } break; //获取我的团信息 case "mytuans": string myTuans = ""; rp = new PinBLL().GetMyTuans(out myTuans); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = myTuans; } break; //获取我的订单 case "myorders": string myOrders = ""; rp = new PinBLL().GetMyOrders(out myOrders); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = myOrders; } break; //获取我的订单详情 case "myorderdetail": string myOrderDetail = ""; rp = new PinBLL().GetMyOrderDetail(Request.Form["oid"], out myOrderDetail); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = myOrderDetail; } break; //获取活动订单 case "eventorders": string eventOrders = ""; rp = new PinBLL().GetEventOrdersByEventCode(Request.Form["eid"], out eventOrders); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = eventOrders; } break; //参加拼团 case "pin": var num = int.Parse(Request.Form["num"]); var endTime = DateTime.Parse(Request.Form["endTime"].ToString()); rp = new PinBLL().Pin(num, endTime, Request.Form["json"].ToString()); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //监测是否可以参加拼团 case "iscanpin": rp = new PinBLL().IsCanPin(int.Parse(Request.Form["Num"].ToString()), DateTime.Parse(Request.Form["endTime"].ToString()), Request.Form["eventCode"].ToString()); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //更新拼团状态 case "updatetuanstatus": rp = new PinBLL().UpdatePinTuanStatus(Request.Form["eventCode"].ToString(), (JYH_Pin_List.EnumTuanStatus)(int.Parse(Request.Form["status"]))); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //更新支付状态 case "updatepaystatus": rp = new PinBLL().UpdatePayStatus(Request.Form["order_code"].ToString(), (JYH_Pin_Detail.EnumPayStatus)(int.Parse(Request.Form["status"]))); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; case "wxpay": //不经过支付网关 try { JsApiPay jsApiPay = new JsApiPay(this); jsApiPay.openid = Session["wxPayOpenid"].ToString(); //"oz1WBs_FPv5qbh1cyyoN9fzNZgUw"; jsApiPay.total_fee = (int)(decimal.Parse(Request["total_fee"].ToString()) * 100); jsApiPay.orderid = Request["orderid"]; WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult(); outString = jsApiPay.GetJsApiParameters(); FileHelper.WriteLogFile(Server.MapPath("log"), "wxOpenid", jsApiPay.openid); } catch (Exception ex) { FileHelper.WriteLogFile(Server.MapPath("log"), "wxOpenid", ex.ToString()); } break; case "test": rp = new PinBLL().Request_ApiBySendList(0, 0); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; ///*创建订单*/ //case "createorder": // order = new EGO_Order_List(); // order.ProductID = int.Parse(Request["ProductID"]); // order.PeriodNum = int.Parse(Request["PeriodNum"]); // order.OrderNo = RunProcedure.Exec_CreateSerialNo(10001); // order.OrderTime = DateTime.Now; // order.BuyerPhone = HttpContext.Current.Session["UserName"].ToString(); // order.ChipinNum =int.Parse(Request["ChipinNum"]);; // order.Status =EGO_Order_List.EnumOrderStatus.Init; // order.TotalMoney =decimal.Parse(Request["TotalMoney"]); // order.PayGate =(EnumPaygate)int.Parse(Request["PayGate"]); // order.PayGateType =(EnumPaygateType)int.Parse(Request["PayGateType"]); // if (orderBLL.Insert(order)) // { // outString = order.OrderNo; // } // else { // outString = ""; // } // break; ///*使用支付网关支付*/ //case "gotopayment": // //取得支付网关的参数 // orderno = Request["OrderNo"] ?? ""; // order = OrderBLL.GetOrderInfo(orderno); // if (order.PayGate == EnumPaygate.WeiXin_JSAPI) // { // //微信JSAPI // if (order.OpenID != "") // { // order.OpenID = Session["wxPayOpenid"].ToString(); // outString = PaygateBLL.GoToPayMent(order); // } // else { // outString = ""; // } // } // else // { // //支付宝 // outString = PaygateBLL.GoToPayMent(order); // } // break; case "wxshare": //微信内JSAPI分享 WX_JSAPI_Config jaapiconfig = new WX_JSAPI_Config(); jaapiconfig.resultcode = "0"; jaapiconfig.resultmessage = "操作成功"; string jsApiList = Request["jsApiList"] ?? ""; string url = Request["surl"] ?? ""; if (jsApiList == "") { jaapiconfig.resultcode = "1"; jaapiconfig.resultmessage = "要调用的接口不能为空"; } else if (url == "") { jaapiconfig.resultcode = "2"; jaapiconfig.resultmessage = "当前页面的url不能为空"; } else { WX_JSAPI_Ticket_Response ticket = WxJsApiData.GetJsApiTicket("jsapi"); if (ticket == null) { jaapiconfig.resultcode = "3"; jaapiconfig.resultmessage = "获取ticket失败."; } else { jaapiconfig.appId = WxPayConfig.APPID; jaapiconfig.debug = wxdebug; jaapiconfig.jsApiList = jsApiList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); jaapiconfig.nonceStr = WxPayApi.GenerateNonceStr(); jaapiconfig.timestamp = WxPayApi.GenerateTimeStamp(); jaapiconfig.ticket = ticket.ticket; jaapiconfig.url = url; jaapiconfig.signature = WxJsApiData.getSign(jaapiconfig); } } outString = JsonHelper.ToJsonString(jaapiconfig); break; #region 图片* /*上传图片*/ case "uploadimg": //====使用服务器物理路径,可实现上传======================================== //获取图片控件 string file_ID = Request["fileid"]; //.Split('|'); //string return_img_path = ""; var file = Request.Files[file_ID]; //var file =Request.Files[0]; //上传图片文件路径【通过虚拟目录获得对应的物理地址,虚拟目录地址需指向文件服务器的共享路径】 string temp_filePath = ConfigurationManager.AppSettings["UploadIMG"]; //图片上传物理路径(当前服务器上) string filePath = new System.Web.UI.Page().Server.MapPath(temp_filePath); ////图片上传物理路径(相对于文件服务器的地址) //string filePath = ConfigurationManager.AppSettings["UploadIMG"]; int maxSize = 0; string path = ""; if (file == null) { outString = "{\"resultCode\":\"1\",\"resultMessage\":\"请上传图片信息!\"}"; } fileName = file.FileName; string aaa = Encoding.UTF8.GetString(Encoding.Default.GetBytes(file.FileName)); string exName = ""; if (Path.GetExtension(aaa) == "") { exName = fileName.Substring(fileName.LastIndexOf('?')).Replace("?", "."); } else { exName = fileName.Substring(fileName.LastIndexOf('.')); } if (exName == "") { exName = "." + fileName.Substring(fileName.Length - 3, 3); } //重命名 //int seed = Guid.NewGuid().GetHashCode(); //var random = new System.Random(seed); string newFileName = DateTime.Now.ToString("yyyyMMddHHmmssffff") + "" + RandHelper.Next(100000, 999999); if (Directory.Exists(filePath) == false) { Directory.CreateDirectory(filePath); } path = filePath + "\\" + newFileName + exName; file.SaveAs(path); //图片访问路径 string baseurl = ""; if (Request["saveFullPath"] != null) { baseurl = ConfigurationManager.AppSettings["UploadIMG_YM"]; //Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port; } jrb.resultmessage = baseurl + ConfigurationManager.AppSettings["UploadIMG_Path"] + newFileName + exName; jrb.resultcode = "1"; outString = JsonHelper.ToJsonString(jrb); break; #endregion case "group_back": if (Session["group_back"] != null) { jrp.resultcode = "1"; jrp.resultmessage = "正常"; } else { jrp.resultcode = "99"; jrp.resultmessage = "已失效"; } outString = JsonHelper.ToJsonString(jrp); break; case "merchant_page": if (Session["MerchantID_HJY"] != null || (!string.IsNullOrEmpty(Request["recordact"]))) { Merchant_PageBLL pageBll = new Merchant_PageBLL(); foreach (string key in Request.Form.Keys) { pageBll._paramList.Add(key, HttpUtility.UrlDecode(Request.Form[key])); } outString = pageBll.NotifyMerchantApiData(); if (outString == "-1") { jrp.resultcode = "99"; jrp.resultmessage = "通知失败"; outString = JsonHelper.ToJsonString(jrp); } } else { if (Request["recordact"].ToString() != "") { } jrp.resultcode = "98"; jrp.resultmessage = "已失效"; outString = JsonHelper.ToJsonString(jrp); } break; } } catch (Exception ex) { ProjectLogBLL.NotifyProjectLog(string.Format("异常:{0}", ex.ToString()), "api-" + Request["action"]); } Response.Write(outString); }
public ActionResult ChipsSuccess(string Content, bool isServerCall = false) { string temp = Content; try { Content = DESHelper.DecryptDES(Content); CustomLog.WriteLog(Content); temp = Content; System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); PaymentModel payModel = jss.Deserialize <Models.PaymentModel>(Content); //判断订单是否存在 if (Helpers.UmbPayRecordsHelper.IsExistsBillno(payModel.Billno)) { IContent content = null; IMember currentMember = null; if (payModel.Email.Contains("^_^")) { string[] array = payModel.Email.Split(new string[] { "^_^" }, StringSplitOptions.RemoveEmptyEntries); //memberid currentMember = Services.MemberService.GetById(int.Parse(array[0])); //content = Services.ContentService.GetById(int.Parse(array[1])); //chips:pay:successurl if (currentMember != null) { IContentType ct = Services.ContentTypeService.GetContentType("Chipsdepositdocument"); string title = string.Format("比特公寓成都万达城店[{0}]", payModel.Amount); content = Services.ContentService.CreateContent(currentMember.Name + "_" + title, ct.Id, "Chipsdepositdocument"); content.SetValue("member", currentMember.Id.ToString()); content.SetValue("orderid", payModel.Billno); content.SetValue("chipsProduct", title); content.SetValue("amount", payModel.Amount.ToString()); content.SetValue("username", currentMember.GetValue <string>("tel") + "_" + payModel.Amount); content.SetValue("isRefund", false); content.SetValue("isOk", false); Services.ContentService.Save(content); //触发创建事件 //EventHandlers.CustomRaiseEvent.RaiseContentCreated(content); CustomLog.WriteLog("success!!"); } else { CustomLog.WriteLog("不存在此用户!! memberid :" + array[0]); } } else { } return(Json("ok", JsonRequestBehavior.AllowGet)); } else { CustomLog.WriteLog("重复提交" + payModel.Billno); return(new ContentResult() { Content = "重复提交" }); } } catch (Exception ex) { CustomLog.WriteLog(ex.ToString()); return(new ContentResult() { Content = "fail" + temp + ex }); } }
private string GetXml(RenterEntity entity) { var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U if (entity.Deleted) { flag = "D"; } var PoliticalStatus = entity.PoliticalStatus.HasValue ? _dictRepository.GetById(entity.PoliticalStatus.Value) : null; var EduLevel = entity.EduLevel.HasValue ? _dictRepository.GetById(entity.EduLevel.Value) : null; var ResidenceType = entity.ResidenceType.HasValue ? _dictRepository.GetById(entity.ResidenceType.Value) : null; var RegCertType = entity.RegCertType.HasValue ? _dictRepository.GetById(entity.RegCertType.Value) : null; var RentalStatus = entity.RentalStatus.HasValue ? _dictRepository.GetById(entity.RentalStatus.Value) : null; var LivingReason = entity.LivingReason.HasValue ? _dictRepository.GetById(entity.LivingReason.Value) : null; var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); xmlBuilder.Append("<Tpp2Fpp>"); xmlBuilder.Append("<ReqHeader>"); xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName()); xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes)); xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes)); xmlBuilder.Append("</ReqHeader>"); xmlBuilder.Append("<ReqBody>"); xmlBuilder.Append("<personFlow>"); xmlBuilder.AppendFormat("<reluuid>{0}</reluuid>", entity.PersonUUID); xmlBuilder.AppendFormat("<polity>{0}</polity>", PoliticalStatus != null ? PoliticalStatus.DictCode : ""); xmlBuilder.AppendFormat("<education>{0}</education>", EduLevel != null ? EduLevel.DictCode : ""); xmlBuilder.AppendFormat("<comdate>{0}</comdate>", entity.LocalArriveDate.HasValue?entity.LocalArriveDate.Value.ToString("yyyyMMdd") : ""); xmlBuilder.AppendFormat("<pestilence>{0}</pestilence>", entity.EpidemicPrevention); xmlBuilder.AppendFormat("<study>{0}</study>", entity.StudyHistory); xmlBuilder.AppendFormat("<inoculability>{0}</inoculability>", entity.Inoculability); xmlBuilder.AppendFormat("<staycard>{0}</staycard>", entity.StayCard); xmlBuilder.AppendFormat("<workaddress>{0}</workaddress>", entity.WorkingAddress); xmlBuilder.AppendFormat("<marry>{0}</marry>", entity.MarriageStatus); xmlBuilder.AppendFormat("<matename>{0}</matename>", !entity.MateName.IsBlank()?DESHelper.Encrypt3Des(entity.MateName, Constant.DescKeyBytes):""); xmlBuilder.AppendFormat("<mateno>{0}</mateno>", !entity.MateNo.IsBlank() ? DESHelper.Encrypt3Des(entity.MateNo, Constant.DescKeyBytes) : ""); xmlBuilder.AppendFormat("<girs>{0}</girs>", entity.Daughter); xmlBuilder.AppendFormat("<boys>{0}</boys>", entity.Sions); xmlBuilder.AppendFormat("<pregnantno>{0}</pregnantno>", entity.GestationNo); xmlBuilder.AppendFormat("<pregnantdate>{0}</pregnantdate>", entity.PregnancyTestDate.HasValue ? entity.PregnancyTestDate.Value.ToString("yyyyMMdd") : ""); xmlBuilder.AppendFormat("<pregnantcont>{0}</pregnantcont>", entity.ContraceptionCount); xmlBuilder.AppendFormat("<ispregnant>{0}</ispregnant>", entity.IsPregnant); xmlBuilder.AppendFormat("<isshbx>{0}</isshbx>", entity.IsSocialInsur); xmlBuilder.AppendFormat("<isldht>{0}</isldht>", entity.IsLaborContract); xmlBuilder.AppendFormat("<cbdwmc>{0}</cbdwmc>", entity.InsurCompany); xmlBuilder.AppendFormat("<cbdwlxr>{0}</cbdwlxr>", !entity.InsurCompanyContact.IsBlank() ? DESHelper.Encrypt3Des(entity.InsurCompanyContact, Constant.DescKeyBytes) : ""); xmlBuilder.AppendFormat("<cbdwlxdh>{0}</cbdwlxdh>", entity.ICCPhoneNo); xmlBuilder.AppendFormat("<jyqk>{0}</jyqk>", entity.EduHistory); xmlBuilder.AppendFormat("<jdxx>{0}</jdxx>", entity.School); xmlBuilder.AppendFormat("<jzlx>{0}</jzlx>", ResidenceType != null? ResidenceType.DictCode:""); xmlBuilder.AppendFormat("<hjlx>{0}</hjlx>", RegCertType != null? RegCertType.DictCode:""); xmlBuilder.AppendFormat("<jzzj>{0}</jzzj>", entity.RegCert); xmlBuilder.AppendFormat("<zlzt>{0}</zlzt>", RentalStatus != null? RentalStatus.DictCode:""); xmlBuilder.AppendFormat("<livereason>{0}</livereason>", LivingReason != null? LivingReason.DictCode:""); xmlBuilder.AppendFormat("<hzlsh>{0}</hzlsh>", entity.RegCertNo); xmlBuilder.AppendFormat("<remark>{0}</remark>", entity.Remark); xmlBuilder.AppendFormat("<flag>{0}</flag>", flag); xmlBuilder.Append("</personFlow>"); xmlBuilder.Append("</ReqBody>"); xmlBuilder.Append("</Tpp2Fpp>"); return(xmlBuilder.ToString()); }
public ActionResult login(string userName, string userPassword) { try { ResponseModel response = _userLogic.Login(DESHelper.DESDecrypt(userName), DESHelper.DESDecrypt(userPassword)); return(Json(response)); } catch (Exception ex) { return(Json(new { Code = "0009", Msg = "exception" })); } }
public DESKeyVectorProvider(string passphrase) : base(DESHelper.CreateKeyVector(passphrase)) { }
public string GetMessageCode(string userName) { try { DateTime dataTime = DateTime.Now; // 验证请求验证码用户是否存在,若不存在,返回特定字符串给前台 [4/7/2015 ZYQ] var context = DBHelperPool.Instance.GetDbHelper(); var dtUser = context.getDataTableResult(string.Format("select * from PRIVS_USER where NAMEPassword='******'", DESHelper.EncodePassword(userName))); if (dtUser == null || dtUser.Rows.Count == 0) { return(JsonHelper.SerializeObject(new ResultModel(false, "用户名不存在!"))); } string phonenumber = dtUser.Rows[0]["MOBILE"] + ""; //获取验证信息 string checkCode = GenerateRandomNumber(4); SessionHelper.SetCheckCode(checkCode); string smsCode = "【国信司南】短信登录验证码为:" + checkCode + ",此验证码只用于登录您在 中国世界文化遗产监测预警总平台 用户的帐号,验证码提供给他人将导致您的帐号信息被盗,请勿转发。"; //获取短信ID long smsID = dataTime.ToFileTime(); // 验证码存入数据库 [4/7/2015 ZYQ] //softwareSerialNo注册序列号(正式发布需要改为读取配置文件) string softwareSerialNo = "9SDK-EMY-0229-JCWUO"; //key:用户自定义key值,相当于注册时候的密码(正式发布需要改为读取配置文件) string key = "951040"; YMMessageCheck ymMessageCheck = new YMMessageCheck(softwareSerialNo, key); int iresult = ymMessageCheck.Send_sms(phonenumber, smsCode, smsID); return(JsonHelper.SerializeObject(new ResultModel(true, iresult >= 0? "验证发送成功!":"验证发送失败!"))); } catch (Exception ex) { return(JsonHelper.SerializeObject(new ResultModel(false, ex.Message))); } }
private string GetXml(PersonEntity entity) { var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U if (entity.Deleted) { flag = "D"; } var SexDict = _dictRepository.GetById(entity.Sex); var nationDict = _dictRepository.GetById(entity.Nation); var IDDocumentTypeDict = entity.IDDocumentType.HasValue ? _dictRepository.GetById(entity.IDDocumentType.Value) : null; var PersonTypeDict = entity.PersonType.HasValue ? _dictRepository.GetById(entity.PersonType.Value) : null; var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); xmlBuilder.Append("<Tpp2Fpp>"); xmlBuilder.Append("<ReqHeader>"); xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName()); xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes)); xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes)); xmlBuilder.Append("</ReqHeader>"); xmlBuilder.Append("<ReqBody>"); xmlBuilder.Append("<person>"); xmlBuilder.AppendFormat("<uuid>{0}</uuid>", entity.PersonUUID); xmlBuilder.AppendFormat("<cusr>{0}</cusr>", Constant.LkbAccount); xmlBuilder.AppendFormat("<state>{0}</state>", entity.Status); xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss")); xmlBuilder.AppendFormat("<udate>{0}</udate>", entity.UpdateTime.HasValue ? entity.UpdateTime.Value.ToString("yyyyMMddHHmmss") : ""); xmlBuilder.AppendFormat("<name>{0}</name>", DESHelper.Encrypt3Des(entity.PersonName, Constant.DescKeyBytes)); xmlBuilder.AppendFormat("<sex>{0}</sex>", SexDict.DictCode); xmlBuilder.AppendFormat("<nation>{0}</nation>", nationDict.DictCode); xmlBuilder.AppendFormat("<birthday>{0}</birthday>", entity.Birthday.ToString("yyyyMMdd")); xmlBuilder.AppendFormat("<regaddress>{0}</regaddress>", entity.RegAddress); xmlBuilder.AppendFormat("<oregaddress>{0}</oregaddress>", entity.OriginRegAddress); xmlBuilder.AppendFormat("<curaddress>{0}</curaddress>", entity.LivingAddress); xmlBuilder.AppendFormat("<tel>{0}</tel>", !entity.PhoneNo.IsBlank() ? DESHelper.Encrypt3Des(entity.PhoneNo, Constant.DescKeyBytes) : ""); xmlBuilder.AppendFormat("<tel2>{0}</tel2>", !entity.BackUpPhoneNo.IsBlank() ? DESHelper.Encrypt3Des(entity.BackUpPhoneNo, Constant.DescKeyBytes) : ""); xmlBuilder.AppendFormat("<idcard>{0}</idcard>", !entity.IDCardNo.IsBlank() ? DESHelper.Encrypt3Des(entity.IDCardNo, Constant.DescKeyBytes) : ""); xmlBuilder.AppendFormat("<authorgan>{0}</authorgan>", entity.IssueOrg); xmlBuilder.AppendFormat("<avbdate>{0}</avbdate>", entity.ValidFrom.HasValue ? entity.ValidFrom.Value.ToString("yyyyMMdd") : ""); xmlBuilder.AppendFormat("<avedate>{0}</avedate>", entity.ValidTo.HasValue ? entity.ValidTo.Value.ToString("yyyyMMdd") : ""); xmlBuilder.AppendFormat("<photopath>{0}</photopath>", ""); //IDCardPic 证件照片需加密 xmlBuilder.AppendFormat("<houseid>{0}</houseid>", ""); //居住HoseeID xmlBuilder.AppendFormat("<focal>{0}</focal>", entity.IsFocal); xmlBuilder.AppendFormat("<proof>{0}</proof>", IDDocumentTypeDict != null ? IDDocumentTypeDict.DictCode : ""); xmlBuilder.AppendFormat("<islocal>{0}</islocal>", entity.IsLocal); xmlBuilder.AppendFormat("<cardisproving>{0}</cardisproving>", entity.IsIDVerified); xmlBuilder.AppendFormat("<ename>{0}</ename>", entity.EnglishName); xmlBuilder.AppendFormat("<flow>{0}</flow>", PersonTypeDict != null && PersonTypeDict.DictCode == "1" ? "1" : ""); //租客 xmlBuilder.AppendFormat("<family>{0}</family>", PersonTypeDict != null && PersonTypeDict.DictCode == "2" ? "1" : ""); //家属 xmlBuilder.AppendFormat("<owner>{0}</owner>", PersonTypeDict != null && PersonTypeDict.DictCode == "3" ? "1" : ""); //房东 xmlBuilder.AppendFormat("<patrol>{0}</patrol>", PersonTypeDict != null && PersonTypeDict.DictCode == "4" ? "1" : ""); //巡防 xmlBuilder.AppendFormat("<finger1>{0}</finger1>", ""); //指纹一 xmlBuilder.AppendFormat("<finger2>{0}</finger2>", ""); //指纹二 xmlBuilder.AppendFormat("<flag>{0}</flag>", flag); xmlBuilder.Append("</person>"); xmlBuilder.Append("</ReqBody>"); xmlBuilder.Append("</Tpp2Fpp> "); return(xmlBuilder.ToString()); }
/// <summary> /// 读取当前的登录用户 /// </summary> /// <returns></returns> public OperatorModel GetCurrent() { return(LoginProvider == "Cookie" ? DESHelper.Decrypt(WebHelper.GetCookie(LoginUserKey)).ToEntity <OperatorModel>() : DESHelper.Decrypt(WebHelper.GetSession(LoginUserKey).ToString()).ToEntity <OperatorModel>()); }
// Use this for initialization void Awake() { _desHlper = this; }
private string GetCardXml(CardEntity entity, PersonEntity person) { var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U if (entity.Deleted) { flag = "D"; } //根据卡号需要找到房间ID 得到AreaCode及LayerCode var query = from r in _roomRepository.Table join ru in _roomUserRepository.Table on r.RoomUUID equals ru.RoomUUID join uc in _userCardRepository.Table on ru.RoomUserUUID equals uc.RoomUserUUID where uc.CardUUID == entity.CardUUID orderby uc.CreateTime descending select new { r.AreaUUID, ru.FamilyRelation }; var room = query.FirstOrDefault(); if (room == null) { return(string.Empty); } var familyRelationDict = _dictService.GetById(room.FamilyRelation.Value); var area = _areaService.GetById(room.AreaUUID); var type1 = "2"; if (person.PersonType == 272) { type1 = "1"; } var type2 = familyRelationDict?.DictCode ?? "0"; if (type2 == "10") { type2 = "9"; } var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); xmlBuilder.Append("<Tpp2Fpp>"); xmlBuilder.Append("<ReqHeader>"); xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName()); xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes)); xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes)); xmlBuilder.Append("</ReqHeader>"); xmlBuilder.Append("<ReqBody>"); xmlBuilder.Append("<crk>"); xmlBuilder.AppendFormat("<uuid>{0}</uuid>", entity.CardUUID); xmlBuilder.AppendFormat("<crkno>{0}</crkno>", entity.CardNo); xmlBuilder.AppendFormat("<idcode>{0}</idcode>", DESHelper.Encrypt3Des(person.IDCardNo + type1 + type2, Constant.DescKeyBytes)); //身份信息编码( 参见杭州市规范 ) ,护照正常传入,不用编码(需要加密) xmlBuilder.AppendFormat("<addrcode>{0}</addrcode>", ""); //住址信息编码( 参见杭州市规范 ) xmlBuilder.AppendFormat("<udate>{0}</udate>", Constant.FormatDateTime(entity.UpdateTime)); xmlBuilder.AppendFormat("<cuser>{0}</cuser>", Constant.LkbAccount); xmlBuilder.AppendFormat("<state>{0}</state>", "2"); //出入卡状态(0:初始化;1:操作中;2:正常;3:挂失;4:注销) xmlBuilder.AppendFormat("<stime>{0}</stime>", Constant.FormatDateTime(entity.ValidFrom)); xmlBuilder.AppendFormat("<etime>{0}</etime>", Constant.FormatDateTime(entity.ValidTo)); xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss")); xmlBuilder.AppendFormat("<key>{0}</key>", entity.AreaKey); //区域权限因子(二级) (定长为 4位) xmlBuilder.AppendFormat("<mac>{0}</mac>", ""); // xmlBuilder.AppendFormat("<layercode>{0}</layercode>", area.AreaCode); //归属区域层级编码 xmlBuilder.AppendFormat("<crkno4>{0}</crkno4>", entity.CardLast4NO); xmlBuilder.AppendFormat("<key1>{0}</key1>", entity.AreaKey1); //区域权限因子(一级) (定长为 4位) xmlBuilder.AppendFormat("<flag>{0}</flag>", flag); xmlBuilder.Append("</crk>"); xmlBuilder.Append("</ReqBody> "); xmlBuilder.Append("</Tpp2Fpp> "); return(xmlBuilder.ToString()); }
private void InitTables(Container container) { var connFactory = container.Resolve <IDbConnectionFactory>(); var schemaManager = container.Resolve <ISchemaManager>(); using (var db = connFactory.Open()) { //创建和用户表 db.CreateTableIfNotExists <UserInfo>(); //重新创建用户相关表 //var authRepo = (OrmLiteAuthRepository)container.Resolve<IUserAuthRepository>(); //authRepo.InitSchema(); //Create only the missing tables //authRepo.InitApiKeySchema(); //创建表 db.CreateTableIfNotExists <LogInfo>(); //系统日志表 db.CreateTableIfNotExists <UserInfo>(); //用户信息表 db.CreateTableIfNotExists <Role>(); //角色信息表 db.CreateTableIfNotExists <UserRoleInfo>(); //用户角色关系表 db.CreateTableIfNotExists <ADCDInfo>(); //行政区划信息表 db.CreateTableIfNotExists <ADCDDisasterInfo>(); //受灾害影响的行政区划信息表 db.CreateTableIfNotExists <VillageWorkingGroup>(); //村防汛防台工作组 db.CreateTableIfNotExists <VillageGridPersonLiable>(); //村网格责任人 db.CreateTableIfNotExists <VillageTransferPerson>(); //村危险区转移人员 db.CreateTableIfNotExists <Post>(); //岗位管理 db.CreateTableIfNotExists <TownPersonLiable>(); //镇级防汛防台责任人 db.CreateTableIfNotExists <VillagePic>(); //村防汛防台形势图 db.CreateTableIfNotExists <Grid>(); db.CreateTableIfNotExists <DangerZone>(); //危险区转移人员清单 db.CreateTableIfNotExists <Column>(); //栏目管理 db.CreateTableIfNotExists <RoleDetail>(); //角色权限 db.CreateTableIfNotExists <CountryPerson>(); //县级人员 db.CreateTableIfNotExists <Audit>(); //县市审核 db.CreateTableIfNotExists <AuditCounty>(); //县市审核 db.CreateTableIfNotExists <AuditDetails>(); db.CreateTableIfNotExists <AuditCountyDetails>(); db.CreateTableIfNotExists <SmsMessage>();//短信 db.CreateTableIfNotExists <Model.Position.Position>(); db.CreateTableIfNotExists <SpotCheck>(); db.CreateTableIfNotExists <ADCDQRCode>(); //二维码 db.CreateTableIfNotExists <AppLoginVCode>(); // db.CreateTableIfNotExists <AppRecord>(); // db.CreateTableIfNotExists <DatashareUser>(); //数据共享 db.CreateTableIfNotExists <AppGetReg>(); db.CreateTableIfNotExists <AppAlluserView>(); db.CreateTableIfNotExists <CountyTransInfo>(); //县级转移人数数据表 //加字段 schemaManager.AddColumnIfNotExist(typeof(ADCDDisasterInfo), "Year"); //受灾害影响的行政区划信息表---年度字段 schemaManager.AddColumnIfNotExist(typeof(ADCDDisasterInfo), "operateLog"); schemaManager.AddColumnIfNotExist(typeof(ADCDDisasterInfo), "CreateTime"); schemaManager.AddColumnIfNotExist(typeof(ADCDInfo), "operateLog"); schemaManager.AddColumnIfNotExist(typeof(ADCDInfo), "CreateTime"); schemaManager.AddColumnIfNotExist(typeof(VillageWorkingGroup), "EditTime"); schemaManager.AddColumnIfNotExist(typeof(VillageTransferPerson), "Remark");//创建管理员角色及账号 schemaManager.AddColumnIfNotExist(typeof(VillageGridPersonLiable), "EditTime"); schemaManager.AddColumnIfNotExist(typeof(VillageGridPersonLiable), "VillageGridName"); schemaManager.AddColumnIfNotExist(typeof(VillageGridPersonLiable), "GridName"); schemaManager.AddColumnIfNotExist(typeof(UserInfo), "loginNum"); schemaManager.AddColumnIfNotExist(typeof(UserInfo), "UserRealName"); schemaManager.AddColumnIfNotExist(typeof(UserInfo), "Unit"); schemaManager.AddColumnIfNotExist(typeof(UserInfo), "Position"); schemaManager.AddColumnIfNotExist(typeof(Model.Audit.Audit), "AuditNums"); schemaManager.AddColumnIfNotExist(typeof(AuditDetails), "AuditNums"); schemaManager.AddColumnIfNotExist(typeof(VillageGridPersonLiable), "AuditNums"); schemaManager.AddColumnIfNotExist(typeof(VillageGridPersonLiable), "OldData"); schemaManager.AddColumnIfNotExist(typeof(VillageGridPersonLiable), "NewData"); schemaManager.AddColumnIfNotExist(typeof(VillagePic), "AuditNums"); schemaManager.AddColumnIfNotExist(typeof(VillagePic), "OldData"); schemaManager.AddColumnIfNotExist(typeof(VillagePic), "NewData"); schemaManager.AddColumnIfNotExist(typeof(VillageTransferPerson), "AuditNums"); schemaManager.AddColumnIfNotExist(typeof(VillageTransferPerson), "OldData"); schemaManager.AddColumnIfNotExist(typeof(VillageTransferPerson), "NewData"); schemaManager.AddColumnIfNotExist(typeof(VillageTransferPerson), "IfTransfer"); schemaManager.AddColumnIfNotExist(typeof(VillageWorkingGroup), "AuditNums"); schemaManager.AddColumnIfNotExist(typeof(VillageWorkingGroup), "OldData"); schemaManager.AddColumnIfNotExist(typeof(VillageWorkingGroup), "NewData"); schemaManager.AddColumnIfNotExist(typeof(ADCDDisasterInfo), "FXFTRW"); schemaManager.AddColumnIfNotExist(typeof(CountryPerson), "adcd"); schemaManager.AddColumnIfNotExist(typeof(CountryPerson), "OldData"); schemaManager.AddColumnIfNotExist(typeof(CountryPerson), "NewData"); schemaManager.AddColumnIfNotExist(typeof(CountryPerson), "AuditNums"); schemaManager.AddColumnIfNotExist(typeof(TownPersonLiable), "OldData"); schemaManager.AddColumnIfNotExist(typeof(TownPersonLiable), "NewData"); schemaManager.AddColumnIfNotExist(typeof(TownPersonLiable), "AuditNums"); schemaManager.AddColumnIfNotExist(typeof(AuditCounty), "CityAuditTime"); schemaManager.AddColumnIfNotExist(typeof(AppRecord), "adcd"); schemaManager.AddColumnIfNotExist(typeof(AppRecord), "token"); schemaManager.AddColumnIfNotExist(typeof(AppRecord), "postTime"); schemaManager.AddColumnIfNotExist(typeof(AppRecord), "stepItem"); schemaManager.AddColumnIfNotExist(typeof(AppRecord), "valuesItem"); var role = db.Single <Role>(x => x.RoleName == "系统管理员"); if (role == null) { db.Insert(new Role() { RoleName = "系统管理员" }); } var info = db.Single <UserInfo>(x => x.UserName == "admin"); if (info == null) { var id = (int)db.Insert(new UserInfo() { UserName = "******", PassWord = DESHelper.DESEncrypt("abc123"), RealName = "系统管理员", adcd = "330000000000000", isEnable = true }, true); var roleID = db.Single <Role>(x => x.RoleName == "系统管理员").Id; db.Insert(new UserRoleInfo() { UserID = id, RoleID = roleID }); } // var userPosition = db.Select <UserPostionList>(); CachHelper.CacheHelper.SetCache("UserPostionList", userPosition, System.DateTime.Now.AddSeconds(86400000), TimeSpan.Zero); } }
private void mainWeb_LoadCompleted(object sender, NavigationEventArgs e) { if (styleSheetApplied) { return; } var document = mainWeb.Document as HTMLDocument; if (document == null) { return; } //抽取Flash,应用CSS样式 IHTMLElement gameFrame = null; if (DataUtil.Game.gameServer == (int)GameInfo.ServersList.American || DataUtil.Game.gameServer == (int)GameInfo.ServersList.AmericanR18) { gameFrame = document.getElementById("game_frame"); if (gameFrame != null) { mainWeb.Navigate(Convert.ToString(gameFrame.getAttribute("src"))); return; } else { gameFrame = document.getElementById("externalContainer"); } } else { gameFrame = document.getElementById("game_frame"); } if (gameFrame != null) { var target = gameFrame?.document as HTMLDocument; if (target != null) { if (DataUtil.Game.gameServer == (int)GameInfo.ServersList.American || DataUtil.Game.gameServer == (int)GameInfo.ServersList.AmericanR18) { target.createStyleSheet().cssText = DataUtil.Config.sysConfig.userCSSAmerican; } else { target.createStyleSheet().cssText = DataUtil.Config.sysConfig.userCSS; } styleSheetApplied = true; MiscHelper.AddLog("抽取Flash样式应用成功!", MiscHelper.LogType.System); } } //自动登录相关 if (!loginSubmitted && DataUtil.Config.currentAccount.username != null && DataUtil.Config.currentAccount.username.Trim() != "") { IHTMLElement username = null; IHTMLElement password = null; if (DataUtil.Game.gameServer == (int)GameInfo.ServersList.American || DataUtil.Game.gameServer == (int)GameInfo.ServersList.AmericanR18) { username = document.getElementById("s-email"); password = document.getElementById("s-password"); } else { username = document.getElementById("login_id"); password = document.getElementById("password"); } if (username == null || password == null) { return; } DESHelper des = new DESHelper(); username.setAttribute("value", des.Decrypt(DataUtil.Config.currentAccount.username)); password.setAttribute("value", des.Decrypt(DataUtil.Config.currentAccount.password)); if (DataUtil.Config.currentAccount.username.Trim() == "" || DataUtil.Config.currentAccount.password == "") { loginSubmitted = true; return; } //点击登录按钮 if (DataUtil.Game.gameServer == (int)GameInfo.ServersList.American || DataUtil.Game.gameServer == (int)GameInfo.ServersList.AmericanR18) { IHTMLElement autoLogin = document.getElementById("autoLogin"); IHTMLElement login = document.getElementById("login-button"); if (autoLogin != null) { autoLogin.click(); } if (login != null) { login.click(); loginSubmitted = true; } } else { foreach (IHTMLElement element in document.all) { if (Convert.ToString(element.getAttribute("value")) == "ログイン") { element.click(); loginSubmitted = true; break; } } } } }
void OnRequestFinished(HTTPRequest req, HTTPResponse resp) { HttpFinished(); switch (req.State) { // The request finished without any problem. case HTTPRequestStates.Finished: if (resp.StatusCode == 200) { bool isNormal = false; if (resp.Headers.ContainsKey("normal")) { isNormal = "true".Equals(resp.Headers["normal"][0]); } byte[] protoBytes = GZipHelper.Decompress(DESHelper.DecodeBytes(resp.Data, AppContext.GetInstance().getDesKey())); //Debug.Log("isNormal:" + isNormal); if (!isNormal) { SimpleApiResponse response = null; try { response = Serializer.Deserialize <SimpleApiResponse>(new MemoryStream(protoBytes)); Debug.Log("error response:" + response); } catch (Exception) { Debug.LogError("HttpMonoBehaviour SimpleApiResponse parse error"); ShowMessage(ErrorCode.EC_PARSE_DATA_ERROR); } if (response != null) { ShowMessage(response.code); } } else { Callback(protoBytes); } } else { ShowMessage(ErrorCode.EC_SERVER_ERROR); } break; // The request finished with an unexpected error. // The request's Exception property may contain more information about the error. case HTTPRequestStates.Error: Debug.LogError("Request Finished with Error! " + (req.Exception != null ? (req.Exception.Message + "\n" + req.Exception.StackTrace) : "No Exception")); ShowMessage(ErrorCode.EC_NETWORK_UNREACHED); break; // The request aborted, initiated by the user. case HTTPRequestStates.Aborted: Debug.LogWarning("Request Aborted!"); ShowMessage(ErrorCode.EC_NETWORK_UNREACHED); break; // Ceonnecting to the server timed out. case HTTPRequestStates.ConnectionTimedOut: Debug.LogError("Connection Timed Out!"); ShowMessage(ErrorCode.EC_NETWORK_TIMEOUT); break; // The request didn't finished in the given time. case HTTPRequestStates.TimedOut: Debug.LogError("Processing the request Timed Out!"); ShowMessage(ErrorCode.EC_NETWORK_TIMEOUT); break; default: Debug.LogError("Connection Error!"); ShowMessage(ErrorCode.EC_NETWORK_TIMEOUT); break; } }
public ActionResult PaySuccess(string Content, bool isServerCall = false) { string temp = Content; try { Content = DESHelper.DecryptDES(Content); CustomLog.WriteLog(Content); temp = Content; System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); PaymentModel payModel = jss.Deserialize <Models.PaymentModel>(Content); //判断订单是否存在 if (Helpers.UmbPayRecordsHelper.IsExistsBillno(payModel.Billno)) { IContent content = null; IMember currentMember = null; if (payModel.Email.Contains("^_^")) { string[] array = payModel.Email.Split(new string[] { "^_^" }, StringSplitOptions.RemoveEmptyEntries); currentMember = Services.MemberService.GetByEmail(array[0]); content = Services.ContentService.GetById(int.Parse(array[1])); if (currentMember != null) { content.SetValue("username", currentMember.Name); content.Name = currentMember.Email; content.SetValue("email", currentMember.Email); content.SetValue("mobilePhone", currentMember.GetValue <string>("tel")); content.SetValue("memberPicker", currentMember.Id.ToString()); //保存member的信息 double assets = currentMember.GetValue <double>("assets"); double fundAccount = currentMember.GetValue <double>("fundAccount"); currentMember.SetValue("assets", "0"); currentMember.SetValue("fundAccount", (fundAccount + payModel.Amount).ToString("f2")); Services.MemberService.Save(currentMember); } //cny content.SetValue("amountCny", payModel.Amount.ToString()); content.SetValue("rechargeDateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); content.SetValue("payBillno", payModel.Billno); content.SetValue("amountCny", payModel.Amount.ToString()); content.SetValue("rechargeDateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); content.SetValue("isdeposit", true); IContent product = Services.ContentService.GetById(content.GetValue <int>("buyproduct")); int months = product.GetValue <int>("cycle"); content.SetValue("expirationtime", DateTime.Now.AddMonths(months).ToString("yyyy-MM-dd HH:mm:ss")); Services.ContentService.Save(content); //触发创建事件 EventHandlers.CustomRaiseEvent.RaiseContentCreated(content); //赠送5000元定期宝一月期 System.Threading.Tasks.Task.Factory.StartNew((ser) => { try { ServiceContext sc = ser as ServiceContext; int num = payModel.Amount >= 5000 ? 5000 : 1000; IContentType ct = sc.ContentTypeService.GetContentType("PayRecords"); IContent createContent = sc.ContentService.CreateContent(currentMember.Name + "赠送定期宝", ct.Id, "PayRecords"); createContent.SetValue("username", currentMember.Name); createContent.SetValue("email", currentMember.Username); createContent.SetValue("amountCny", num); createContent.SetValue("mobilePhone", currentMember.GetValue <string>("tel")); createContent.SetValue("rechargeDateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); createContent.SetValue("expirationtime", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss")); createContent.SetValue("memberPicker", currentMember.Id); createContent.SetValue("payBillno", payModel.Billno + ":购买产品赠送的定期宝"); createContent.SetValue("isdeposit", true); createContent.SetValue("isexpired", false); createContent.SetValue("buyproduct", 2337); createContent.SetValue("isGive", true); sc.ContentService.Save(createContent); EventHandlers.CustomRaiseEvent.RaiseContentCreated(createContent); CustomLog.WriteLog("赠送成功!"); } catch (Exception ex) { CustomLog.WriteLog(ex.ToString()); } }, Services); CustomLog.WriteLog("success!!"); return(Json("ok", JsonRequestBehavior.AllowGet)); } else { try { //充值到余额 IContentType ct = Services.ContentTypeService.GetContentType("DepositRecords"); IContent depositcontent = Services.ContentService.CreateContent(payModel.Email, ct.Id, "DepositRecords"); currentMember = Services.MemberService.GetByEmail(payModel.Email); depositcontent.SetValue("username", payModel.Email); depositcontent.Name = payModel.Email; depositcontent.SetValue("email", payModel.Email); depositcontent.SetValue("mobilePhone", payModel.Phone); depositcontent.SetValue("amountCny", payModel.Amount.ToString()); depositcontent.SetValue("payBillno", payModel.Billno); depositcontent.SetValue("memberPicker", currentMember.Id.ToString()); decimal assets = currentMember.GetValue <decimal>("okassets"); currentMember.SetValue("okassets", (assets + (decimal)payModel.Amount).ToString()); Services.ContentService.Save(depositcontent); Services.MemberService.Save(currentMember); return(Json("ok", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { CustomLog.WriteLog("1:" + ex.StackTrace); CustomLog.WriteLog("2:" + ex.ToString()); return(Json("ok", JsonRequestBehavior.AllowGet)); } } } else { CustomLog.WriteLog("重复提交" + payModel.Billno); return(new ContentResult() { Content = "重复提交" }); } } catch (Exception ex) { CustomLog.WriteLog(ex.ToString()); return(new ContentResult() { Content = "fail" + temp + ex }); } }
public void SendBytes(byte[] buffer) { webSocket.Send(DESHelper.EncodeBytes(GZipHelper.compress(buffer), AppContext.GetInstance().getDesKey())); }