private void Awake() { if (instance == null) { _instance = this; } }
private void ProcessDeliveryItem(IDeliveryItem deliveryItem) { using (DeliverySystem ds = new DeliverySystem()) { ds.Send(deliveryItem); } }
public void Start() { instance = this; theAnimator = GetComponent <Animator>(); deliverSpriteRenderer = GetComponentInChildren <SpriteRenderer>(); horizontalCars = FindObjectsOfType <HorizontalVehicles>(); verticalCars = FindObjectsOfType <VerticalVehicles>(); }
public virtual Tuple <bool, string> ProvideDeliveryForUserold(string name, bool ispayed, bool Failed = false) { if (!DeliverySystem.IsAlive()) { return(new Tuple <bool, string>(false, "Not Connected Delivery System")); } Logger.logEvent(this, System.Reflection.MethodBase.GetCurrentMethod()); int delivery_res = DeliverySystem.Supply("dummy", "dummy", "dummy", "dummy", "dummy"); if (delivery_res < 0) { return(new Tuple <bool, string>(false, "Delivery Failed")); } return(new Tuple <bool, string>(true, "FineByNow")); }
public static void SubscribeDelivery(string deliveryCompany, string deliveryCode) { var salt = DeliverySystem.GetKuaidi100Salt(deliveryCompany, deliveryCode).ToString(); using (var connection = new SqlConnection(Wms)) { connection.Open(); var command = new SqlCommand("Delivery_SubscibeDeliveryByDeliveryCompanyAndDeliveryCode", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@DeliveryCompany", deliveryCompany ?? string.Empty)); command.Parameters.Add(new SqlParameter("@DeliveryCode", deliveryCode ?? string.Empty)); command.Parameters.Add(new SqlParameter("@Salt", salt)); command.ExecuteNonQuery(); } }
public void UpdateStep(World world, DeliverySystem deliverySystem) { bool isSendingTime = false; if (m_workDays.Contains(world.LogicTime.DayOfWeek)) { if (world.LogicTime.Hours == 17 && world.LogicTime.Minutes == 0) { isSendingTime = true; } } List <Core.Game.Shopping.Order> sendingOrders = null; if (isSendingTime) { sendingOrders = new List <Core.Game.Shopping.Order>(); } foreach (Core.Game.Shopping.Order currentOrder in m_processingOrders) { if (m_orderProcessor.UpdateOrder(currentOrder, world)) { if (isSendingTime) { sendingOrders.Add(currentOrder); } } if (currentOrder.orderItem != null) { // Update item here } } if (isSendingTime) { foreach (Core.Game.Shopping.Order currentOrder in sendingOrders) { deliverySystem.RequestDeliver(world, currentOrder); m_processingOrders.Remove(currentOrder); } } }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("dvb "); if (AdapterId.HasValue) { sb.AppendFormat("-a {0} ", AdapterId); } if (Frequency != null) { sb.AppendFormat("--frequency {0} ", Frequency); } if (DeliverySystem != null) { sb.AppendFormat("--delivery-system {0} ", DeliverySystem.ToString()); } if (Lnb.HasValue) { sb.AppendFormat("--lnb {0} ", Lnb.ToString()); } if (Polarity.HasValue) { sb.AppendFormat("--polarity {0} ", Polarity.ToString().ToLowerInvariant()); } if (SatelliteNumber.HasValue) { sb.AppendFormat("--satellite-number {0} ", SatelliteNumber); } if (SymbolRate.HasValue) { sb.AppendFormat("--symbol-rate {0} ", SymbolRate); } return(sb.ToString().Trim()); }
private string Subscibe(SubscibeModel model) { model.SubscibeBody.Parameters.Salt = DeliverySystem.GetKuaidi100Salt(model.SubscibeBody.DeliveryCompany, model.SubscibeBody.DeliveryCode).ToString(); var json = model.SubscibeBody.ToString(); var postVars = new NameValueCollection(); postVars.Add("schema", "json"); postVars.Add("param", json); var responseBuffer = WebClient.UploadValues(ConfigurationManager.AppSettings["DeliverySubscibeJob:SubscibeUrl"], "POST", postVars); var responseString = Encoding.UTF8.GetString(responseBuffer); var responseResult = JsonConvert.DeserializeObject <ResponseResultModel>(responseString); model.SubscibeResult = responseResult.Result; if (!model.SubscibeResult && responseResult.ReturnCode != 501) { Logger.Info("快递订阅失败,请求内容:" + JsonConvert.SerializeObject(model) + ";响应内容:" + responseString); } return(responseString); }
public virtual Tuple <bool, string> ProvideDeliveryForUser(string deliveryDetails, bool Failed = false) { if (deliveryDetails is null) { return(new Tuple <bool, string>(false, "Null Delivery System")); } if (mock && !work) { return(new Tuple <bool, string>(false, "System Is Down")); } if (!DeliverySystem.IsAlive(Failed)) { return(new Tuple <bool, string>(false, "Not Connected Delivery System")); } Logger.logEvent(this, System.Reflection.MethodBase.GetCurrentMethod()); string[] parsedDetails = deliveryDetails.Split('&'); if (parsedDetails.Length < 5) { return(new Tuple <bool, string>(false, "Not Enough Data")); } try { string Name = parsedDetails[0]; if (Name.Length == 0) { return(new Tuple <bool, string>(false, "Name is Not good")); } string add = parsedDetails[1]; if (add.Length == 0) { return(new Tuple <bool, string>(false, "Address is Not good")); } string city = parsedDetails[2]; if (city.Length == 0) { return(new Tuple <bool, string>(false, "City is Not good")); } string country = parsedDetails[3]; if (country.Length == 0) { return(new Tuple <bool, string>(false, "Country is Not good")); } string zip = parsedDetails[4]; if (zip.Length == 0) { return(new Tuple <bool, string>(false, "Zip is Not good")); } if (mock) { if (work) { if (DeliverySystemMock.Supply(8) > 0) { return(new Tuple <bool, string>(true, "Works")); } return(new Tuple <bool, string>(false, "not")); } if (DeliverySystemMock.Supply(-1) > 0) { return(new Tuple <bool, string>(false, "not")); } return(new Tuple <bool, string>(true, "Works")); } int transaction_num = DeliverySystem.Supply(Name, add, city, country, zip); if (transaction_num < 0) { return(new Tuple <bool, string>(false, "Transaction Failed")); } Logger.logEvent(this, System.Reflection.MethodBase.GetCurrentMethod()); return(new Tuple <bool, string>(true, "Transaction Success")); } catch (Exception ex) { Logger.logError("ParseFailed" + ex.Message, this, System.Reflection.MethodBase.GetCurrentMethod()); return(new Tuple <bool, string>(false, "Transaction Failed")); } }