public void DeleteCallLog(int id) { List <NJ_Users> obj = new List <NJ_Users>(); if (id > 0) { var clog = db.NJ_User.FirstOrDefault(cl => cl.tblUserId == id); if (clog != null) { db.NJ_User.Remove(clog); db.SaveChanges(); } } }
public void ClientCertificateFiles(int id, string filePath) { var no = db.tbl_CertificateFiles.FirstOrDefault(s => s.Nj_ClientsID == id && s.FilePath == filePath); if (no == null) { tbl_CertificateFiles file_path = new tbl_CertificateFiles(); file_path.FilePath = filePath; file_path.Nj_ClientsID = id; file_path.CreatedDate = DateTime.Now.Date; db.tbl_CertificateFiles.Add(file_path); db.SaveChanges(); } else { db.Entry(no).State = System.Data.EntityState.Deleted; db.SaveChanges(); tbl_CertificateFiles file_path = new tbl_CertificateFiles(); file_path.FilePath = filePath; file_path.Nj_ClientsID = id; file_path.CreatedDate = DateTime.Now.Date; db.tbl_CertificateFiles.Add(file_path); db.SaveChanges(); } }
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(); }
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; } }
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; } }
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(); } }