/// <summary>
        /// Returns CustomerID by LeadID
        /// </summary>
        /// <param name="LeadID">LeadID</param>
        /// <returns>CustomerID</returns>
        public int GetCustomerID(int LeadID)
        {
            int CustomerID = 0;
            string ProcName = System.Configuration.ConfigurationManager.AppSettings["Customers__GetByLeadID"].ToString();
            string[] ProcParm = new string[] { LeadID.ToString() };

            IR_Dashboard_SDK.AquariumCustomProcessing.CustomProcessingSoapClient customsdk = new IR_Dashboard_SDK.AquariumCustomProcessing.CustomProcessingSoapClient();
            IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult result = new IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult();

            AquariumCustomProcessing.SessionDetails sd = SDKHelper.GetSessionDetails<AquariumCustomProcessing.SessionDetails>("User");
            result = customsdk.RunCustomProc(sd, ProcName, ProcParm);

            if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.OK)
            {
                DataTable dt = SDKHelper.GetDataTableFromSdkResult(result.Data.Columns, result.Data.Rows);
                CustomerID = Convert.ToInt32(dt.Rows[0]["CustomerID"]);
            }
            else if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.Failed)
            {
                throw new System.ApplicationException("Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description);
            }
            return CustomerID;
        }
        /// <summary>
        /// Get All Claims missing Diary Tasks for a User
        /// </summary>
        /// <param name="ID">ClientPersonnelID</param>
        public void GetUserClaimsWithNoDiaryTask(int ID)
        {
            string ProcName = System.Configuration.ConfigurationManager.AppSettings["GetUserClaimsWithNoDiaryTask"].ToString();
            string[] ProcParm = new string[] { ID.ToString() };

            IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult result = new IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult();

            AquariumCustomProcessing.SessionDetails sd = SDKHelper.GetSessionDetails<AquariumCustomProcessing.SessionDetails>("User");
            result = customsdk.RunCustomProc(sd, ProcName, ProcParm);

            if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.OK)
            {
                UserClaims = ToList(result.Data);
                GetAllUsers();

            }
            else if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.Failed)
            {
                throw new System.ApplicationException("Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description);
            }
        }
        /// <summary>
        /// Get all pages for a lead type
        /// </summary>
        /// <param name="LeadID">LeadID</param>
        public void GetDiaryDetailFieldPages(int LeadID)
        {
            Lead Leads = new Lead();
            int LeadTypeID = Leads.GetLeadTypeID(LeadID);

            string ProcName = System.Configuration.ConfigurationManager.AppSettings["Get_DetailFieldPageIDsForLeadTypeID"].ToString();
            string[] ProcParm = new string []{ LeadTypeID.ToString(), LeadID.ToString() };

            IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult result = new IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult();

            AquariumCustomProcessing.SessionDetails sd = SDKHelper.GetSessionDetails<AquariumCustomProcessing.SessionDetails>("User");

            AquariumCustomProcessing.CustomProcessingSoapClient customsdk = new AquariumCustomProcessing.CustomProcessingSoapClient();

            result = customsdk.RunCustomProc(sd, ProcName, ProcParm);

            if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.OK)
            {
                DiaryDetailFieldPageList = ToPageList(result.Data);
            }
            else if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.Failed)
            {
                throw new System.ApplicationException("Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description);
            }
        }
        /// <summary>
        /// Gets Count  for Updated DiaryAppointments
        /// </summary>
        public void GetUpdatedAppointmentsCount()
        {
            string ProcName = System.Configuration.ConfigurationManager.AppSettings["GetDiaryAppointmentsUpdatedTodayCount"].ToString();
            string[] ProcParm = null;

            IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult result = new IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult();

            AquariumCustomProcessing.SessionDetails sd = SDKHelper.GetSessionDetails<AquariumCustomProcessing.SessionDetails>("User");

            result = customsdk.RunCustomProc(sd, ProcName, ProcParm);
            if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.OK)
            {
                UpdatedAppointmentsCount = ToCustomList(result.Data);

            }
            else if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.Failed)
            {
                throw new System.ApplicationException("Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description);
            }
        }
        /// <summary>
        /// Gets Count  for Settled Claims
        /// </summary>
        public void GetSettledCount()
        {
            string ProcName = System.Configuration.ConfigurationManager.AppSettings["GetSettledClaimsCount"].ToString();
            string[] ProcParm = new string[] { String.Format("{0:M/d/yyyy HH:mm}", DateTime.Now.AddDays(-(DateTime.Now.Day - 1)).Date) };

            IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult result = new IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult();
            AquariumCustomProcessing.SessionDetails sd = SDKHelper.GetSessionDetails<AquariumCustomProcessing.SessionDetails>("User");
            result = customsdk.RunCustomProc(sd, ProcName, ProcParm);

            if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.OK)
            {
                SettledClaimsCount = ToClaimList(result.Data);

            }
            else if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.Failed)
            {
                throw new System.ApplicationException("Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description);
            }
        }
        /// <summary>
        /// Get DiaryAppointmets for a User
        /// </summary>
        /// <param name="ID">ClientPersonnelID</param>
        /// <param name="Completed">IsCompleted (true/false)</param>
        /// <returns>true/false</returns>
        public bool GetAppointments(int ID,int Completed)
        {
            bool diaryResult = false;
            IR_Dashboard_SDK.AquariumCustomProcessing.CustomProcessingSoapClient customsdk = new IR_Dashboard_SDK.AquariumCustomProcessing.CustomProcessingSoapClient();

            string ProcName = System.Configuration.ConfigurationManager.AppSettings["GetAllAppointmentsSPName"].ToString();
            string[] ProcParm = new string[] { String.Format("{0:M/d/yyyy HH:mm}", StartDate), String.Format("{0:M/d/yyyy HH:mm}", EndDate), ID.ToString(), Completed.ToString() };

            IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult result = new IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult();
            AquariumCustomProcessing.SessionDetails sd = SDKHelper.GetSessionDetails<AquariumCustomProcessing.SessionDetails>("User");
            result = customsdk.RunCustomProc(sd, ProcName, ProcParm);

            if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.OK)
            {
                Appointments = ToList(result.Data);
                diaryResult = true;
                GetAllUsers();

                if (Appointments.Count > 0)
                {
                    DiaryPriorities[0].GetAllDiaryPriorities();
                }
                else
                {
                    DiaryPriorities = new List<DiaryPriority>();
                    DiaryPriority dp = new DiaryPriority();
                    dp.GetAllDiaryPriorities();
                    DiaryPriorities.Add(dp);
                }

            }
            else if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.Failed)
            {
                throw new System.ApplicationException("Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description);
            }

            return diaryResult;
        }
        /// <summary>
        /// helper method to get matterID
        /// </summary>
        /// <param name="LeadID">LeadID</param>
        /// <returns>MatterID</returns>
        public static int GetMatterByLeadID(int LeadID)
        {
            try
            {

                int MatterID = 0;

                string ProcName = System.Configuration.ConfigurationManager.AppSettings["GetMatterByLeadID"].ToString();
                string[] ProcParm = new string[1];
                ProcParm[0] = LeadID.ToString();

                IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult result = new IR_Dashboard_SDK.AquariumCustomProcessing.ReportResult();

                AquariumCustomProcessing.SessionDetails sd = SDKHelper.GetSessionDetails<AquariumCustomProcessing.SessionDetails>("User");

                AquariumCustomProcessing.CustomProcessingSoapClient customsdk = new AquariumCustomProcessing.CustomProcessingSoapClient();

                result = customsdk.RunCustomProc(sd, ProcName, ProcParm);

                if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.OK)
                {
                    var resultsList = result.Data.Rows[0].ToList();
                    MatterID = Int32.Parse(resultsList[0].ToString());

                    return MatterID = MatterID > 0 ? MatterID : -1;
                }

                else if (result.ResultInfo.ReturnCode == AquariumCustomProcessing.BasicCode.Failed)
                {
                    throw new System.ApplicationException("Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description);
                }

                return -1;

            }
            catch (Exception ex) { throw ex; }
        }