Exemplo n.º 1
0
        public ActionResult GetContactsDropDown(string CompanyIdentifier)
        {
            string companyCondition = "CompanyIdentifier = '" + CompanyIdentifier + "'";

            _contactApi = new ContactApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1");
            _companyApi = new CompanyApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1");


            List <CompanyFindResult> list2 = _companyApi.FindCompanies(companyCondition, "Id asc", new int?(100000), new int?(0), new List <string>
            {
                "Id",
                "CompanyName",
                "CompanyIdentifier"
            });
            int companyId = list2.FirstOrDefault().Id;

            string conditions = "CompanyId = " + companyId;


            List <ContactFindResult> Contactlst = _contactApi.FindContacts(conditions, "", new int?(1000), new int?(0), "", new List <string>
            {
                "Id",
                "FirstName",
                "LastName",
                "Type",
                "CompanyId"
            });

            var query = Contactlst.Select(a => new
            {
                Id   = a.Id,
                Name = a.FirstName + " " + a.LastName
            }).ToList();


            return(Json(new SelectList(query.ToArray(), "Id",
                                       "Name"), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        //public ActionResult Test()
        //{
        //    // _memberApi = new MemberApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1");
        //    // List<MemberFindResult> list2 = _memberApi.FindMembers("", "FirstName asc", new int?(1000), new int?(0), new List<string>());
        //    ServiceTicketApi _serviceTicketApi;
        //    _serviceTicketApi = new ServiceTicketApi("https://api-eu.myconnectwise.net", "novaram", "callcenter", "Test123!", "NovaramCred");
        //    var result = _serviceTicketApi.FindServiceTickets("","",new int?(1000),new int?(0),false ,new List<string>());


        //    return View();
        //}

        public int GetContactsId(string Contact)
        {
            string conditions = "Phone = '" + Contact + "'";

            _contactApi = new ContactApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1");
            //_companyApi = new CompanyApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1");


            //List<CompanyFindResult> list2 = _companyApi.FindCompanies(companyCondition, "Id asc", new int?(100000), new int?(0), new List<string>
            //{
            //    "Id",
            //    "CompanyName",
            //    "CompanyIdentifier"
            //});
            //int companyId = list2.FirstOrDefault().Id;

            //string conditions = "CompanyId = " + companyId;


            List <ContactFindResult> Contactlst = _contactApi.FindContacts(conditions, "", new int?(1000), new int?(0), "", new List <string>
            {
                "Id",
                "FirstName",
                "LastName",
                "Type",
                "CompanyId"
            });

            var query = Contactlst.Select(a => new
            {
                Id   = a.Id,
                Name = a.FirstName + " " + a.LastName
            }).ToList();


            return(query.FirstOrDefault().Id);
        }
Exemplo n.º 3
0
        //    public ActionResult EndCall(string PhoneNo, string Ext)
        //    {
        //        if (Session["Call"] != null)
        //        {

        //            if (Session["Call"].ToString() == PhoneNo)
        //            {

        //                string Name = "";
        //                string conditions = "Phone = '" + PhoneNo + "'";
        //                List<ContactFindResult> list3 = _contactApi.FindContacts(conditions, "", new int?(1000), new int?(0), "", new List<string>
        //{
        //    "Id",
        //    "FirstName",
        //    "LastName",
        //    "Type",
        //    "CompanyId",
        //    "CompanyName"
        //});
        //                if (list3.Count > 0)
        //                {
        //                    Name = list3[0].FirstName + " " + list3[0].LastName;
        //                }
        //                TimeSpan duration = DateTime.Now - DateTime.Parse(Session["CallTime"].ToString());

        //                CallHistory tableobj = new Models.CallHistory();

        //                tableobj.CallDate = DateTime.Now;
        //                tableobj.ContactNo = PhoneNo;
        //                tableobj.Name = Name;
        //                tableobj.UserExtension = Ext;
        //                tableobj.CallTime = duration.Hours.ToString() + ":" + duration.Minutes.ToString() + ":" + duration.Seconds.ToString();
        //                db.CallHistories.Add(tableobj);
        //                db.SaveChanges();


        //                Session["Call"] = null;
        //            }
        //        }
        //        string text3 = "<?xml version='1.0' encoding='UTF-8' ?><response><result><call_url/></result></response>";
        //        return base.Content(text3, "text/xml");

        //        //return View();
        //    }



        public ActionResult Index(string callerID = "2242307730")
        {
            if (callerID.StartsWith(" 1"))
            {
                callerID = callerID.Remove(0, 2);
            }
            else if (callerID.StartsWith("1"))
            {
                callerID = callerID.Remove(0, 1);
            }
            else if (callerID.StartsWith("%2B1"))
            {
                callerID = callerID.Remove(0, 3);
            }
            else if (callerID.StartsWith("+1"))
            {
                callerID = callerID.Remove(0, 2);
            }
            else if (callerID.StartsWith(" "))
            {
                callerID = callerID.Remove(0, 0);
            }
            string arg_80_0 = string.Empty;
            string str      = string.Empty;

            _contactApi = new ContactApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1");
            new List <ContactModel>();
            ContactModel obj = new ContactModel();

            obj.Phone = callerID;
            string conditions = "Phone = '" + callerID + "'";
            List <ContactFindResult> list3 = _contactApi.FindContacts(conditions, "", new int?(1000), new int?(0), "", new List <string>
            {
                "Id",
                "FirstName",
                "LastName",
                "Type",
                "CompanyId",
                "CompanyName"
            });

            if (list3.Count > 0)
            {
                ViewBag.Contact = 1;

                foreach (ContactFindResult current2 in list3)
                {
                    obj.CompanyID   = current2.CompanyId;
                    obj.FirstName   = current2.FirstName;
                    obj.LastName    = current2.LastName;
                    obj.Type        = current2.Type;
                    obj.CompanyName = current2.CompanyName;
                    obj.ContactId   = current2.Id;
                }
            }
            // var phoneno = "2242307730";
            conditions   = "PhoneNumber= '" + callerID + "'";
            _activityApi = new ActivityApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1");
            List <ActivityFindResult> activitylist = _activityApi.FindActivities(conditions, "", new int?(100000), new int?(0), new List <string>
            {
                "Id",
                "Subject",
                "Notes",
                "AssignToResource",
                "DueDate",
                "ActivityTypeDescription",
                "StartTime"
            });

            foreach (ActivityFindResult currentactivity in activitylist)
            {
                obj.ActivityList.Add(new ActivityModel
                {
                    ActivityTypeDescription = currentactivity.ActivityTypeDescription,
                    AssignTo = currentactivity.AssignToResource,
                    Notes    = currentactivity.Notes,
                    DueDate  = currentactivity.StartTime,
                    Subject  = currentactivity.Subject
                });
            }

            // ViewBag.CallHistory = db.CallHistories.Where(x => x.UserExtension == ExtNo).OrderBy(x => x.ID).Take(10).ToList();

            return(View(obj));
        }