public ActionResult SubmitNewTelephoneNumber(TelephoneNumberInfo aTelephoneNumberInfo)
        {
            if (aTelephoneNumberInfo.ConnectionTypeID.Trim().Length == 0
                || aTelephoneNumberInfo.PhoneNumber.Trim().Length == 0)
            {
                ViewData["Message"] = "Error! Fill All Fields";
                return View("AddNewTelephoneNumber");
            }

            TelephoneNumber aNumber = new TelephoneNumber();
            string message = aNumber.AddNewTelephoneNumber(aTelephoneNumberInfo);
            ViewData["Message"] = message;
            return View("AddNewTelephoneNumber");
        }
        public ActionResult GetActivePhoneDataProviderAction(JQueryDataTableParamModel aModel)
        {
            string baNumber = Convert.ToString(Request["sSearch_0"]);
            string name = Convert.ToString(Request["sSearch_1"]);
            string palteName = Convert.ToString(Request["sSearch_2"]);
            string requestDate = Convert.ToString(Request["sSearch_3"]);
            string phoneNumber = Convert.ToString(Request["sSearch_4"]);
            string rank = Convert.ToString(Request["sSearch_5"]);

            string[] dates = Regex.Split(requestDate, "-yadcf_delim-");
            string fromDate = string.Empty;
            string toDate = string.Empty;
            if (dates.Count() == 2)
            {
                fromDate = dates[0];
                toDate = dates[1];
            }
            if (dates.Count() == 1)
            {
                fromDate = dates[0];
            }
            TelephoneNumber aRequest = new TelephoneNumber();
            int totalRecords = 0;
            int filteredRecord = 0;
            List<string[]> terminatedHistory = aRequest.GetActivePhoneNumberDetails(out totalRecords, out filteredRecord,
                baNumber, name, palteName, fromDate, toDate, phoneNumber, rank, aModel.iDisplayStart,
                aModel.iDisplayLength);

            return Json(new
            {
                sEcho = aModel.sEcho,
                iTotalRecords = filteredRecord,
                iTotalDisplayRecords = totalRecords,
                aaData = terminatedHistory
            }, JsonRequestBehavior.AllowGet);
        }
        public ActionResult SearchRequestNewForm()
        {
            string baNumber = Request["BANumberSearch"].Trim().ToString();
            string reqType = Request["reqType"].Trim().ToString();
            string addressType = Request["AddressType"].Trim().ToString();
            string connectionType = Request["ConnectionType"].Trim().ToString();
            if (baNumber.Length == 0 || reqType.Length == 0 || reqType == "--Request Type--")
            {
                ViewData["Message"] = "Error! Complete Search Fields";
                ViewData["baNumber"] = baNumber;
                ViewData["reqType"] = reqType;
                ViewData["addressType"] = addressType;
                ViewData["connectionType"] = connectionType;

                return View("Index");
            }

            TelephoneNumber aTelephoneNumber = new TelephoneNumber();
            TelephoneUser aUser = new TelephoneUser();
            TelephoneUserInfo aInfo = aUser.GetTelephoneUserInfo(baNumber);

            if (aInfo.BANumber == null)
            {
                string url = UtilityLibrary.GetBaseURL() + "TelephoneUser/AddTelephoneUser";
                ViewData["Message"] = "Error! Telephone User not found. To Add Telephone User Click <a href=\""+url+"\" style=\"color: blue;\">Here</a>";
                ViewData["baNumber"] = baNumber;
                ViewData["reqType"] = reqType;
                ViewData["addressType"] = addressType;
                ViewData["connectionType"] = connectionType;
                return View("Index");
            }

            ViewData["UserInfo"] = aInfo;
            ViewData["AddressType"] = addressType;
            ViewData["ConnectionType"] = connectionType;

            if (reqType == "1")
            {
                if (addressType == "Office")
                {
                    ViewData["Address"] = aInfo.OfficeAddress;
                }
                else
                {
                    ViewData["Address"] = aInfo.PresentAddress;
                }
                ViewData["RequestType"] = "New Connection";
                ViewData["AvailableNumbers"] = aTelephoneNumber.GetAvailableTelephoneNumberForNewConnection(connectionType);
                ViewData["baNumber"] = baNumber;
                ViewData["reqType"] = reqType;
                ViewData["addressType"] = addressType;
                ViewData["connectionType"] = connectionType;
                return View("Index");
            }
            if (reqType == "2")
            {
                if (addressType == "Office")
                {
                    ViewData["Address"] = aInfo.OfficeAddress;
                }
                else
                {
                    ViewData["Address"] = aInfo.PresentAddress;
                }
                ViewData["RequestType"] = "Shifting";
                ViewData["AvailableNumbers"] = aTelephoneNumber.GetAllotedNumbersForExistingUser(connectionType,addressType,baNumber);
                ViewData["baNumber"] = baNumber;
                ViewData["reqType"] = reqType;
                ViewData["addressType"] = addressType;
                ViewData["connectionType"] = connectionType;
                return View("Index");
            }
            if (reqType == "3")
            {
                if (addressType == "Office")
                {
                    ViewData["Address"] = aInfo.OfficeAddress;
                }
                else
                {
                    ViewData["Address"] = aInfo.PresentAddress;
                }
                ViewData["RequestType"] = "Termination";
                ViewData["AvailableNumbers"] = aTelephoneNumber.GetAllotedNumbersForExistingUser(connectionType, addressType, baNumber);
                ViewData["baNumber"] = baNumber;
                ViewData["reqType"] = reqType;
                ViewData["addressType"] = addressType;
                ViewData["connectionType"] = connectionType;
                return View("Index");
            }

            ViewData["baNumber"] = baNumber;
            ViewData["reqType"] = reqType;
            ViewData["addressType"] = addressType;
            ViewData["connectionType"] = connectionType;
            return View("Index");
        }