Example #1
0
        public NJ_CallLogs CallLogDetails(int Id = 0)
        {
            NJ_CallLogs model = new NJ_CallLogs();

            try
            {
                using (NJTicketEntities db = new NJTicketEntities())
                {
                    var data = db.NJ_CallLog.FirstOrDefault(cl => cl.Id == Id);
                    //db.NJ_CallLog.ToList();
                    if (data != null)
                    {
                        model.FirstName = data.FirstName;
                        model.LastName  = data.LastName;
                        model.Phone     = data.Phone;
                        model.Notes     = data.Notes;
                    }
                }
                return(model);
            }
            catch (Exception cc)
            {
                throw cc;
            }
        }
Example #2
0
        public void AddSearchHistory(string FirstName, string LastName, string DOB)
        {
            NJTicketEntities     db      = new NJTicketEntities();
            tbl_APISearchHistory history = new tbl_APISearchHistory();

            history.First_Name = FirstName;
            history.Last_Name  = LastName;
            history.DOB        = DOB;
            history.SearchBy   = Convert.ToInt32(HttpContext.Current.Request.Cookies["LoginId"].Value);;
            history.SearchDate = DateTime.Now;
            db.tbl_APISearchHistory.Add(history);
            db.SaveChanges();
        }
Example #3
0
 public void DeleteCallLog(int id = 0)
 {
     try
     {
         NJTicketEntities db          = new NJTicketEntities();
         NJ_CallLog       obj_CallLog = new NJ_CallLog();
         if (id > 0)
         {
             var clog = db.NJ_CallLog.FirstOrDefault(cl => cl.Id == id);
             if (clog != null)
             {
                 db.NJ_CallLog.Remove(clog);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception cc)
     {
         throw cc;
     }
 }
Example #4
0
 public void AddCallLog(int id = 0, string FirstName = "", string LastName = "", string Phone = "", string Notes = "", string User = "")
 {
     HttpContext.Current.Session["LoginId"] = HttpContext.Current.Request.Cookies["LoginId"].Value;
     try
     {
         NJTicketEntities db          = new NJTicketEntities();
         NJ_CallLog       obj_CallLog = new NJ_CallLog();
         if (id > 0)
         {
             var clog = db.NJ_CallLog.FirstOrDefault(cl => cl.Id == id);
             if (clog != null)
             {
                 clog.FirstName = FirstName;
                 clog.LastName  = LastName;
                 clog.Phone     = Phone;
                 clog.Notes     = Notes;
                 clog.Users     = User;
             }
         }
         else
         {
             obj_CallLog.FirstName = FirstName;
             obj_CallLog.LastName  = LastName;
             obj_CallLog.Phone     = Phone;
             obj_CallLog.Notes     = Notes;
             obj_CallLog.DateAdded = DateTime.Now;
             obj_CallLog.AddedBy   = Convert.ToInt32(HttpContext.Current.Session["LoginId"]);
             obj_CallLog.Users     = User;
             db.NJ_CallLog.Add(obj_CallLog);
         }
         db.SaveChanges();
     }
     catch (Exception cc)
     {
         throw cc;
     }
 }
Example #5
0
        public List <NJ_CallLogs> CallLogs(string Search = "", string Search1 = "")
        {
            List <NJ_CallLogs> list = new List <NJ_CallLogs>();

            try
            {
                using (NJTicketEntities db = new NJTicketEntities())
                {
                    DateTime startdate = DateTime.Now;
                    DateTime LastDate  = DateTime.Now;
                    //  UserList user = new UserList();

                    switch (Search)
                    {
                    //Today
                    case ("1"):
                        startdate = DateTime.Today;
                        LastDate  = DateTime.Now;
                        break;

                    //Yesterday
                    case ("2"):
                        startdate = DateTime.Today.AddDays(-1);
                        LastDate  = DateTime.Today;
                        break;

                    //ThisWeek
                    case ("3"):
                        startdate = StartOfWeek(DateTime.Now);
                        LastDate  = DateTime.Now;
                        break;

                    //ThisMonth
                    case ("4"):
                        startdate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
                        LastDate  = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month));
                        break;

                    //ThisQuarter
                    case ("5"):
                        var f = (decimal)(DateTime.Now.Month - 1) / 3;
                        var s = (int)Math.Floor(f) * 3 + 1;
                        var e = (int)(Math.Floor(f) + 1) * 3;
                        startdate = new DateTime(DateTime.Now.Year, s, 1);
                        LastDate  = new DateTime(DateTime.Now.Year, e, DateTime.DaysInMonth(DateTime.Now.Year, e));
                        break;

                    //This Year
                    case ("6"):
                        var year = DateTime.Now.Year;
                        startdate = new DateTime(year, 1, 1);
                        LastDate  = new DateTime(year, 12, DateTime.DaysInMonth(year, 12));
                        break;

                    //LastWeek
                    case ("7"):
                        startdate = StartOfWeek(DateTime.Now).AddDays(-7);
                        LastDate  = EndOfWeek(DateTime.Now).AddDays(-7);
                        break;

                    //LastTwoWeeks
                    case ("8"):
                        startdate = StartOfWeek(DateTime.Now).AddDays(-14);
                        LastDate  = EndOfWeek(DateTime.Now).AddDays(-7);
                        break;

                    //LastMonth
                    case ("9"):
                        var g = DateTime.Today.AddMonths(-1);
                        startdate = new DateTime(g.Year, g.Month, 1);
                        LastDate  = new DateTime(g.Year, g.Month, DateTime.DaysInMonth(g.Year, g.Month));
                        break;

                    //LastTwoMonths
                    case ("10"):
                        var b = DateTime.Today.AddMonths(-2);
                        startdate = new DateTime(b.Year, b.Month, 1);
                        LastDate  = new DateTime(b.Year, (b.AddMonths(1)).Month, DateTime.DaysInMonth(b.Year, (b.AddMonths(1)).Month));
                        break;

                    //PastSixMonths
                    case ("11"):
                        startdate = DateTime.Now.AddMonths(-6);
                        LastDate  = DateTime.Now;
                        break;

                    //LastYear
                    case ("12"):
                        var yr = DateTime.Now.Year - 1;
                        startdate = new DateTime(yr, 1, 1);
                        LastDate  = new DateTime(yr, 12, 31);
                        break;

                    default:
                        startdate = new DateTime(1900, 1, 1);
                        LastDate  = DateTime.Now;
                        break;
                    }

                    var clogs = from cl in db.NJ_CallLog
                                join u in db.NJ_User
                                on cl.AddedBy equals u.tblUserId
                                where ((cl.DateAdded <= LastDate || (cl.DateAdded == null && startdate == new DateTime(1900, 1, 1))) && (cl.DateAdded >= startdate || (cl.DateAdded == null && startdate == new DateTime(1900, 1, 1))) && ((cl.FirstName.Contains(Search1) || cl.LastName.Contains(Search1) || (cl.Notes.Contains(Search1) || Search1 == ""))))
                                select new
                    {
                        FirstName  = cl.FirstName,
                        LastName   = cl.LastName,
                        Phone      = cl.Phone,
                        Notes      = cl.Notes,
                        Id         = cl.Id,
                        AddedBy    = cl.AddedBy,
                        AddName    = u.First_Name,
                        DateAdded  = cl.DateAdded,
                        strDate    = cl.DateAdded,
                        TotalCount = (from cl2 in db.NJ_CallLog
                                      join u2 in db.NJ_User
                                      on cl2.AddedBy equals u2.tblUserId
                                      where ((cl2.DateAdded <= LastDate || (cl2.DateAdded == null && startdate == new DateTime(1900, 1, 1))) && (cl2.DateAdded >= startdate || (cl2.DateAdded == null && startdate == new DateTime(1900, 1, 1))) && ((cl2.FirstName.Contains(Search1) || cl2.LastName.Contains(Search1) || (cl2.Notes.Contains(Search1) || Search1 == ""))))
                                      select cl2).Count(),
                        Users = cl.Users
                    };
                    //db.NJ_CallLog.ToList();
                    foreach (var c in clogs)
                    {
                        list.Add(new NJ_CallLogs
                        {
                            FirstName    = c.FirstName,
                            LastName     = c.LastName,
                            Phone        = c.Phone,
                            Notes        = c.Notes,
                            Id           = c.Id,
                            AddedBy      = c.AddedBy,
                            DateAdded    = c.DateAdded,
                            AddedName    = c.AddName,
                            strDateAdded = (Convert.ToDateTime(c.strDate)).Month.ToString() + '/' + (Convert.ToDateTime(c.strDate)).Day.ToString() + '/' + (Convert.ToDateTime(c.strDate)).ToString("yy") + ' ' + (Convert.ToDateTime(c.strDate)).ToShortTimeString(),
                            TotalCount   = c.TotalCount,
                            Users        = c.Users
                        });
                    }
                }
                list = list.OrderByDescending(x => x.DateAdded).ToList();
                return(list);
            }
            catch (Exception cc)
            {
                throw cc;
            }
        }
