public void TrySendSMS(SmsHistory history) { try { this.RaiseNotification(res.ResourceManager.GetString("BeginSendingMessageTo") + history.ClientPhone + "(" + history.ClientName + ")"); string resp = SmsDriver.Instance.SendSms(history.ClientPhone, history.Message); if (string.IsNullOrEmpty(resp)) { history.Status = res.ResourceManager.GetString("MessageSend"); history.Save(); this.RaiseNotification(res.ResourceManager.GetString("MessageSend") + history.ClientPhone + "(" + history.ClientName + ")"); } else { history.Status = res.ResourceManager.GetString("MessageError"); history.Save(); this.RaiseNotification(res.ResourceManager.GetString("MessageError") + history.ClientPhone + "(" + history.ClientName + ")"); history.HasError = true; } } catch (Exception ex) { this.RaiseNotification(res.ResourceManager.GetString("ErrorSendingMessage")); RoLog.Instance.WriteToLog(ex.ToString(), TracedAttribute.ERROR); } finally { PropertyBag["history"] = history; } }
public void SendSMS(int[] clients, string message) { SmsHistory history; IList <SmsHistory> list = new List <SmsHistory>(); foreach (var id in clients) { Client client = Client.Find(id); if (client != null) { history = new SmsHistory() { // Client = client, ClientName = client.Name, ClientPhone = client.Phone, Date = DateTime.Now.ToString(), Status = res.ResourceManager.GetString("MessagePending"), Message = message }; history.Save(); list.Add(history); } } PropertyBag["histories"] = list; RenderView("Main/SendSms"); }
public void GenerateData() { User u = new User() { Username = "******", Password = "******" }; u.Save(); //generate 100 users for (int i = 0; i < 100; i++) { Client c = new Client() { Name = "client " + i, Network = "Orange", Phone = "0745961116" }; c.Save(); } ModemSettings modemSettings = new ModemSettings() { Port = "COM1", BitPerSec = 115200, DataBits = 8, Parity = Parity.None, StopBits = StopBits.One, FlowControl = "NONE" }; modemSettings.Save(); var clients = Client.FindAll(); for (int i = 0; i < 5; i++) { for (int j = 0; j < 6; j++) { var date = DateTime.Now.AddDays(j); SmsHistory h = new SmsHistory() { // Client = clients[i], Date = date.ToString(), Message = "Mesajul Nr " + j, Status = "Send ok", ClientName = clients[i].Name, ClientPhone = clients[i].Phone }; h.Save(); } } }
public void GenerateData() { User u=new User(){Username = "******",Password = "******"}; u.Save(); //generate 100 users for(int i=0;i<100;i++) { Client c=new Client(){Name = "client "+i,Network = "Orange",Phone = "0745961116"}; c.Save(); } ModemSettings modemSettings = new ModemSettings() { Port = "COM1", BitPerSec = 115200, DataBits = 8, Parity =Parity.None, StopBits =StopBits.One, FlowControl = "NONE" }; modemSettings.Save(); var clients = Client.FindAll(); for(int i=0;i<5;i++) { for(int j=0;j<6;j++) { var date = DateTime.Now.AddDays(j); SmsHistory h = new SmsHistory() { // Client = clients[i], Date = date.ToString(), Message = "Mesajul Nr " + j, Status = "Send ok", ClientName = clients[i].Name, ClientPhone = clients[i].Phone }; h.Save(); } } }
public bool UpdateBalance(string shopId, string smsId, double amount, string text) { BusinessDbContext db = this.Repository.Db as BusinessDbContext; SmsHistory entity = new SmsHistory() { ShopId = shopId, Id = Guid.NewGuid().ToString(), Created = DateTime.Now, Modified = DateTime.Now, IsActive = true, CreatedBy = "System", CreatedFrom = "BizBook", ModifiedBy = "System", Amount = amount, Text = text, SmsId = smsId }; var history = db.SmsHistorys.Add(entity); int i = db.SaveChanges(); return(i > 0); }
public int GetHashCode(SmsHistory obj) { return(obj.GetHashCode()); }
public bool Equals(SmsHistory x, SmsHistory y) { return(x.Message == y.Message); }
public void TrySendSMS(SmsHistory history) { try { this.RaiseNotification(res.ResourceManager.GetString("BeginSendingMessageTo")+history.ClientPhone+"("+history.ClientName+")"); string resp=SmsDriver.Instance.SendSms(history.ClientPhone, history.Message); if(string.IsNullOrEmpty(resp)) { history.Status = res.ResourceManager.GetString("MessageSend"); history.Save(); this.RaiseNotification(res.ResourceManager.GetString("MessageSend") + history.ClientPhone + "(" + history.ClientName + ")"); } else { history.Status = res.ResourceManager.GetString("MessageError"); history.Save(); this.RaiseNotification(res.ResourceManager.GetString("MessageError") + history.ClientPhone + "(" + history.ClientName + ")"); history.HasError = true; } } catch (Exception ex) { this.RaiseNotification(res.ResourceManager.GetString("ErrorSendingMessage") ); RoLog.Instance.WriteToLog(ex.ToString(), TracedAttribute.ERROR); } finally { PropertyBag["history"] = history; } }
public void SendSMS(int[] clients, string message) { SmsHistory history; IList<SmsHistory> list = new List<SmsHistory>(); foreach (var id in clients) { Client client = Client.Find(id); if (client != null) { history = new SmsHistory() { // Client = client, ClientName = client.Name, ClientPhone = client.Phone, Date = DateTime.Now.ToString(), Status = res.ResourceManager.GetString("MessagePending"), Message = message }; history.Save(); list.Add(history); } } PropertyBag["histories"] = list; RenderView("Main/SendSms"); }