//public void LogException(Exception e, string extraInfo = null)
        //{

        //    SecurityAgencyEntities context = new SecurityAgencyEntities();

        //    Error_Log obj = new Error_Log();
        //    obj.Message = e.Message;

        //    if (!string.IsNullOrEmpty(extraInfo))
        //        obj.Message = obj.Message + "<br/> Extar Info :" + extraInfo;

        //    obj.Source = e.Source;
        //    obj.StackTrace = e.StackTrace;
        //    obj.TargetSite = e.TargetSite.ToString();
        //    obj.ErrorDate = DateTime.Now;
        //    obj.ExceptionDetail = e.ToString();

        //    DateTime dt = (DateTime)obj.ErrorDate;


        //    context.Error_Log.InsertOnSubmit(obj);
        //    try
        //    {
        //        context.Error_Log.SubmitChanges();

        //    }
        //    catch
        //    {
        //    }

        //}
        public List<CustomerViewModel> GetCustomersForReport(string startDate, string endDate)
        {
            DateTime? _startDate = null;
            DateTime? _endDate = null;
            if (startDate != "") { _startDate = Convert.ToDateTime(startDate); };
            if (endDate != "") { _endDate = Convert.ToDateTime(endDate); };
            SecurityAgencyEntities ob = new SecurityAgencyEntities();
            List<getAllCustomers_Result> customer = ob.getAllCustomers(_startDate, _endDate).ToList();

            if (customer == null)
                return null;

            Mapper.CreateMap<getAllCustomers_Result, CustomerViewModel>();
            return Mapper.Map<List<getAllCustomers_Result>, List<CustomerViewModel>>(customer);
        }