Example #6
0
        public void MakeClient(string id          = "", string Type        = "", string Total     = "", string Paid      = "", string Balance = "", string Cardno        = "", string CardExpireyDate = "", string CVV = "", string Phone = "", string Email = "", string PotentialClient = "", string comment = "", int LoginId = 0,
                               string FName       = "", string LName       = "", string CourtName = "", string Address1  = "", string Address2   = "", string City       = "", string State           = "", string Zip = "",
                               string Description = "", string DOB         = "", string MI        = "", string Violation = "", string Dateissued = "", string Salutation = "", string Summons         = "",
                               string CourtID     = "", string Muncipality = "", string Complaint = "", string Title     = "", string ListType   = "", string SourceComm = "", string AddedBy         = "")
        {
            NJTicketEntities db = new NJTicketEntities();

            NJ_Clients objNj_Client = new NJ_Clients();

            objNj_Client.List_Type = ListType;
            //objNj_Client.File_Date = result.File_Date;
            objNj_Client.Court_Name = CourtName;
            //objNj_Client.CourtDate = CourtDate;
            objNj_Client.L_Name       = LName;
            objNj_Client.F_Name       = FName;
            objNj_Client.MI           = MI;
            objNj_Client.Address1     = Address1;
            objNj_Client.Address2     = Address2;
            objNj_Client.City         = City;
            objNj_Client.ST           = State;
            objNj_Client.ZIP          = Zip;
            objNj_Client.DOB          = DOB;
            objNj_Client.Violation    = Violation;
            objNj_Client.Description  = Description;
            objNj_Client.DateIssued   = Dateissued;
            objNj_Client.Salutation   = Salutation;
            objNj_Client.Summons      = Summons;
            objNj_Client.NJ_CourtID   = CourtID;
            objNj_Client.Muncipality  = Muncipality;
            objNj_Client.Complaint    = Complaint;
            objNj_Client.Title        = Title;
            objNj_Client.Payment_Type = Type;
            objNj_Client.SourceOfComm = SourceComm;

            if (Total != "")
            {
                objNj_Client.Payment_Total = Convert.ToInt32(Total);
            }
            if (Paid != "")
            {
                objNj_Client.Payment_Paid = Convert.ToInt32(Paid);
            }
            if (Balance != "")
            {
                objNj_Client.Payment_Balance = Convert.ToInt32(Balance);
            }

            objNj_Client.Payment_Cardno       = Cardno;
            objNj_Client.Payment_Card_ExpDate = CardExpireyDate;
            objNj_Client.MarkClientDate       = DateTime.Now;
            objNj_Client.Phone = Phone;
            objNj_Client.Email = Email;

            if (CVV != "")
            {
                objNj_Client.Payment_CVV = Convert.ToInt32(CVV);
            }
            int addedBy = Convert.ToInt32(AddedBy);

            objNj_Client.IsAddedBy         = addedBy;
            objNj_Client.IsPotentialClient = Convert.ToBoolean(PotentialClient);
            //if (objNj_Client.IsPotentialClient == false)
            //{
            //    objNj_Client.IsAddedBy = LoginId;
            //}
            //    objNj_Client.Comment = comment;
            db.NJ_Clients.Add(objNj_Client);
            if (id != "")
            {
                int ids    = Convert.ToInt32(id);
                var result = db.NJ_Details.FirstOrDefault(a => a.Id == ids);
                result.IsUser = true;
            }
            db.SaveChanges();
            var comments = comment.Trim();

            if (comments != "" && comment != null)
            {
                var           Insertid      = objNj_Client.Id;
                NJ_tblComment objtblcomment = new NJ_tblComment();
                objtblcomment.Comment      = comment;
                objtblcomment.UserId       = Insertid;
                objtblcomment.Comment_By   = LoginId;
                objtblcomment.Comment_Date = DateTime.Now;
                db.NJ_tblComment.Add(objtblcomment);
                db.SaveChanges();
            }
        }