/// <summary> /// Логгирование объекта по GPS /// </summary> /// <param name="model.Id"></param> /// <param name="model.Lon1"></param> /// <param name="model.Lat1"></param> /// <param name="model.Signal"></param> /// <param name="model.Date"></param> /// <returns></returns> public async Task <ServiceResponseObject <BaseResponseObject> > SetContainerLocation(LocationViewModel model) { SmartBox box = await _boxContext.SmartBoxes.FirstOrDefaultAsync(s => s.Id == model.Id); ServiceResponseObject <BaseResponseObject> DataContent = new ServiceResponseObject <BaseResponseObject>(); if (box != null) { Location location = new Location { BoxId = box.Id, Latitude = model.Lat1, Longitude = model.Lon1, SignalLevel = model.Signal, CurrentDate = model.Date, Name = box.Name }; _boxContext.Locations.Add(location); await _boxContext.SaveChangesAsync(); DataContent.Message = "Успешно!"; DataContent.Status = ResponseResult.OK; return(DataContent); } DataContent.Message = "Контейнер не найден!"; DataContent.Status = ResponseResult.Error; return(DataContent); }
public PhysicsEngine(ObjectMaint objMaint, SmartBox smartBox) { ObjMaint = objMaint; SmartBox = smartBox; SmartBox.Physics = this; Instance = this; }
public Physics(ObjectMaint objMaint, SmartBox smartBox) { ObjMaint = objMaint; SmartBox = smartBox; PhysicsTimer.CurrentTime = Timer.CurrentTime; SmartBox.Physics = this; }
public static void SyncUnits(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, OutsideWS.WebService ws) { IList<SMC_Unit> units = bo.GetNeedSyncSMC_Units(); OutsideWS.SMC_Unit[] _units = new OutsideWS.SMC_Unit[units.Count]; for (int i = 0; i < units.Count; ++i) { _units[i] = CopySMC_Unit(units[i]); } ws.SMC_UnitSync(_units.ToArray()); }
/// <summary> /// updating custom payment result details /// </summary> /// <param name="claimPaymentResult">payment result to be updated</param> /// <param name="smartBox">user entered smart box variables</param> /// <param name="paymentTypeBase">user entered custom payment details</param> public void UpdateCustomTableDetails(PaymentResult claimPaymentResult, SmartBox smartBox, PaymentTypeCustomTable paymentTypeBase) { claimPaymentResult.IntermediateAdjudicatedValue = smartBox.CAA; claimPaymentResult.CustomExpressionResult = claimPaymentResult.AdjudicatedValue; claimPaymentResult.IsFormulaError = paymentTypeBase.IsFormulaError; claimPaymentResult.CustomExpression = string.Format("{0}{1}{2}", Constants.StartSquareBracket, paymentTypeBase.Expression, Constants.EndSquareBracket); claimPaymentResult.CustomExpandedExpression = paymentTypeBase.ExpandedExpression; paymentTypeBase.IsFormulaError = false; }
public void SetSmartBox(SmartBox smartBox) { SmartBox = smartBox; if (smartBox != null) { Player = smartBox.Player; } else { Player = null; } }
/// <summary> /// updating stoploss details to payment result /// </summary> /// <param name="paymentResult">payment result</param> /// <param name="smartBox">user added variables</param> /// <param name="paymentTypeStopLoss">user added stop loss details</param> /// <param name="isThresholdFormulaError">if there are any threshold formula error</param> public static void UpdateStopLossDetails(PaymentResult paymentResult, SmartBox smartBox, PaymentTypeStopLoss paymentTypeStopLoss, bool isThresholdFormulaError) { paymentResult.IntermediateAdjudicatedValue = smartBox.CAA; paymentResult.ExpressionResult = paymentTypeStopLoss.Threshold; if (paymentTypeStopLoss.Expression != null) { paymentResult.IsFormulaError = paymentResult.IsFormulaError || isThresholdFormulaError; } paymentResult.Expression = string.Format("{0}{1}{2}", Constants.StartSquareBracket, paymentTypeStopLoss.Expression, Constants.EndSquareBracket); paymentResult.ExpandedExpression = paymentTypeStopLoss.ExpandedExpression; }
public MainForm() { InitializeComponent(); for (int i = 0; i < 50; i++) { SmartBox box = new SmartBox(5, 10, Color.Red); this.Controls.Add(box._Body); Boxes.Add(box); } Timer timer = new Timer(); timer.Interval = 1000 / 60; timer.Tick += Timer_Tick; timer.Enabled = true; }
/// <summary> /// Добавление контейнера в бд /// </summary> /// <param name="name"></param> /// <returns></returns> public async Task <ServiceResponseObject <ContainerResponse> > Create(string name) { ServiceResponseObject <ContainerResponse> DataContent = new ServiceResponseObject <ContainerResponse>(); var box = _boxContext.SmartBoxes.Where(s => s.Name == name).FirstOrDefault(); if (box != null) { box.CloudKey = "1"; _boxContext.Update(box); await _boxContext.SaveChangesAsync(); DataContent.Status = ResponseResult.OK; DataContent.Message = "Объект найден!"; DataContent.ResponseData = new ContainerResponse { SmartBoxId = box.Id, Name = box.Name }; return(DataContent); } box = new SmartBox { Name = name, CloudKey = "1" }; var result = await _boxContext.SmartBoxes.AddAsync(box); _boxContext.SaveChanges(); DataContent.Status = ResponseResult.OK; DataContent.Message = "Объект успешно добавлен!"; DataContent.ResponseData = new ContainerResponse { SmartBoxId = box.Id, Name = box.Name }; return(DataContent); }
/// <summary> /// updating custom payment result details /// </summary> /// <param name="claimPaymentResult">payment result to be updated</param> /// <param name="smartBox">user entered smart box variables</param> /// <param name="paymentTypeBase">user entered custom payment details</param> /// <param name="occurence">The occurence.</param> public static void UpdateCustomTableDetails(PaymentResult claimPaymentResult, SmartBox smartBox, PaymentTypeCustomTable paymentTypeBase, int occurence = 0) { claimPaymentResult.IntermediateAdjudicatedValue = smartBox.CAA; claimPaymentResult.CustomExpressionResult = claimPaymentResult.AdjudicatedValue; claimPaymentResult.IsFormulaError = paymentTypeBase.IsFormulaError; claimPaymentResult.CustomExpression = string.Format("{0}{1}{2}", Constants.StartSquareBracket, paymentTypeBase.Expression, Constants.EndSquareBracket); claimPaymentResult.CustomExpandedExpression = paymentTypeBase.ExpandedExpression; paymentTypeBase.IsFormulaError = false; if (occurence > 0) { claimPaymentResult.CustomExpressionResult = paymentTypeBase.FormulaExpressionResult; claimPaymentResult.MultiplierExpressionResult = paymentTypeBase.MultiplierExpressionResult; claimPaymentResult.IsMultiplierFormulaError = paymentTypeBase.IsMultiplierFormulaError; claimPaymentResult.Multiplier = paymentTypeBase.Multiplier; switch (occurence) { case 1: claimPaymentResult.MultiplierExpandedExpression = Constants.FirstMultiplier + paymentTypeBase.MultiplierExpandedExpression + Constants.Equals + paymentTypeBase.MultiplierExpressionResult + (paymentTypeBase.IsMultiplierFormulaError ? Constants.FormulaError : string.Empty); break; case 2: claimPaymentResult.MultiplierExpandedExpression += ((string.IsNullOrWhiteSpace(claimPaymentResult.MultiplierExpandedExpression)) ? string.Empty : Constants.Comma) + Constants.SecondMultiplier + paymentTypeBase.MultiplierExpandedExpression + Constants.Equals + paymentTypeBase.MultiplierExpressionResult + (paymentTypeBase.IsMultiplierFormulaError ? Constants.FormulaError : string.Empty); break; case 3: claimPaymentResult.MultiplierExpandedExpression += ((string.IsNullOrWhiteSpace(claimPaymentResult.MultiplierExpandedExpression)) ? string.Empty : Constants.Comma) + Constants.ThirdMultiplier + paymentTypeBase.MultiplierExpandedExpression + Constants.Equals + paymentTypeBase.MultiplierExpressionResult + (paymentTypeBase.IsMultiplierFormulaError ? Constants.FormulaError : string.Empty); break; case 4: claimPaymentResult.MultiplierExpandedExpression += ((string.IsNullOrWhiteSpace(claimPaymentResult.MultiplierExpandedExpression)) ? string.Empty : Constants.Comma) + Constants.FourthMultiplier + paymentTypeBase.MultiplierExpandedExpression + Constants.Equals + paymentTypeBase.MultiplierExpressionResult + (paymentTypeBase.IsMultiplierFormulaError ? Constants.FormulaError : string.Empty); break; default: claimPaymentResult.MultiplierExpandedExpression += string.IsNullOrWhiteSpace(claimPaymentResult.MultiplierExpandedExpression) || !claimPaymentResult.MultiplierExpandedExpression.Contains(Constants.OthersMultiplier) ? (((string.IsNullOrWhiteSpace(claimPaymentResult.MultiplierExpandedExpression)) ? string.Empty : Constants.Comma) + Constants.OthersMultiplier + paymentTypeBase.MultiplierExpandedExpression + Constants.Equals + paymentTypeBase.MultiplierExpressionResult + (paymentTypeBase.IsMultiplierFormulaError ? Constants.FormulaError : string.Empty)) : string.Empty; break; } claimPaymentResult.LimitExpressionResult = paymentTypeBase.LimitExpressionResult; claimPaymentResult.IsLimitError = paymentTypeBase.IsLimitError; claimPaymentResult.LimitExpandedExpression = paymentTypeBase.LimitExpandedExpression; paymentTypeBase.IsLimitError = false; paymentTypeBase.IsMultiplierFormulaError = false; } }
public static void SyncUsers(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, OutsideWS.WebService ws) { IList<SMC_User> users = bo.GetNeedSyncSMC_Users(); OutsideWS.SMC_User[] _users = new OutsideWS.SMC_User[users.Count]; for (int i = 0; i < users.Count; ++i) { _users[i] = CopySMC_User(users[i]); } ws.SMC_UserSync(_users.ToArray()); }
public static void SyncPackages(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, OutsideWS.WebService ws) { string smartbox_console_path = System.Configuration.ConfigurationManager.AppSettings["smartbox_console_path"]; IList<SMC_PackageExt> data = bo.GetNeedSyncPackageList(); foreach (SMC_PackageExt ext in data) { OutsideWS.SMC_PackageExt entity = CopyPackageExt(ext); //同步安装包到外网应用中心 ws.PackageExtSync(entity); OutsideWS.SMC_PackageFAQ faqEntity = new OutsideWS.SMC_PackageFAQ(); //同步问题反馈到外网应用中心 //IList<SMC_PackageFAQ> faqs = bo.GetPackageFAQs(entity.pe_id); //foreach (SMC_PackageFAQ _faq in faqs) //{ // OutsideWS.SMC_PackageFAQ faq = CopyPackageFAQ(_faq); // ws.PackageFAQSync(faq); //} //同步应用手册到外网应用中心 IList<SMC_PackageManual> manuals = bo.GetPackageManuals(entity.pe_id); foreach (SMC_PackageManual _manual in manuals) { OutsideWS.SMC_PackageManual manual = CopyPackageManual(_manual); ws.PackageManualSync(manual); } //同步截图表到外网应用中心 IList<SMC_PackagePicture> pics = bo.GetPackagePictures(entity.pe_id); foreach (SMC_PackagePicture _pic in pics) { OutsideWS.SMC_PackagePicture pic = CopyPackagePicture(_pic); ws.PackagePictuerSync(pic); } //同步附件到外网应用中心 string entityFolder = smartbox_console_path + "\\PackageExt\\" + ext.pe_id; if (Directory.Exists(entityFolder)) { string[] files = System.IO.Directory.GetFiles(entityFolder); List<OutsideWS.FileEntity> fs = new List<OutsideWS.FileEntity>(); foreach (string filePath in files) { if (File.Exists(filePath)) { FileStream s = new FileStream(filePath, FileMode.Open, FileAccess.Read); OutsideWS.FileEntity fEntity = new OutsideWS.FileEntity(); fEntity.Content = new byte[s.Length]; s.Read(fEntity.Content, 0, (int)s.Length); fEntity.FileName = Path.GetFileName(filePath); fs.Add(fEntity); } } try { ws.PackageFilesSync(fs.ToArray(), ext.pe_id); } catch(Exception ex) { } } } }
//public DataSet GetCollectedPackageList(string uid) //{ // SMC_PackageExtDao collectDAO = new SMC_PackageExtDao(AppConfig.statisticDBKey); // DataSet ds = collectDAO.GetCollectedPackage(uid); // DataColumn clmn = ds.Tables[0].Columns.Add("id", typeof(string)); // clmn = ds.Tables[0].Columns.Add("name", typeof(string)); // clmn = ds.Tables[0].Columns.Add("displayname", typeof(string)); // clmn = ds.Tables[0].Columns.Add("description", typeof(string)); // clmn = ds.Tables[0].Columns.Add("version", typeof(string)); // clmn = ds.Tables[0].Columns.Add("buildver", typeof(string)); // clmn = ds.Tables[0].Columns.Add("downloaduri", typeof(string)); // if (ds.Tables[0].Rows.Count > 0) // { // foreach (DataRow dr in ds.Tables[0].Rows) // { // string tablename = dr["tablename"].ToString().ToLower(); // int tableid = Convert.ToInt32(dr["tableid"]); // switch (tablename) // { // case "package4ai": // Package4AIDao padao = new Package4AIDao(AppConfig.mainDbKey); // Package4AI entity = padao.Get(tableid); // dr["id"] = dr["pe_id"].ToString(); // dr["name"] = entity.Name; // dr["displayname"] = entity.DisplayName; // dr["description"] = entity.Description; // dr["version"] = entity.Version; // dr["buildver"] = entity.BuildVer; // dr["downloaduri"] = entity.DownloadUri; // break; // case "webapplication": // WebApplicationDao wad = new WebApplicationDao(AppConfig.mainDbKey); // WebApplication application = wad.Get(tableid); // dr["id"] = dr["pe_id"].ToString(); // dr["name"] = application.ShortName; // dr["displayname"] = application.ShortName; // dr["description"] = ""; // dr["version"] = ""; // dr["buildver"] = ""; // dr["downloaduri"] = application.Uri; // break; // case "smc_package4out": // SMC_Package4OutDao poDao = new SMC_Package4OutDao(AppConfig.statisticDBKey); // SMC_Package4Out outEntity = poDao.Get(tableid); // dr["id"] = dr["pe_id"].ToString(); // dr["name"] = outEntity.Name; // dr["displayname"] = outEntity.DisplayName; // dr["description"] = outEntity.Description; // dr["version"] = outEntity.Version; // dr["buildver"] = outEntity.BuildVer; // dr["downloaduri"] = outEntity.DownloadUri; // break; // } // } // } // return ds; //} //public DataSet SearchBBPackageList(string keyword, string category, string unitCode, Common.Entities.Enum.PackageClientType clientType, Common.Entities.Enum.PackageTrait trait, int page, int pageSize, out int pageCount, out int recordCount) public virtual List<Hashtable> GetAllPackageList(SmartBox.Console.Common.Entities.Enum.PackageClientType clientType) { string sClientType = EnumTranslator.TransPackageClientTypeToString(clientType); IList<SMC_PackageExt> ds = packageDao.GetAllPackageList(sClientType); List<Hashtable> result = new List<Hashtable>(); for (int i = 0; i < ds.Count; ++i) { Hashtable item = SmartBox.Console.Common.TypeToHashtable<SMC_PackageExt>.ToHashtable(ds[i]); IList<SMC_PackagePicture> pics = pictureDao.GetList(Convert.ToInt32(ds[i].pe_id)); item["manualuri"] = ds[i].pe_id; if (pics != null && pics.Count > 0) { item["picture"] = this._ctroller.Url.Content(pics[0].pp_path); } else item["picture"] = this._ctroller.Url.Content("~/AppPictures/pictureno.png"); result.Add(item); } return result; }
public void SyncPackages(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, Service.ApplicationCenterWS.WebService ws, List<int> pe_ids) { Hashtable r = new Hashtable(); string smartbox_console_path = HttpRuntime.AppDomainAppPath; _SyncPackageExts(pe_ids, r); }