public static int Edit_businessInfo(int personid, string businessname, string ownersname, string dob, string fein, string dea, string modifiedby, string modifieddate, string skippayment, string eprofile) { using (License_ConnectionDataContext pdetalinsert = new License_ConnectionDataContext()) { tbl_PersonDetail persondetail; if (personid == 0) { persondetail = new tbl_PersonDetail(); } else { persondetail = pdetalinsert.tbl_PersonDetails.Where(c => c.Person_ID == personid).SingleOrDefault(); } if (persondetail.Business != businessname || persondetail.FEIN != fein) { tbl_Name_History obj = new tbl_Name_History(); obj.Person_ID = personid.ToString(); obj.Last_Name = persondetail.Business; obj.SSN = persondetail.FEIN; obj.CreatedBy = persondetail.Created_By; obj.CreatedDate = persondetail.Created_Date; obj.ModifiedBy = modifiedby; obj.ModifiedDate = Convert.ToDateTime(modifieddate); pdetalinsert.tbl_Name_Histories.InsertOnSubmit(obj); tbl_Licensing_Journal_Detail jour = new tbl_Licensing_Journal_Detail(); jour.Person_Id = personid; jour.Journal_Type_Id = 573; jour.Is_Alert = false; jour.Isce = 0; jour.Description = "Name Changed on " + DateTime.Now.ToShortDateString(); jour.Createdby = modifiedby; jour.CreatedDate = Convert.ToDateTime(modifieddate); pdetalinsert.tbl_Licensing_Journal_Details.InsertOnSubmit(jour); } persondetail.Person_ID = personid; persondetail.Business = businessname; persondetail.Ownersifdiff = ownersname; if (dob != "") { persondetail.DOB = Convert.ToDateTime(dob); } persondetail.FEIN = fein; persondetail.DEA = dea; persondetail.Modified_By = modifiedby; persondetail.Modified_Date = Convert.ToDateTime(modifieddate); persondetail.SkipPayment = skippayment; persondetail.NABP_E_Profile_Number = eprofile; if (personid == 0) { pdetalinsert.tbl_PersonDetails.InsertOnSubmit(persondetail); } pdetalinsert.SubmitChanges(); return(persondetail.Person_ID); } }
public static int Edit_PersonalInfo(int personid, string fname, string mname, string lname, string maidenname, string gender, string dob, string ssn, string age, string cpe, string maritalstatus, string status, string modifiedby, string modifieddate, string ethincity, string triningcompleted) { using (License_ConnectionDataContext pdetalinsert = new License_ConnectionDataContext()) { tbl_PersonDetail persondetail; if (personid == 0) { persondetail = new tbl_PersonDetail(); } else { persondetail = pdetalinsert.tbl_PersonDetails.Where(c => c.Person_ID == personid).SingleOrDefault(); } if (persondetail.First_Name != fname || persondetail.Middle_Name != mname || persondetail.Last_Name != lname || persondetail.DOB != Convert.ToDateTime(dob) || persondetail.SSN != ssn) { tbl_Name_History obj = new tbl_Name_History(); obj.Person_ID = personid.ToString(); obj.First_Name = persondetail.First_Name; obj.Last_Name = persondetail.Last_Name; obj.Middle_Name = persondetail.Middle_Name; obj.DOB = persondetail.DOB; obj.SSN = persondetail.SSN; obj.CreatedBy = persondetail.Created_By; obj.CreatedDate = persondetail.Created_Date; obj.ModifiedBy = modifiedby; obj.ModifiedDate = Convert.ToDateTime(modifieddate); pdetalinsert.tbl_Name_Histories.InsertOnSubmit(obj); tbl_Licensing_Journal_Detail jour = new tbl_Licensing_Journal_Detail(); jour.Person_Id = personid; jour.Journal_Type_Id = 573; jour.Is_Alert = false; jour.Isce = 0; jour.Description = "Name Changed on " + DateTime.Now.ToShortDateString(); jour.Createdby = modifiedby; jour.CreatedDate = Convert.ToDateTime(modifieddate); pdetalinsert.tbl_Licensing_Journal_Details.InsertOnSubmit(jour); } persondetail.Person_ID = personid; persondetail.First_Name = fname; persondetail.Middle_Name = mname; persondetail.Last_Name = lname; persondetail.Ethincity = ethincity; persondetail.Madian_Name = maidenname; persondetail.Gender = gender; persondetail.DOB = Convert.ToDateTime(dob); persondetail.SSN = ssn; persondetail.Age = age; persondetail.CPE = cpe; persondetail.Training_Completed = triningcompleted; persondetail.Martial_Status = maritalstatus; persondetail.Status = status; persondetail.Modified_By = modifiedby; persondetail.Modified_Date = Convert.ToDateTime(modifieddate); if (personid == 0) { pdetalinsert.tbl_PersonDetails.InsertOnSubmit(persondetail); } pdetalinsert.SubmitChanges(); return(persondetail.Person_ID); } }