public void Preheating() { OriginModel = new CallModel(); EmitModel = EmitFunc(); NatashaModel = NatashaFunc(); //NatasshaCaller = NatashaModel; }
public async Task <ActionResult> Call(CallModel callModel) { if (ModelState.IsValid) { var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); await Bandwidth.Net.Model.Call.Create(new Dictionary <string, object> { { "from", user.PhoneNumber }, { "to", callModel.PhoneNumber }, { "callbackUrl", ConfigurationManager.AppSettings["baseUrl"] + Url.Action("Admin", "Events") } }); TempData["Info"] = "Please answer a call"; } else { var message = new StringBuilder(); foreach (var state in ModelState.Values) { foreach (var error in state.Errors) { message.AppendLine(error.ErrorMessage); } } TempData["Error"] = message.ToString(); } return(RedirectToAction("Index")); }
public TestCaller() { string temp = "Hello"; Dict = new Dictionary <string, Action <CallModel, object> >(); Type type = typeof(CallModel); CallerManagement.AddType(type); DictHandler = DictOperator.CreateFromType(type); FuzzyDictHandler = FuzzyDictOperator.CreateFromType(type); HashDictHandler = HashDictOperator.CreateFromType(type); LinkHandler = LinkOperator.CreateFromType(type); FuzzyLinkHandler = FuzzyLinkOperator.CreateFromType(type); HashLinkHandler = HashLinkOperator.CreateFromType(type); Model = new CallModel(); Dynamic = new CallModel(); DictModel = new CallModel(); DictHandler.New(); FuzzyDictHandler.New(); HashDictHandler.New(); LinkHandler.New(); FuzzyLinkHandler.New(); HashLinkHandler.New(); Dict["Name"] = NDelegate.DefaultDomain().Action <CallModel, object>("arg1.Name=(string)arg2;"); }
public TestCaller() { NatashaInitializer.InitializeAndPreheating(); string temp = "Hello"; Dict = new Dictionary<string, Action<CallModel, object>>(); Type type = typeof(CallModel); PrecisionDict = PrecisionDictOperator.CreateFromType(type); FuzzyDict = FuzzyDictOperator.CreateFromType(type); HashDict = HashDictOperator.CreateFromType(type); //LinkHandler = LinkOperator.CreateFromType(type); //FuzzyLinkHandler = FuzzyLinkOperator.CreateFromType(type); //HashLinkHandler = HashLinkOperator.CreateFromType(type); Model = new CallModel(); Dynamic = new CallModel(); DictModel = new CallModel(); PrecisionDict.New(); FuzzyDict.New(); HashDict.New(); Dict["Name"] = NDelegate.DefaultDomain().Action<CallModel, object>("arg1.Name=(string)arg2;"); for (int i = 0; i < 3000; i++) { Model.Name = "Hello"; Dynamic.Name = "Hello"; Dict["Name"](DictModel, "Hello"); PrecisionDict.Set("Name", "Hello"); } }
public void Preheating() { OriginModel = new CallModel(); EmitModel = new CallModel(); NatashaModel = new CallModel(); NatashaProxyModel = new CallModel(); //NatashaCaller = NatashaProxyModel; }
public PartialViewResult Call(int Id) { CallModel model = new CallModel(); model.IsAvailable = servicePreference.IsAvailable(Id); model.FriendData = UserFb.Friends.Where(p => p.UserId == Id).SingleOrDefault(); return(PartialView(model)); }
public PartialViewResult RemainingBalance() { CallModel model = new CallModel(); ServiceManager.ServiceHandlers.TiklaAraHandler srvTiklaAra = new ServiceManager.ServiceHandlers.TiklaAraHandler(); model.RemainingBalance = srvTiklaAra.GetRemainingBalance(UserFb.Data.Msisdn); return(PartialView(model)); }
public void Preheating() { OriginModel = new CallModel(); EmitModel = new CallModel(); NatashaModel = new CallModel(); NatashaProxyModel = new CallModel(); NatashaCaller = new DynamicOperator <CallModel>(); DynamicObjectCaller = new DynamicOperator(typeof(CallModel)); DynamicStrongCaller = DynamicOperator.GetOperator(typeof(CallModel)); }
public void Call(CallModel model, Action success, Action <string> error) { var response = RequestFactory.ExecuteRequest <MResponse <object> >(RestCalls.Instance.PostCall(model)); response.OnResponse(() => { success?.Invoke(); }, exception => error?.Invoke(exception.Message)); }
public async Task<IHttpActionResult> Example() { //string csv = File.ReadAllText("C:/temp/input.csv"); using (var instream = File.OpenRead("C:/temp/input.tsv")) { var lines = CompressorCsvReader.Create(instream); var result = await CallModel.CalculateFullSet(lines); instream.Close(); return Ok(); } }
public PartialViewResult Call(int Id) { CallModel model = new CallModel(); model.IsAvailable = servicePreference.IsAvailable(Id); model.FriendData = UserFb.Friends.Where(p => p.UserId == Id).SingleOrDefault(); ServiceManager.ServiceHandlers.TiklaAraHandler srvTiklaAra = new ServiceManager.ServiceHandlers.TiklaAraHandler(); model.RemainingBalance = srvTiklaAra.GetRemainingBalance(UserFb.Data.Msisdn); return(PartialView(model)); }
public static void AddCallToHistory(CallModel call) { #if DEBUG var realm = Realm.GetInstance(new RealmConfiguration { ShouldDeleteIfMigrationNeeded = true }); #else var realm = Realm.GetInstance(); #endif realm.Write(() => realm.Add(call)); }
public void Call_ComprehensiveTest() { CallModel cmodel = new CallModel(); EmployeeModel emodel = new EmployeeModel(); ProblemModel pmodel = new ProblemModel(); Calls call = new Calls(); call.DateOpened = DateTime.Now; //call.DateClosed = null; call.OpenStatus = true; call.EmployeeId = emodel.GetByLastname("Park").Id; call.TechId = emodel.GetByLastname("Burner").Id; call.ProblemId = pmodel.GetByDescription("Hard Drive Failure").Id; call.Notes = "Jimin's drive is shot, Burner to fix it"; int newCallId = cmodel.Add(call); output.WriteLine("New Call Generated - Id = " + newCallId); call = cmodel.GetById(newCallId); byte[] oldtimer = call.Timer; output.WriteLine("New Call Retrieved"); call.Notes += "\n Ordered new drive!"; if (cmodel.Update(call) == UpdateStatus.Ok) { output.WriteLine("Call was updated " + call.Notes); } else { output.WriteLine("Call was not updated!"); } call.Timer = oldtimer; call.Notes = "doesn't matter data is stale now"; if (cmodel.Update(call) == UpdateStatus.Stale) { output.WriteLine("Call was not updated due to stale data"); } cmodel = new CallModel(); call = cmodel.GetById(newCallId); if (cmodel.Delete(newCallId) == 1) { output.WriteLine("Call was deleted!"); } else { output.WriteLine("Call was noe deleted"); } Assert.Null(cmodel.GetById(newCallId)); }
public CallEntity ConvertCall(CallModel originalCall) { CallEntity convertedCall = new CallEntity { CallId = originalCall.Id, LineId = originalCall.LineId, DateCreated = originalCall.DateActivityMade, DestinationNumber = originalCall.DestinationNumber, Duration = originalCall.Duration }; return(convertedCall); }
public void CallModel_AccountID_Valid(int Id) { //arange var call = new CallModel() { id = Id }; //act var results = TestModelHelper.Validate(call); //assert Assert.Equal(0, results.Count); }
public void CallModel_AccountID_ID_InValid_NegativeAndZero(int Id) { //arange var call = new CallModel() { id = Id }; //act var results = TestModelHelper.Validate(call); //assert Assert.NotEqual(0, results.Count); }
public static void Message() { CallModel call = new CallModel(); string call_id = ""; string result = ""; try { string query = "select myphone_callhistory_v14.call_id, dnowner, " + "party_dn, to_char(start_time, 'YYYY-MM-DD HH24:MI') as start_time, " + "to_char(end_time, 'YYYY-MM-DD HH24:MI') as end_time, " + "(date_part('second', end_time - start_time) + (date_part('minute', end_time - start_time) * 60)) as tempo, " + "to_char(established_time, 'YYYYMMDDHH24MISS') as established " + "from myphone_callhistory_v14 " + "inner join crm_integration on myphone_callhistory_v14.call_id = crm_integration.call_id " + "where crm_integration.processed = false"; NpgsqlConnection conn = Connection.GetConnection(); NpgsqlCommand command = new NpgsqlCommand(query, conn); NpgsqlDataReader rd = command.ExecuteReader(); while (rd.Read()) { result = ""; call.UrlLigacao = (string)Properties.Settings.Default["UrlLigacao"] + Util.FindDirectory(rd["dnowner"].ToString(), rd["party_dn"].ToString(), rd["established"].ToString()); call.OrigemTel = rd["dnowner"].ToString(); call.DestinoTel = rd["party_dn"].ToString(); call.DtInicioChamada = rd["start_time"].ToString(); call.DtFimChamada = rd["end_time"].ToString(); call.TempoConversacao = rd["tempo"].ToString(); result = Send(JsonConvert.SerializeObject(call), rd["call_id"].ToString()); if (result.Equals("OK")) { call_id += rd["call_id"] + " "; } } if (call_id != "") { call_id = call_id.Trim().Replace(" ", ","); NpgsqlCommand cmd = new NpgsqlCommand("update crm_integration set processed = true where call_id in (" + call_id + ")", conn); cmd.ExecuteReader(); } } catch (Exception ex) { Util.Log(ex.ToString()); } finally { Connection.CloseConnection(); } }
public void CreateCall(CallModel call) { db.Call.Add(new Call() { callType = call.callType, costCall = Convert.ToDecimal(call.costCall), dateCall = call.dateCall, idClient = call.idClient, incomingCall = call.incomingCall, numberWasCall = call.numberWasCall, timeTalk = call.timeTalk }); Save(); }
private void startCall() { CallModel.changeState("call"); //AUDIO START... AudioManager = new AudioManager(); AudioManager.Initialize(CallModel.FriendLogin, udpClient); AudioManager.StartCall(CallModel.FriendAddressIP); AudioManager.ListenForMessage("XD", "XD"); if (pastState == "create") { CallModel.RestWebApiRequest.ReceivedCall(CallModel.Login, CallModel.Password, CallModel.CallID, "true"); } }
public void ComprehensiveModelTestsShouldReturnTrue() { CallModel cmodel = new CallModel(); EmployeeModel emodel = new EmployeeModel(); ProblemModel pmodel = new ProblemModel(); Call call = new Call(); call.DateOpened = DateTime.Now; call.DateClosed = null; call.OpenStatus = true; call.EmployeeId = emodel.GetByLastname("Jarocki").Id; call.TechId = emodel.GetByLastname("Burner").Id; call.ProblemId = pmodel.GetByDescription("Hard Drive Failure").Id; call.Notes = "Kevin's drive is shot, Burner to fix it"; int newCallId = cmodel.Add(call); Console.WriteLine("New Call Generated - Id = " + newCallId); call = cmodel.GetById(newCallId); byte[] oldtimer = call.Timer; Console.WriteLine("New Call Retrieved"); call.Notes += "\n Ordered new RAM!"; if (cmodel.Update(call) == UpdateStatus.Ok) { Console.WriteLine("Call was updated " + call.Notes); } else { Console.WriteLine("Call was not updated!"); } call.Timer = oldtimer; if (cmodel.Update(call) == UpdateStatus.Stale) { Console.WriteLine("Call was not updated due to stale data"); } cmodel = new CallModel(); call = cmodel.GetById(newCallId); if (cmodel.Delete(newCallId) == 1) { Console.WriteLine("call was deleted!"); } else { Console.WriteLine("call was not deleted"); } Assert.IsNull(cmodel.GetById(newCallId)); }
public static List <CallModel> PopulateCallData(AirCallModel[] airCallData) { var listOfCalls = new List <CallModel>(); if (airCallData != null) { foreach (var allCalls in airCallData) { if (allCalls.Calls != null && allCalls.Calls.Any()) { foreach (var individualCall in allCalls.Calls) { var model = new CallModel { CallId = Convert.ToInt32(individualCall.Id), Status = individualCall.Status, Duration = individualCall.Duration, Direction = individualCall.Direction, MissedCallReason = individualCall.MissedCallReason, StartedAt = TransformationHelper.UnixTimeStampToDateTime(Convert.ToDouble(individualCall.StartedAt)), AnsweredAt = TransformationHelper.UnixTimeStampToDateTime(Convert.ToDouble(individualCall.AnsweredAt)), EndedAt = TransformationHelper.UnixTimeStampToDateTime(Convert.ToDouble(individualCall.EndedAt)) }; if (individualCall.AssignedTo != null) { if (individualCall.AssignedTo.Name != null) { model.AssignedTo = individualCall.AssignedTo.Name; } if (individualCall.AssignedTo.Email != null) { model.AssignedToEmail = individualCall.AssignedTo.Email; } } if (individualCall.User?.Name != null) { model.UserName = individualCall.User.Name; } listOfCalls.Add(model); } } } } return(listOfCalls); }
private CallModel GenerateCall(LineModel line) { Thread.Sleep(5); var gen = new Generator(); var newCall = new CallModel { LineId = line.LineId, DestinationNumber = gen.GeneratePhoneNumber(), Duration = gen.GenerateCallDuration(), DateActivityMade = gen.GenerateDate() }; return(newCall); }
public void SaveCall(CallModel callModel) { var existingCallRecord = DataAccessStatistics.Calls.SingleOrDefault(x => x.CallId == callModel.CallId); if (existingCallRecord == null && !DataAccessStatistics.Calls.Any(x => x.CallId == callModel.CallId)) { DataAccessStatistics.Calls.Add(callModel.CallModelToDomainObject()); } else if (existingCallRecord != null)//update { DataAccessStatistics.Entry(existingCallRecord).CurrentValues.SetValues(callModel); } DataAccessStatistics.SaveChanges(); }
private IEnumerable <CallModel> GenerateCallsForLine(LineModel line) { Random rnd = new Random(); int amountOfCalls = rnd.Next(maxValue); // randomise number of calls to generate List <CallModel> calls = new List <CallModel>(); for (int i = 0; i < amountOfCalls; i++) { CallModel newCall = GenerateCall(line); if (newCall != null) { calls.Add(newCall); } } return(calls); }
public static Call CallModelToDomainObject(this CallModel model) { return(new Call() { CallId = model.CallId, Status = model.Status, MissedCallReason = model.MissedCallReason, AnsweredAt = model.AnsweredAt, AssignedTo = model.AssignedTo, AssignedToEmail = model.AssignedToEmail, Direction = model.Direction, Duration = model.Duration, EndedAt = model.EndedAt, StartedAt = model.StartedAt, UserName = model.UserName, }); }
public Task <ResponseModel> CallService(string WinAddr, string PlateNo) { return(Task.Run(() => { ResponseModel responseModel = new ResponseModel(); CallModel callEntity = null; try { var obj = new { cmd = "Call", CallerAddr = WinAddr, CardNo = PlateNo }; string requestStr = JsonConvert.SerializeObject(obj); Hashtable hashtable = new Hashtable(); hashtable.Add("data", requestStr); var content = $"data={requestStr}"; var retString = ""; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(AppHelper.AppSetting.CallServiceUrl + (content == "" ? "" : "?") + content); //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "GET"; request.ContentType = "application/json";; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (Stream myResponseStream = response.GetResponseStream()) { using (StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8)) { retString = myStreamReader.ReadToEnd(); } } callEntity = JsonConvert.DeserializeObject <CallModel>(HttpUtility.HtmlDecode(retString)); responseModel.Code = 1; responseModel.Message = "请求成功"; } catch (Exception ex) { responseModel.Code = 0; responseModel.Message = ex.Message; } return responseModel; })); }
public int InsertCallList(CallModel mCall) { CALL_LIST cl = new CALL_LIST(); cl.CAT_ID = mCall.PhoneCatInfo.CatId; cl.CREATE_DATE = GetDBTime; cl.CREATE_USERID = mCall.CommonInfo.CreateUserId; cl.END_TIME = mCall.CommonInfo.EndDate; cl.FREE_ID = mCall.FreeId; cl.PHONE = mCall.RoomInfo.RoomPhone; cl.ROOM_ID = mCall.RoomInfo.RoomId; cl.START_TIME = mCall.CommonInfo.StartDate; cl.STAY_ID = mCall.StayId; dc.CALL_LIST.InsertOnSubmit(cl); dc.SubmitChanges(); return(cl.LIST_ID); }
public CallViewModel(string login, string password, string friendAvatar, string friendLogin, string address_ip, string call_id, string state, CallWindow window, UdpClient udp) { callWindow = window; udpClient = udp; CallModel = new CallModel(login, password, friendAvatar, friendLogin, address_ip, call_id, state); CallModel.Message = "message"; CallModel.Chat.Add("test"); CallModel.Chat.Add("test2"); CallModel.Chat.Add("test3"); sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sck.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); if (state == "create") { MY_PORT = SENDER_PORT; FRIEND_PORT = RECEIVED_PORT; } else { MY_PORT = RECEIVED_PORT; FRIEND_PORT = SENDER_PORT; } MY_ADDRESS_IP = new IPHelpfulFunktions().GetLocalIPAddress(); try { epLocal = new IPEndPoint(IPAddress.Parse(MY_ADDRESS_IP), Convert.ToInt32(MY_PORT)); sck.Bind(epLocal); epRemote = new IPEndPoint(IPAddress.Parse(CallModel.FriendAddressIP), Convert.ToInt32(FRIEND_PORT)); sck.Connect(epRemote); byte[] buffer = new byte[1500]; sck.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref epRemote, new AsyncCallback(MessageCallBack), buffer); } catch (Exception exp) { //MessageBox.Show(exp.ToString()); MessageBox.Show(friendLogin + " prawdopodobnie nie jest w sieci lokalnej i połączenie z niem nie jest możliwe."); CallModel.IsNotInLocalNewtwork = true; } }
public List <CallModel> GetCallList(CallModel mCall, ObjectControls oCtrl) { string sql = @"SELECT A.LIST_ID, A.ROOM_ID, A.PHONE, A.STAY_ID, A.FREE_ID, A.CAT_ID, A.START_TIME, A.END_TIME, A.CREATE_DATE, A.CREATE_USERID, B.CAT_DESC, B.CAT_RATE, C.ROOM_NO FROM CALL_LIST AS A INNER JOIN PHONE_CAT AS B ON A.CAT_ID = B.CAT_ID INNER JOIN BAS_ROOM_INFO AS C ON A.ROOM_ID = C.ROOM_ID"; oCtrl.Helper(oCtrl.Exsit(MCtrl.ByPhone) && oCtrl.Append(ref sql, " AND A.PHONE=" + mCall.RoomInfo.RoomPhone)); oCtrl.Helper(oCtrl.Exsit(MCtrl.ByStayId) && oCtrl.Append(ref sql, " AND A.STAY_ID=" + mCall.StayId)); oCtrl.Helper(oCtrl.Exsit(MCtrl.ByFreeId) && oCtrl.Append(ref sql, " AND A.FREE_ID=" + mCall.FreeId)); oCtrl.Helper(oCtrl.Exsit(MCtrl.ByCatId) && oCtrl.Append(ref sql, " AND A.CAT_ID=" + mCall.PhoneCatInfo.CatId)); oCtrl.Helper(oCtrl.Exsit(MCtrl.ByRoomId) && oCtrl.Append(ref sql, " AND A.ROOM_ID=" + mCall.RoomInfo.RoomId)); oCtrl.Helper(oCtrl.Exsit(MCtrl.ByRoomNo) && oCtrl.Append(ref sql, " AND C.ROOM_NO=" + mCall.RoomInfo.RoomNo)); oCtrl.Helper(oCtrl.Exsit(MCtrl.ByListId) && oCtrl.Append(ref sql, " AND A.LIST_ID=" + mCall.ListId)); sdr = ExecuteReader(sql); using (sdr) { List <CallModel> listCall = new List <CallModel>(); while (sdr.Read()) { CallModel mCallNew = new CallModel(); mCallNew.ListId = ToInt32(sdr["LIST_ID"]); mCallNew.RoomInfo.RoomId = ToInt32(sdr["ROOM_ID"]); mCallNew.RoomInfo.RoomNo = ToString(sdr["ROOM_NO"]); mCallNew.RoomInfo.RoomPhone = ToString(sdr["PHONE"]); mCallNew.StayId = ToInt32(sdr["STAY_ID"]); mCallNew.FreeId = ToInt32(sdr["FREE_ID"]); mCallNew.PhoneCatInfo.CatId = ToInt32(sdr["CAT_ID"]); mCallNew.PhoneCatInfo.CatDesc = ToString(sdr["CAT_DESC"]); mCallNew.PhoneCatInfo.CatRate = ToDouble(sdr["CAT_RATE"]); mCallNew.CommonInfo.StartDate = ToDateTime(sdr["START_TIME"]); mCallNew.CommonInfo.EndDate = ToDateTime(sdr["END_TIME"]); mCallNew.CommonInfo.CreateDate = ToDateTime(sdr["CREATE_DATE"]); mCallNew.CommonInfo.CreateUserId = ToInt32(sdr["CREATE_USERID"]); listCall.Add(mCallNew); } return(listCall); } }
public IActionResult Index(CallModel model) { // Apply input history from cookie var cu = ControllerUtils.From(this); cu.PersistInput("Uri", model, CallModel.Default.Uri); cu.PersistInput("Method", model, CallModel.Default.Method); cu.PersistInput("Body", model, CallModel.Default.Body); model.SampleUri = $"{Request.Scheme}://{Request.Host}/api/Dummy?a=11&b=22"; if (!model.SkipCall) { Task <HttpResponseMessage> task = null; switch (model.Method) { case "(unknown)": case "GET": task = HTTP.GetAsync(model.Uri); model.Method = "GET"; break; case "POST": task = HTTP.PostAsync(model.Uri, new StringContent(model.Body)); break; default: var req = new HttpRequestMessage { Method = GetMethod(model.Method), RequestUri = new Uri(model.Uri), Content = new StringContent(model.Body), }; task = HTTP.SendAsync(req); break; } model.Set(task); } model.SkipCall = false; return(View(model)); }