public static void WriteAll(AllEntity all, CommonConfig config, Action <string> callback, Action <string> commandCallback) { try { WriteRealTime(all.Address, all.EquipmentDataTime, commandCallback); callback("写入时间成功"); } catch (Exception ex) { log.Error(ex); callback("写入时间失败"); } try { WriteOutDate(all.Address, all.OutDate, commandCallback); callback("写入出厂日期成功"); } catch (Exception ex) { log.Error(ex); callback("写入出厂日期失败"); } try { NormalInstruction.WriteGasCount((short)all.GasList.Count, all.Address, config, commandCallback); callback("写入气体个数成功"); foreach (var gas in all.GasList) { try { GasInstruction.WriteGas(gas, all.Address, commandCallback); callback(string.Format("写入气体{0}成功", gas.GasID)); } catch (Exception ex) { log.Error(ex); callback(string.Format("写入气体{0}失败", gas.GasID)); } } } catch (Exception ex) { log.Error(ex); callback("写入气体个数失败"); } try { NormalInstruction.WriteWeatherCount((short)all.WeatherList.Count, all.Address, config, commandCallback); WeatherInstruction.WriteWeather(all.WeatherList, all.Address, commandCallback); callback("写入气象参数成功"); } catch (Exception ex) { log.Error(ex); callback("写入气象参数失败"); } try { NormalInstruction.WriteNormal(all.Normal, all.Address, commandCallback); callback("写入通用参数成功"); } catch (Exception ex) { log.Error(ex); callback("写入通用参数失败"); } try { SerialInstruction.WriteSerialParam(all.Serial, all.Address, commandCallback); callback("写入串口参数成功"); } catch (Exception ex) { log.Error(ex); callback("写入串口参数失败"); } }
public Executer(CommonConfig config, BFCommandConfig commandConfig) : base(config, commandConfig) { }
public void Update(CommonConfig model) { _repo.Update(model); }
public RefundOrderResponse Refund(string orderid, string memberid) { RefundOrderInfo info = new RefundOrderInfo() { orderId = orderid }; string mid = memberid; if (string.IsNullOrWhiteSpace(mid)) { mid = DefaultMemberId; } var password = GetPassword(mid); var datetime = DateTime.Now; var request = new RefundOrderRequest { dataMap = info, sign = "",//此接口不用签名验证 reqTime = datetime.ToString(DateTimeFormat) }; var jSetting = new JsonSerializerSettings(); jSetting.NullValueHandling = NullValueHandling.Ignore; var content = JsonConvert.SerializeObject(request, jSetting); _log.Debug("Post data:" + content); var config = new CommonConfig(null); var req = (HttpWebRequest)WebRequest.Create(config.JavaOrder_Uri + "orderStatusRefund"); req.Method = "POST"; req.ContentType = "Application/Json"; req.Credentials = CredentialCache.DefaultCredentials; req.Timeout = 300000; // 如果服务器返回错误,他还会继续再去请求,不会使用之前的错误数据,做返回数据 //req.ServicePoint.Expect100Continue = false; WriteRequestData(req, content); var response = req.GetResponse(); if (response == null) { throw new Exception("请求失败!"); } var stream = response.GetResponseStream(); if (stream == null) { throw new Exception("请求Stream为空!"); } var sr = new StreamReader(stream, Encoding.UTF8); var retXml = sr.ReadToEnd(); sr.Close(); _log.Debug(retXml); var obj = JsonConvert.DeserializeObject <RefundOrderResponse>(retXml); if (obj.respCode != "0") { throw new ApplicationException(obj.respMsg); } return(obj); }
public DeepAiService(IOptionsSnapshot <CommonConfig> commonConfig) { _commonConfig = commonConfig.Value; }
public ActionResult Edit(EMP_Employee eMP_Employee) { if (eMP_Employee.EmployeeID > 0) { if (eMP_Employee.Remarks == null || eMP_Employee.Remarks == "") { ViewBag.BankID = new SelectList(db.ACC_Bank, "BankID", "BankName", eMP_Employee.BankID); ViewBag.DepartmentID = new SelectList(db.EMP_Department, "DepartmentID", "DepartmentName", eMP_Employee.DepartmentID); ViewBag.DesignationID = new SelectList(db.EMP_Designation, "DesignationID", "Designation", eMP_Employee.DesignationID); ViewBag.CityID = new SelectList(db.LOC_City, "CityID", "CityName", eMP_Employee.CityID); ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", eMP_Employee.CompanyID); ViewBag.FinYearID = new SelectList(db.SYS_FinYear, "FinYearID", "FinYear", eMP_Employee.FinYearID); ViewBag.StateID = new SelectList(db.LOC_State, "StateID", "StateName", eMP_Employee.StateID); ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", eMP_Employee.UserID); ModelState.AddModelError("", "Enter Remarks"); return(View(eMP_Employee)); } } if (eMP_Employee.EmployeeName != null && eMP_Employee.Address != null) { if (!string.IsNullOrEmpty(eMP_Employee.EmployeeName)) { if (db.EMP_Employee.Where(I => I.EmployeeName == eMP_Employee.EmployeeName && I.Address == eMP_Employee.Address).Count() > 0) { var oldemployee = db.EMP_Employee.Where(I => I.EmployeeName == eMP_Employee.EmployeeName && I.Address == eMP_Employee.Address).FirstOrDefault(); if (oldemployee.EmployeeID != eMP_Employee.EmployeeID) { ModelState.AddModelError("EmployeeNameDuplicate", eMP_Employee.EmployeeName + " Already added."); ViewBag.BankID = new SelectList(db.ACC_Bank, "BankID", "BankName", eMP_Employee.BankID); ViewBag.DepartmentID = new SelectList(db.EMP_Department, "DepartmentID", "DepartmentName", eMP_Employee.DepartmentID); ViewBag.DesignationID = new SelectList(db.EMP_Designation, "DesignationID", "Designation", eMP_Employee.DesignationID); ViewBag.CityID = new SelectList(db.LOC_City, "CityID", "CityName", eMP_Employee.CityID); ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", eMP_Employee.CompanyID); ViewBag.FinYearID = new SelectList(db.SYS_FinYear, "FinYearID", "FinYear", eMP_Employee.FinYearID); ViewBag.StateID = new SelectList(db.LOC_State, "StateID", "StateName", eMP_Employee.StateID); ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", eMP_Employee.UserID); return(View(eMP_Employee)); } } } } //EMP_Employee OldEMP_Employee = db.EMP_Employee.Find(eMP_Employee.EmployeeID); if (ModelState.IsValid) { eMP_Employee.Modified = Convert.ToDateTime(DateTime.Now); eMP_Employee.CompanyID = 4; eMP_Employee.FinYearID = CommonConfig.GetFinYearID(); HttpPostedFileBase photoProof = Request.Files["IDProofPhotoPath"]; if (photoProof != null && photoProof.FileName != "") { //create path to store in database eMP_Employee.IDProofPhotoPath = "~/Images/" + photoProof.FileName; //store image in folder photoProof.SaveAs(Server.MapPath("~/Images") + "/" + photoProof.FileName); } else { //eMP_Employee.IDProofPhotoPath = OldEMP_Employee.IDProofPhotoPath; } HttpPostedFileBase photo = Request.Files["PhotoPath"]; if (photo != null && photo.FileName != "") { //create path to store in database eMP_Employee.PhotoPath = "~/Images/" + photo.FileName; //store image in folder photo.SaveAs(Server.MapPath("~/Images") + "/" + photo.FileName); } else { //eMP_Employee.PhotoPath = OldEMP_Employee.PhotoPath; } if (Session["UserID"] != null) { eMP_Employee.UserID = Convert.ToInt16(Session["UserID"].ToString()); } if (eMP_Employee.EmployeeID > 0) { db.Entry(eMP_Employee).State = EntityState.Modified; eMP_Employee.Modified = Convert.ToDateTime(DateTime.Now); EMP_Employee _OldEMP_Employee = db.EMP_Employee.Find(eMP_Employee.EmployeeID); eMP_Employee.PhotoPath = _OldEMP_Employee.PhotoPath; eMP_Employee.IDProofPhotoPath = _OldEMP_Employee.IDProofPhotoPath; } else { eMP_Employee.Created = DateTime.Now; eMP_Employee.Modified = DateTime.Now; db.EMP_Employee.Add(eMP_Employee); } db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BankID = new SelectList(db.ACC_Bank, "BankID", "BankName", eMP_Employee.BankID); ViewBag.DepartmentID = new SelectList(db.EMP_Department, "DepartmentID", "DepartmentName", eMP_Employee.DepartmentID); ViewBag.DesignationID = new SelectList(db.EMP_Designation, "DesignationID", "Designation", eMP_Employee.DesignationID); ViewBag.CityID = new SelectList(db.LOC_City, "CityID", "CityName", eMP_Employee.CityID); ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", eMP_Employee.CompanyID); ViewBag.FinYearID = new SelectList(db.SYS_FinYear, "FinYearID", "FinYear", eMP_Employee.FinYearID); ViewBag.StateID = new SelectList(db.LOC_State, "StateID", "StateName", eMP_Employee.StateID); ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", eMP_Employee.UserID); return(View(eMP_Employee)); }
public static GasEntity ReadGas(int gasId, byte address, CommonConfig config, Action <string> callback) { byte[] sendb = Command.GetReadSendByte(address, (byte)gasId, 0x10, 42); callback(string.Format("W: {0}", CommandUnits.ByteToHexStr(sendb))); byte[] rbytes = PLAASerialPort.Read(sendb); callback(string.Format("R: {0}", CommandUnits.ByteToHexStr(rbytes))); GasEntity gas = new GasEntity(); gas.GasID = gasId; Array.Reverse(rbytes, 3, 2); gas.GasName.Value = BitConverter.ToInt16(rbytes, 3); gas.GasName.Name = config.GasName.FirstOrDefault(c => c.Value == gas.GasName.Value).Key; Array.Reverse(rbytes, 5, 2); gas.GasUnit.Value = BitConverter.ToInt16(rbytes, 5); gas.GasUnit.Name = config.GasUnit.FirstOrDefault(c => c.Value == gas.GasUnit.Value).Key; Array.Reverse(rbytes, 7, 2); gas.GasPoint.Value = BitConverter.ToInt16(rbytes, 7); gas.GasPoint.Name = config.Point.FirstOrDefault(c => c.Value == gas.GasPoint.Value).Key; Array.Reverse(rbytes, 9, 2); Array.Reverse(rbytes, 11, 2); gas.GasRang = BitConverter.ToSingle(rbytes, 9); List <byte> byteTemp = new List <byte>(); for (int i = 13; i < 13 + 12;) { if (rbytes[i + 1] != 0x00) { byteTemp.Add(rbytes[i + 1]); } i += 2; } // to do test gas.Factor = ASCIIEncoding.ASCII.GetString(byteTemp.ToArray()); gas.IfGasAlarm = BitConverter.ToBoolean(rbytes, 26); Array.Reverse(rbytes, 27, 2); gas.AlertModel.Value = BitConverter.ToInt16(rbytes, 27); gas.AlertModel.Name = config.AlertModel.FirstOrDefault(c => c.Value == gas.AlertModel.Value).Key; Array.Reverse(rbytes, 29, 2); Array.Reverse(rbytes, 31, 2); gas.GasA1 = BitConverter.ToSingle(rbytes, 29); Array.Reverse(rbytes, 33, 2); Array.Reverse(rbytes, 35, 2); gas.GasA2 = BitConverter.ToSingle(rbytes, 33); Array.Reverse(rbytes, 45, 2); Array.Reverse(rbytes, 47, 2); gas.Compensation = BitConverter.ToSingle(rbytes, 45); Array.Reverse(rbytes, 49, 2); Array.Reverse(rbytes, 51, 2); gas.Show = BitConverter.ToSingle(rbytes, 49); gas.CheckNum = (byte)(rbytes[54] < 2 ? 2 : (rbytes[54] > 4 ? 4 : rbytes[54])); gas.IfTwo = gas.CheckNum >= 3; gas.IfThree = gas.CheckNum >= 4; Array.Reverse(rbytes, 55, 2); Array.Reverse(rbytes, 57, 2); gas.ZeroAD = BitConverter.ToInt32(rbytes, 55); Array.Reverse(rbytes, 59, 2); Array.Reverse(rbytes, 61, 2); gas.ZeroChroma = BitConverter.ToSingle(rbytes, 59); Array.Reverse(rbytes, 63, 2); Array.Reverse(rbytes, 65, 2); gas.OneAD = BitConverter.ToInt32(rbytes, 63); Array.Reverse(rbytes, 67, 2); Array.Reverse(rbytes, 69, 2); gas.OneChroma = BitConverter.ToSingle(rbytes, 67); Array.Reverse(rbytes, 71, 2); Array.Reverse(rbytes, 73, 2); gas.TwoAD = BitConverter.ToInt32(rbytes, 71); Array.Reverse(rbytes, 75, 2); Array.Reverse(rbytes, 77, 2); gas.TwoChroma = BitConverter.ToSingle(rbytes, 75); Array.Reverse(rbytes, 79, 2); Array.Reverse(rbytes, 81, 2); gas.ThreeAD = BitConverter.ToInt32(rbytes, 79); Array.Reverse(rbytes, 83, 2); Array.Reverse(rbytes, 85, 2); gas.ThreeChroma = BitConverter.ToSingle(rbytes, 83); GasEntity current = ReadCurrent(gasId, address, config, callback); gas.CurrentAD = current.CurrentAD; gas.CurrentChroma = current.CurrentChroma; gas.AlertStatus = current.AlertStatus; return(gas); }
public BrainfxxkExecuter(CommonConfig config, BFCommandConfig commandConfig) : base(config, commandConfig) { }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { _appSettings = new AppSettings { RebuildDatabase = bool.Parse(Configuration["rebuildDatabase"]) }; services.AddDbContext <IlluminateLmsContext>(options => { options.UseMySql(Configuration["ConnectionString"]); options.UseOpenIddict(); }); services.AddIdentity <ApplicationUser, ApplicationRole>() .AddEntityFrameworkStores <IlluminateLmsContext>() .AddDefaultTokenProviders() .AddRoleManager <RoleManager <ApplicationRole> >() .AddSignInManager <SignInManager <ApplicationUser> >(); // Configure Identity options and password complexity here services.Configure <IdentityOptions>(options => { // Password settings options.Password.RequireDigit = false; options.Password.RequiredLength = 6; options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = false; options.Password.RequireLowercase = false; // User settings options.User.RequireUniqueEmail = true; options.ClaimsIdentity.UserNameClaimType = OpenIdConnectConstants.Claims.Name; options.ClaimsIdentity.UserIdClaimType = OpenIdConnectConstants.Claims.Subject; options.ClaimsIdentity.RoleClaimType = OpenIdConnectConstants.Claims.Role; }); // Register the OpenIddict services. services.AddOpenIddict(options => { options.AddEntityFrameworkCoreStores <IlluminateLmsContext>(); options.AddMvcBinders(); options.EnableTokenEndpoint("/api/auth/token"); options.AllowPasswordFlow(); options.AllowRefreshTokenFlow(); options.DisableHttpsRequirement(); options.UseJsonWebTokens(); options.AddDevelopmentSigningCertificate(); }); services.AddAuthentication(options => { options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { options.Authority = "http://localhost:5001"; options.RequireHttpsMetadata = false; options.SaveToken = true; options.Events = new JwtBearerEvents { OnTokenValidated = context => { // Add the access_token as a claim, as we may actually need it var token = context.SecurityToken as JwtSecurityToken; if (!(context.Principal.Identity is ClaimsIdentity identity)) { return(Task.CompletedTask); } identity.AddClaim(new Claim("access_token", token.RawData)); return(Task.CompletedTask); } }; options.TokenValidationParameters = new TokenValidationParameters { ValidateAudience = false, ValidateIssuer = false, ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("thisisasecreteforauth")), ValidateLifetime = true, ClockSkew = TimeSpan.FromMinutes(5), NameClaimType = CustomClaimTypes.Name, RoleClaimType = CustomClaimTypes.Role }; }); // Add cors services.AddCors(); // Add mvc services.AddMvc(options => { options.Filters.Add(typeof(ApiExceptionFilter)); }).AddJsonOptions(options => { options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; }); services.AddSwaggerGen(c => { c.AddSecurityDefinition("BearerAuth", new ApiKeyScheme { Name = "Authorization", Description = "Login with your bearer authentication token. e.g. Bearer <auth-token>", In = "header", Type = "apiKey" }); c.SwaggerDoc("v1", new Info { Title = "IlluminateLms API", Version = "v1" }); }); ConfigPolicies.Config(services); services.AddAutoMapper(); services.AddScoped <TicketHelper>(); CommonConfig.ConfigServices(services); Business.Helpers.Policies.Config(services); // DB Creation and Seeding services.AddTransient <IIlluminateLmsDatabaseInitalizer, IlluminateLmsDatabaseInitalizer>(); }
/// <summary> /// Apply the Actor Configuration. /// </summary> /// <param name="commonConfig">Common Configuration.</param> /// <param name="peerToPeerConfigCollection">Peer to Peer Configuration collection.</param> protected override void ApplyConfig(CommonConfig commonConfig, BasePeerToPeerConfigCollection peerToPeerConfigCollection) { // for receiving Print Request with Presentation LUT [RAD-23] AddDicomServer(DicomServerTypeEnum.DicomPrintServer, ActorTypeEnum.PrintComposer, commonConfig, peerToPeerConfigCollection); }
public static List <WeatherEntity> WriteWeatherCount(short count, byte address, CommonConfig config, Action <string> callback) { byte[] sendb = Command.GetWiteSendByte(address, 0x00, 0x21, BitConverter.GetBytes(count).Reverse().ToArray()); callback(string.Format("W: {0}", CommandUnits.ByteToHexStr(sendb))); PLAASerialPort.Write(sendb); return(WeatherInstruction.ReadWeather(address, config, callback)); }
public async void InitConfig() { await RunCommandAsync(() => isBusy, async() => { await Task.Factory.StartNew(() => { try { if (!File.Exists(Control + "/eventMacros.txt")) { StringBuilder EventMacro = new StringBuilder(); StringBuilder Macro = new StringBuilder(); foreach (var l in Directory.GetDirectories(@"scripts\add-ons")) { if (!l.Contains("utilities")) { EventMacro.AppendLine("#~" + l.Split('\\')[l.Split('\\').Count() - 1]); } foreach (var f in Directory.GetFiles(l)) { EventMacro.AppendLine(@"#include ..\..\" + f); } foreach (var lx in Directory.GetDirectories(l)) { if (lx.Contains("macros")) { Macro.AppendLine("#~" + lx.Split('\\')[lx.Split('\\').Count() - 1]); foreach (var fx in Directory.GetFiles(lx)) { Macro.AppendLine(@"#include ..\..\" + fx); } } else { EventMacro.AppendLine("#~" + lx.Split('\\')[lx.Split('\\').Count() - 1]); foreach (var fx in Directory.GetFiles(lx)) { EventMacro.AppendLine(@"#include ..\..\" + fx); } } } } Console.WriteLine(Macro.ToString()); using (var writer = new System.IO.StreamWriter(Control + "/eventMacros.txt")) { writer.Write(EventMacro.ToString()); } using (var writer = new System.IO.StreamWriter(Control + "/macros.txt")) { writer.Write(Macro.ToString()); } } Addons = new ObservableCollection <AddonListViewModel>(); System.IO.StreamReader emacro = new System.IO.StreamReader(Control + "/eventMacros.txt"); string Macroline; int ecounter = 0; while ((Macroline = emacro.ReadLine()) != null) { if (Macroline.Contains("#~")) { var title = Macroline.Split('~'); Addons.Add(new AddonListViewModel(title[1])); } else if ((Macroline.Contains("#") || Macroline.Contains("!")) && !Macroline.Contains("~")) { var x = Macroline.Split('\\'); var eventmacros = new AddonViewModel(x[x.Count() - 1].Split('.')[0], Macroline.Contains('#') ? false : true, ecounter, false); eventmacros.PropertyChanged += EditAddonAsync; Addons[Addons.Count() - 1].Addonitem.Add(eventmacros); } ecounter++; } int counter = 0; System.IO.StreamReader macro = new System.IO.StreamReader(Control + "/macros.txt"); while ((Macroline = macro.ReadLine()) != null) { if (Macroline.Contains("#~")) { var title = Macroline.Split('~'); Addons.Add(new AddonListViewModel(title[1])); } else if ((Macroline.Contains("#") || Macroline.Contains("!")) && !Macroline.Contains("~")) { var x = Macroline.Split('\\'); var eventmacros = new AddonViewModel(x[x.Count() - 1].Split('.')[0], Macroline.Contains('#') ? false : true, counter, true); eventmacros.PropertyChanged += EditAddonAsync; Addons[Addons.Count() - 1].Addonitem.Add(eventmacros); } counter++; } } catch (Exception) { } Configs = new List <ConfigKeyViewModel>(); int index = 0; string line; System.IO.StreamReader file = new System.IO.StreamReader(Control + "/config.txt"); bool inBracket = false; while ((line = file.ReadLine()) != null) { if (!line.Contains("#") && !string.IsNullOrEmpty(line)) { if (!line.Contains("{") && !line.Contains("}") && !inBracket) { var key = line.Split(' '); if (CommonConfig.Contains(key[0])) { try { var conf = new ConfigKeyViewModel(key[0], key[1], index); conf.PropertyChanged += EditConfigAsync; Configs.Add(conf); } catch { var conf = new ConfigKeyViewModel(key[0], "", index); conf.PropertyChanged += EditConfigAsync; Configs.Add(conf); } } //System.Console.WriteLine(line); } else if (line.Contains("{")) { inBracket = true; } else if (line.Contains("}")) { inBracket = false; } } index++; } }); }); }
//数据库操作成功 private void OperatorSuccess(UserInfo userInfo, UserGame userGame, List <UserInfo_Game.UserBuff> userProps, bool isRealName, JObject responseData) { UserGameJsonObject userGameJsonObject = new UserGameJsonObject(userGame.AllGameCount, userGame.WinCount, userGame.RunCount, userGame.MeiliZhi, userGame.XianxianJDPrimary, userGame.XianxianJDMiddle, userGame.XianxianJDHigh, userGame.XianxianCDPrimary, userGame.XianxianCDMiddle, userGame.XianxianCDHigh); responseData.Add(MyCommon.CODE, (int)Consts.Code.Code_OK); responseData.Add(MyCommon.NAME, userInfo.NickName); responseData.Add(MyCommon.PHONE, userInfo.Phone); responseData.Add(MyCommon.GOLD, userInfo.Gold); responseData.Add("medal", userInfo.Medel); responseData.Add("isRealName", isRealName); responseData.Add("recharge_vip", userInfo.RechargeVip); responseData.Add(MyCommon.YUANBAO, userInfo.YuanBao); responseData.Add(MyCommon.HEAD, userInfo.Head); responseData.Add(MyCommon.GAMEDATA, JsonConvert.SerializeObject(userGameJsonObject)); responseData.Add("BuffData", JsonConvert.SerializeObject(userProps)); //得到转盘次数 var turnTableJsonObject = new TurnTableJsonObject(); turnTableJsonObject.freeCount = userInfo.freeCount; turnTableJsonObject.huizhangCount = userInfo.huizhangCount; turnTableJsonObject.luckyValue = userInfo.luckyValue; responseData.Add("turntableData", JsonConvert.SerializeObject(turnTableJsonObject)); //获取用户二级密码 User user = NHibernateHelper.userManager.GetByUid(userInfo.Uid); if (user != null) { if (string.IsNullOrWhiteSpace(user.Secondpassword)) { responseData.Add("isSetSecondPsw", false); } else { responseData.Add("isSetSecondPsw", true); } } else { MySqlService.log.Warn($"获取用户失败:{userInfo.Uid}"); } //获取用户充值次数 var userRecharges = NHibernateHelper.userRechargeManager.GetListByUid(userInfo.Uid); responseData.Add("userRecharge", JsonConvert.SerializeObject(userRecharges)); CommonConfig config = ModelFactory.CreateConfig(userInfo.Uid); if (config.first_recharge_gift == 0) { responseData.Add("hasShouChong", false); } else { responseData.Add("hasShouChong", true); } if (string.IsNullOrWhiteSpace(userInfo.ExtendCode)) { while (true) { userInfo.ExtendCode = RandomCharHelper.GetRandomNum(6); if (NHibernateHelper.userInfoManager.Update(userInfo)) { break; } } } responseData.Add("myTuiGuangCode", userInfo.ExtendCode); List <UserInfo> allUserInfo = MySqlManager <UserInfo> .Instance.GetAllUserInfo(); int goldRank = 0; int medelRank = 0; allUserInfo = allUserInfo.OrderByDescending(u => u.Gold).ToList(); for (int i = 0; i < allUserInfo.Count; i++) { if (allUserInfo[i].Uid == userInfo.Uid) { goldRank = i + 1; break; } } allUserInfo = allUserInfo.OrderByDescending(u => u.Medel).ToList(); for (int i = 0; i < allUserInfo.Count; i++) { if (allUserInfo[i].Uid == userInfo.Uid) { medelRank = i + 1; break; } } responseData.Add("goldRank", goldRank); responseData.Add("medelRank", medelRank); }
/// <summary> /// In this method we receive data that was defined in B2B_app application and required for websites and web service investigation /// </summary> public void GetDataFromUser() { string data = RemoteSave.GetContentFromFtp("conf", RemoteSave.State.INTERMEDIATE); var strArr = data.Split(Environment.NewLine.ToCharArray()); List <string> condData = strArr.Where(s => !String.IsNullOrEmpty(s)).ToList(); var temp = condData[0]; var temp2 = temp.Split(';'); foreach (string s in temp2.Where(s => !String.IsNullOrEmpty(s))) { SiteNames.Add(s); } temp = condData[1]; temp2 = temp.Split(';'); bool flag; foreach (string s in temp2) { if (!String.IsNullOrEmpty(s)) { var temp3 = s.Split('-'); Route route = new Route(); flag = true; foreach (string s1 in temp3.Where(s1 => !String.IsNullOrEmpty(s1))) { if (flag) { route.Departure = s1; flag = false; } else { if (s1 != '-'.ToString()) { route.Arrival = s1; } } } FlightLegs.Add(route); } } temp = condData[2]; temp2 = temp.Split(';'); flag = true; foreach (string s in temp2) { if (!String.IsNullOrEmpty(s)) { if (flag) { // 2016-07-20T15:00:00Z DepartureDate = s; flag = false; } else { if (s != ';'.ToString()) { ArrivalDate = s; } } } } temp = condData[3]; temp2 = temp.Split(';'); ConfigFilePath = temp2[0]; Config = new CommonConfig(); Config = _configuration.GetConfiguration(ConfigFilePath); foreach (string siteName in SiteNames) { WebsiteDomList.Add(RemoteSave.GetContentFromFtp(siteName, RemoteSave.State.TEMPLATE)); } TemplateConfigModel template = new TemplateConfigModel(); foreach (string s in SiteNames) { WebsiteTemplates.Add(template.GetConfiguration(s)); } }
private bool PhoneFeeRecharge(string uid, int propId, string phone, int num) { var prop = NHibernateHelper.propManager.GetProp(propId); string amount = "0"; if (propId == 111) { amount = 1 * num + ""; } else if (propId == 112) { amount = "5"; } else if (propId == 113) { amount = "10"; } else { return(false); } uid = uid.Substring(1, uid.Length - 1); string phoneFeeRecharge = HttpUtil.PhoneFeeRecharge(uid, prop.prop_name, amount, phone, propId + "", "1"); uid = "6" + uid; MySqlService.log.Info(phoneFeeRecharge); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(phoneFeeRecharge); XmlNodeList nodeList = xmlDoc.ChildNodes; foreach (XmlNode node in nodeList) { string nodeValue = node.InnerText; if ("string".Equals(node.Name)) { MySqlService.log.Info(nodeValue); JObject result = JObject.Parse(nodeValue); var Code = (int)result.GetValue("Code"); var Message = (string)result.GetValue("Message"); var Orderid = (string)result.GetValue("Orderid"); MySqlService.log.Info("Code:" + Code + " Message:" + Message + " Orderid:" + Orderid); string format = $"给{phone}充值了{amount}元话费,订单号:{Orderid}"; if (Code == 0) { CommonConfig commonConfig = NHibernateHelper.commonConfigManager.GetByUid(uid); if (commonConfig == null) { commonConfig = ModelFactory.CreateConfig(uid); } //限制充值数量 commonConfig.recharge_phonefee_amount += Convert.ToInt32(amount); NHibernateHelper.commonConfigManager.Update(commonConfig); LogUtil.Log(uid, MyCommon.OpType.RECHARGE_PHONEFEE, format); return(true); } } } return(false); }
public ReadKey(CommonConfig commonConfig, XLWorkbook workbook) : base(commonConfig, workbook) { }
public void LoadConfig() { AnnouncementConfigData = new AnnouncementConfig(); BadgeAttrConfigData = new BadgeAttrConfig(); ConstStringConfigData = new ConstStringConfig(); CommonConfig = new CommonConfig(); AttrNameConfigData = new AttrNameConfig(); RoleBaseConfigData2 = new BaseDataConfig2(); AttrDataConfigData = new AttrDataConfig(); TeamLevelConfigData = new TeamLevelConfig(); RoleLevelConfigData = new RoleLevelConfig(); NPCConfigData = new NPCDataConfig(); SkillConfig = new SkillConfig(); GoodsConfigData = new GoodsConfig(); StoreGoodsConfigData = new StoreGoodsConfig(); BaseDataBuyConfigData = new BaseDataBuyConfig(); TaskConfigData = new TaskDataConfig(); AwardPackConfigData = new AwardPackDataConfig(); PractiseConfig = new PractiseConfig(); PracticePveConfig = new PracticePveConfig(); PractiseStepConfig = new PractiseStepConfig(); GameModeConfig = new GameModeConfig(); TrainingConfig = new TrainingConfig(); TattooConfig = new TattooConfig(); EquipmentConfigData = new EquipmentConfig(); TourConfig = new TourConfig(); GuideConfig = new GuideConfig(); FunctionConditionConfig = new FunctionConditionConfig(); RoleShapeConfig = new RoleShapeConfig(); FashionConfig = new FashionConfig(); FashionShopConfig = new FashionShopConfig(); VipPrivilegeConfig = new VipPrivilegeConfig(); pushConfig = new PushConfig(); presentHpConfigData = new PresentHpConfig(); LotteryConfig = new LotteryConfig(); starAttrConfig = new StarAttrConfig(); qualityAttrCorConfig = new QualityAttrCorConfig(); skillUpConfig = new SkillUpConfig(); RankConfig = new RankConfig(); signConfig = new SignConfig(); NewComerSignConfig = new NewComerSignConfig(); FightingCapacityConfig = new FightingCapacityConfig(); BodyInfoListConfig = new BodyInfoListConfig(); BadgeSlotsConfig = new BadgeSlotConfig(); GoodsComposeNewConfigData = new GoodsComposeNewConfig(); SceneConfig = new SceneConfig(); ReboundAttrConfigData = new ReboundAttrConfig(); CareerConfigData = new CareerConfig(); PotientialEffectConfig = new PotientialEffectConfig(); PVPPointConfig = new PVPPointConfig(); WinningStreakAwardConfig = new WinningStreakAwardConfig(); ArticleStrengthConfig = new ArticleStrengthConfig(); PhRegainConfig = new PhRegainConfig(); MatchAchievementConfig = new MatchAchievementConfig(); SpecialActionConfig = new SpecialActionConfig(); StealConfig = new StealConfig(); CurveRateConfig = new CurveRateConfig(); DunkRateConfig = new DunkRateConfig(); AIConfig = new AIConfig(); AttrReduceConfig = new AttrReduceConfig(); qualifyingConfig = new QualifyingConfig(); qualifyingNewConfig = new QualifyingNewConfig(); qualifyingNewerConfig = new QualifyingNewerConfig(); bullFightConfig = new BullFightConfig(); HedgingConfig = new HedgingConfig(); roleGiftConfig = new RoleGiftConfig(); DebugConfig = new DebugConfig(); shootGameConfig = new ShootGameConfig(); MapConfig = new MapConfig(); activityConfig = new ActivityConfig(); trialConfig = new TrialConfig(); gameMatchConfig = new GameMatchConfig(); shootSolutionManager = new ShootSolutionManager(); talentConfig = new TalentConfig(); ladderConfig = new LadderConfig(); matchSoundConfig = new MatchSoundConfig(); matchMsgConfig = new MatchMsgConfig(); MatchPointsConfig = new MatchPointsConfig(); AnimationSampleManager.Instance.LoadXml(); }
/// <summary> /// 获取比对后的相关类型的表 /// </summary> /// <param name="equal"></param> /// <returns></returns> public List <TableCompareModel> GetRes_TableList(CommonConfig.EqualValue equal, string tempfilename) { try { var XmlDoc = new XmlDocument(); XmlDoc.Load(GetXMLPath(tempfilename)); var xelem = XElement.Parse(XmlDoc.InnerXml); List <TableCompareModel> reslist = (from o in xelem.Descendants("Table") where ((string)o.Attribute("Isequal").Value == CommonConfig.GetEqualValue(equal)) select new TableCompareModel { Tablename = o.Attribute("Tablename").Value, Isequal = o.Attribute("Isequal").Value }).ToList(); return(reslist); } catch (Exception ex) { throw ex; } }
public static void LoadConfig() { CommonConfig = CommonConfig.LoadCommonConfigOrCreate(); }
public JsonResult AddJangad(DIA_JangadViewModal dIA_JangadViewModal) { try { if (dIA_JangadViewModal == null) { //error meesage or expception handle } else if (dIA_JangadViewModal.DIA_JangadItems == null) { //error meesage or expception handle } else { if (Session["UserID"] != null) { dIA_JangadViewModal.UserID = Convert.ToInt16(Session["UserID"].ToString()); } //dIA_JangadViewModal; if (dIA_JangadViewModal.JangadID > 0) { //edit time logic } else { DIA_Jangad new_DIA_Jangad = new DIA_Jangad(); new_DIA_Jangad.CompanyID = CommonConfig.GetCompanyID(); new_DIA_Jangad.PartyID = dIA_JangadViewModal.PartyID; new_DIA_Jangad.Weight = dIA_JangadViewModal.Weight; new_DIA_Jangad.StatusID = 1; //ask to kamal new_DIA_Jangad.UserID = dIA_JangadViewModal.UserID; new_DIA_Jangad.Amount = 0; //dIA_JangadViewModal.Amount; new_DIA_Jangad.RecivedAmount = 0; //dIA_JangadViewModal.RecivedAmount; new_DIA_Jangad.JangadNo = dIA_JangadViewModal.JangadNo;; //ask to kamal new_DIA_Jangad.Created = DateTime.Now; new_DIA_Jangad.Modified = DateTime.Now; new_DIA_Jangad.Remarks = dIA_JangadViewModal.Remarks; new_DIA_Jangad.PricePerCarat = dIA_JangadViewModal.PricePerCarat; new_DIA_Jangad.FinYearID = CommonConfig.GetFinYearID(); new_DIA_Jangad.CGSTAmount = dIA_JangadViewModal.CGSTAmount; new_DIA_Jangad.SGSTAmount = dIA_JangadViewModal.SGSTAmount; new_DIA_Jangad.IGSTAmount = dIA_JangadViewModal.IGSTAmount; new_DIA_Jangad.TDSAmount = dIA_JangadViewModal.TDSAmount; new_DIA_Jangad.IsActive = true; if (dIA_JangadViewModal.CGST > 0) { new_DIA_Jangad.CGST = dIA_JangadViewModal.CGST; } else { new_DIA_Jangad.CGST = null; } if (dIA_JangadViewModal.SGST > 0) { new_DIA_Jangad.SGST = dIA_JangadViewModal.SGST; } else { new_DIA_Jangad.SGST = null; } if (dIA_JangadViewModal.IGST > 0) { new_DIA_Jangad.IGST = dIA_JangadViewModal.IGST; } else { new_DIA_Jangad.IGST = null; } if (dIA_JangadViewModal.TDS > 0) { new_DIA_Jangad.TDS = dIA_JangadViewModal.TDS; } else { new_DIA_Jangad.TDS = null; } new_DIA_Jangad.IsLocal = dIA_JangadViewModal.IsLocal; new_DIA_Jangad.Casar = 0;//ask to kamal //start default value set new_DIA_Jangad.Quantity = dIA_JangadViewModal.Quantity; new_DIA_Jangad.PricePerCarat = 0; new_DIA_Jangad.QTYByThan = 0; new_DIA_Jangad.Rate = 0; //end if (dIA_JangadViewModal.IsRatePerCarat == true) { new_DIA_Jangad.IsRatePerCarat = dIA_JangadViewModal.IsRatePerCarat; new_DIA_Jangad.Quantity = dIA_JangadViewModal.Quantity; //ask to kamal new_DIA_Jangad.PricePerCarat = dIA_JangadViewModal.PricePerCarat; //ask to kamal new_DIA_Jangad.TotalAmount = dIA_JangadViewModal.TotalAmount; new_DIA_Jangad.PendingAmount = Convert.ToInt32(dIA_JangadViewModal.TotalAmount); } if (dIA_JangadViewModal.IsRatePerThan == true) { new_DIA_Jangad.IsRatePerThan = dIA_JangadViewModal.IsRatePerThan; new_DIA_Jangad.QTYByThan = dIA_JangadViewModal.QTYByThan;//ask to kamal new_DIA_Jangad.Rate = dIA_JangadViewModal.Rate; new_DIA_Jangad.TotalAmount = dIA_JangadViewModal.TotalAmount; new_DIA_Jangad.PendingAmount = Convert.ToInt32(dIA_JangadViewModal.TotalAmount); } #region Generate InvoiceNo String _NewJangadCode = CommonConfig.GetNextNumber("JN"); #endregion Generate InvoiceNo new_DIA_Jangad.JangadCode = _NewJangadCode; db.DIA_Jangad.Add(new_DIA_Jangad); db.SaveChanges(); if (dIA_JangadViewModal.DIA_JangadItems.Count() > 0) { List <DIA_JangadItem> newList_DIA_JangadItems = new List <DIA_JangadItem>(); DIA_JangadItem new_DIA_JangadItem; foreach (var item in dIA_JangadViewModal.DIA_JangadItems) { new_DIA_JangadItem = new DIA_JangadItem(); new_DIA_JangadItem.JangadID = new_DIA_Jangad.JangadID; new_DIA_JangadItem.Weight = item.Weight; new_DIA_JangadItem.Dia = item.Dia; new_DIA_JangadItem.PavalionAngle = item.PavalionAngle; new_DIA_JangadItem.CrownAngle = item.CrownAngle; new_DIA_JangadItem.CrownHeight = item.CrownHeight; new_DIA_JangadItem.Girdle = item.Girdle; new_DIA_JangadItem.Para1 = item.Para1; new_DIA_JangadItem.Para2 = item.Para2; new_DIA_JangadItem.Para3 = item.Para3; new_DIA_JangadItem.PavalionORCrown = "1";//ask to kamal new_DIA_JangadItem.UserID = dIA_JangadViewModal.UserID; new_DIA_JangadItem.StatusID = CommonConfig.GetStatusPending(); new_DIA_JangadItem.Created = DateTime.Now; new_DIA_JangadItem.Remarks = item.Remarks; new_DIA_JangadItem.RWeight = item.RWeight; new_DIA_JangadItem.PWeight = item.PWeight; new_DIA_JangadItem.Culet = item.Culet; //ask to kamal new_DIA_JangadItem.ji_table = item.ji_table; //ask to kamal new_DIA_JangadItem.JangadItemCode = item.JangadItemCode; //ask to kamal new_DIA_JangadItem.PolishingStageID = 1; //Jangad Fresh newList_DIA_JangadItems.Add(new_DIA_JangadItem); } db.DIA_JangadItem.AddRange(newList_DIA_JangadItems); db.SaveChanges(); } } } return(Json("Sucess", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { } return(Json("failure", JsonRequestBehavior.AllowGet)); }
protected void btnShow_Click(object sender, EventArgs e) { SqlInt32 CategoryID = SqlInt32.Null; String CategoryName = String.Empty; DataTable dtItem = new DataTable(); List <ItemStockReportViewModal> _ItemStockReportViewModal = new List <ItemStockReportViewModal>(); if (ddlCategoryID.SelectedIndex > 0) { CategoryID = Convert.ToInt32(ddlCategoryID.SelectedValue); CategoryName = ddlCategoryID.SelectedItem.Text; } using (DB_A157D8_AnjaliMISEntities1 db = new DB_A157D8_AnjaliMISEntities1()) { try { var sql = "exec PP_INV_Item_SelectItemStockReportByCategoryID @CategoryID,@CompanyID"; List <SqlParameter> parameterList = new List <SqlParameter>(); parameterList.Add(new SqlParameter("@CategoryID", CategoryID)); parameterList.Add(new SqlParameter("@CompanyID", CommonConfig.GetCompanyID())); SqlParameter[] parameters = parameterList.ToArray(); dtItem = CommonConfig.ToDataTable(db.Database.SqlQuery <ItemStockReportViewModal>(sql, parameters).ToList()); //_ItemStockReportViewModal = data1.Select(dataElement => new ItemStockReportViewModal() //{ // ModuleID = dataElement.ModuleID, // ModuleName = dataElement.ModuleName, // Controller = dataElement.Controller, // Action = dataElement.Action, // URL = dataElement.URL, // IconName = dataElement.IconName, // StrictlyStop = dataElement.StrictlyStop, // Sequence = dataElement.Sequence, // UserID = dataElement.UserID //}).ToList(); } catch (Exception ex) { //SaveErrorLog("JobRepository", "GetJobListByPaging", ex); } } //using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DB_A157D8_AnjaliMISEntities1"].ConnectionString)) //{ // using (SqlCommand cmd = new SqlCommand("PP_INV_Item_SelectItemStockReportByCategoryID", con)) // { // cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.Add("@CategoryID", SqlDbType.Int).Value = CategoryID; // cmd.Parameters.Add("@CompanyID", SqlDbType.Int).Value = CommonConfig.GetCompanyID(); // con.Open(); // SqlDataReader dr = cmd.ExecuteReader(); // dtItem.Load(dr); // } //} if (dtItem != null) { rvReport.Reset(); rvReport.LocalReport.DataSources.Clear(); rvReport.ProcessingMode = ProcessingMode.Local; rvReport.LocalReport.EnableExternalImages = true; rvReport.LocalReport.ReportPath = Server.MapPath("~/Report/RPT_INV_Item_Stock.rdlc"); rvReport.LocalReport.DataSources.Add(new ReportDataSource("PP_INV_Item_SelectItemStockReportByCategoryID", dtItem)); rvReport.Visible = true; rvReport.LocalReport.DisplayName = "Item Stock Report"; rvReport.LocalReport.Refresh(); rvReport.DataBind(); } else { rvReport.Visible = false; } }
/// <summary> /// Apply the Dicom Configuration to the Client, /// </summary> /// <param name="commonConfig">Common Configuration.</param> /// <param name="config">Dicom Configuration.</param> public void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config) { _scu.Initialize(ParentActor.ThreadManager); _scu.Options.Identifier = String.Format("From_{0}_To_{1}", ParentActor.ActorName.TypeId, ActorName.TypeId); if (commonConfig.ResultsDirectory != System.String.Empty) { _scu.Options.StartAndStopResultsGatheringEnabled = true; _scu.ResultsFilePerTrigger = true; if (commonConfig.ResultsSubdirectory != System.String.Empty) { _scu.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory + "\\" + commonConfig.ResultsSubdirectory); } else { _scu.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory); } } else { _scu.Options.StartAndStopResultsGatheringEnabled = false; } _scu.Options.CredentialsFilename = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.CredentialsFilename); _scu.Options.CertificateFilename = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.CertificateFilename); _scu.Options.SecureConnection = config.SecureConnection; _scu.Options.LocalAeTitle = config.FromActorAeTitle; _scu.Options.LocalPort = config.PortNumber; _scu.Options.RemoteAeTitle = config.ToActorAeTitle; _scu.Options.RemotePort = config.PortNumber; _scu.Options.RemoteHostName = config.ToActorIpAddress; _scu.Options.AutoValidate = config.AutoValidate; _scu.Options.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.StoreDataDirectory); if (config.StoreData == true) { _scu.Options.StorageMode = Dvtk.Sessions.StorageMode.AsMediaOnly; } else { _scu.Options.StorageMode = Dvtk.Sessions.StorageMode.NoStorage; } foreach (System.String filename in config.DefinitionFiles) { _scu.Options.LoadDefinitionFile(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, filename)); } // finally copy any config options _configOption1 = config.ActorOption1; _configOption2 = config.ActorOption2; _configOption3 = config.ActorOption3; _scu.LoopDelay = 3000; }
public CreateOrderResponse CreateOrder(OrderInfo orderinfo) { _log.Debug("order data:" + JsonConvert.SerializeObject(orderinfo)); //orderinfo.memberId = "LM00013564"; if (string.IsNullOrWhiteSpace(orderinfo.memberId)) { orderinfo.memberId = DefaultMemberId; orderinfo.memberName = "匿名用户"; } var password = GetPassword(orderinfo.memberId); var datetime = DateTime.Now; var datmap = new CreateOrderDatamap() { memberId = orderinfo.memberId, orderList = new OrderInfo[] { orderinfo } }; var request = new CreateOrderRequest { dataMap = datmap, sign = BuildSign(datmap, datetime, password), reqTime = datetime.ToString(DateTimeFormat) }; var jSetting = new JsonSerializerSettings(); jSetting.NullValueHandling = NullValueHandling.Ignore; var content = JsonConvert.SerializeObject(request, jSetting); _log.Debug("Post data:" + content); var config = new CommonConfig(null); var req = (HttpWebRequest)WebRequest.Create(config.JavaOrder_Uri + "generateOrder"); req.Method = "POST"; req.ContentType = "Application/Json"; req.Credentials = CredentialCache.DefaultCredentials; req.Timeout = 300000; // 如果服务器返回错误,他还会继续再去请求,不会使用之前的错误数据,做返回数据 //req.ServicePoint.Expect100Continue = false; WriteRequestData(req, content); var response = req.GetResponse(); if (response == null) { throw new Exception("请求失败!"); } var stream = response.GetResponseStream(); if (stream == null) { throw new Exception("请求Stream为空!"); } var sr = new StreamReader(stream, Encoding.UTF8); var retXml = sr.ReadToEnd(); sr.Close(); _log.Debug(retXml); var obj = JsonConvert.DeserializeObject <CreateOrderResponse>(retXml); if (obj.respCode != "0") { throw new ApplicationException(obj.respMsg); } obj.dataMap.orderId = obj.dataMap.orderIds.First().Value; return(obj); }
/// <summary> /// Class constructor. /// </summary> /// <param name="parentActor">Parent Actor Name - (containing actor).</param> /// <param name="actorName">Destination Actor Name.</param> /// <param name="commonConfig">Common Configuration.</param> /// <param name="config">HL7 Configuration.</param> public Hl7QueryServer(BaseActor parentActor, ActorName actorName, CommonConfig commonConfig, Hl7PeerToPeerConfig config) : base(parentActor, actorName, commonConfig, config) { }
public TokenAuth(RequestDelegate next, IOptions <JobTrackerConfig> options) { _next = next; _commonConfig = options.Value.CommonConfig; }
public ReadDelta(CommonConfig commonConfig, XLWorkbook workbook, List <KeyEntry> keyEntries) : base(commonConfig, workbook) { KeyEntries = keyEntries; }
public string Create(CommonConfig model) { _repo.Insert(model); return(model.ConfigKey); }
public override string OnResponse(string data) { UseHuaFeiReq defaultReqData; try { defaultReqData = JsonConvert.DeserializeObject <UseHuaFeiReq>(data); } catch (Exception) { MySqlService.log.Warn("传入的参数有误"); return(null); } string Tag = defaultReqData.tag; int ConnId = defaultReqData.connId; string Uid = defaultReqData.uid; int propId = defaultReqData.prop_id; string phone = defaultReqData.phone; int prop_num = defaultReqData.prop_num; if (string.IsNullOrWhiteSpace(Tag) || string.IsNullOrWhiteSpace(Uid) || string.IsNullOrWhiteSpace(phone) || prop_num < 1) { MySqlService.log.Warn("字段有空:" + data); return(null); } //传给客户端的数据 JObject _responseData = new JObject(); _responseData.Add(MyCommon.TAG, Tag); _responseData.Add(MyCommon.CONNID, ConnId); if (prop_num % 5 != 0 && prop_num != 1) { OperatorFail(_responseData, $"道具数量不正确:{prop_num}"); return(_responseData.ToString()); } else { MySqlService.log.Info($"兑换话费:{propId},{prop_num}"); } //当天充值金额已超过100元 CommonConfig commonConfig = NHibernateHelper.commonConfigManager.GetByUid(Uid); if (commonConfig?.recharge_phonefee_amount >= 100) { OperatorFail(_responseData, $"今日话费兑换额度已达上限"); MySqlService.log.Error($"{Uid}当天充值金额已超过100元,已充值:{commonConfig.recharge_phonefee_amount}"); return(_responseData.ToString()); } //当天每个手机30限额 List <UserPhoneExchange> userPhoneExchanges = MySqlManager <UserPhoneExchange> .Instance.GetByCurrentDay(phone); int totalMoney = 0; foreach (var userPhoneExchange in userPhoneExchanges) { totalMoney += userPhoneExchange.Money; } if (totalMoney >= 30) { OperatorFail(_responseData, $"该手机充值已达限制"); return(_responseData.ToString()); } lock (Locker) { UseHuaFeiSql(Uid, propId, phone, prop_num, _responseData); } return(_responseData.ToString()); }
public void OnBeforeSerialize() { module = G.Module; commonConfig = CommonModule.CommonConfig; }
public static AllEntity ReadAll(byte address, CommonConfig config, Action <string> callback, Action <string> commandCallback) { AllEntity all = new AllEntity(); try { all.Normal = NormalInstruction.ReadNormal(address, config, commandCallback); callback("读取通用参数成功"); } catch (Exception ex) { log.Error(ex); callback("读取通用参数失败"); } for (int i = 1; i <= all.Normal.GasCount; i++) { try { all.GasList.Add(GasInstruction.ReadGas(i, address, config, commandCallback)); callback(string.Format("读取气体{0}成功", i)); } catch (Exception ex) { log.Error(ex); callback(string.Format("读取气体{0}失败", i)); } } try { all.WeatherList = WeatherInstruction.ReadWeather(address, config, commandCallback); callback("读取气象成功"); } catch (Exception ex) { log.Error(ex); callback("读取气象失败"); } try { all.Serial = SerialInstruction.ReadSerialParam(address, config, commandCallback); callback("读取串口参数成功"); } catch (Exception ex) { log.Error(ex); callback("读取串口参数失败"); } try { all.EquipmentDataTime = ReadRealTime(address, commandCallback); callback("读取时间成功"); } catch (Exception ex) { log.Error(ex); callback("读取时间失败"); } try { all.OutDate = ReadOutDate(address, commandCallback); callback("读取出厂日期成功"); } catch (Exception ex) { log.Error(ex); callback("读取出厂日期失败"); } return(all); }