private void FinalizeDoc() { DocumentSign Signature = new DocumentSign(); DocumentAccess = new DocumentTableAccess(); string buName, buPhone, buMdetail, buAdd, buEmail; DateTime buDOB = DateTime.Today; string buPName = "", buPPhone = "", buPEmail = ""; string buMemID = "", buIDType = ""; string buEMEName, buEMEPhone, buEMERel; string SourceDocPath = @"C:\MemIDDocument\SourceDocuments\"; string SaveAsDocPath = @"C:\MemIDDocument\ClientsDocuments\"; string SavePath = ""; #region Member Info Verification if (tName.Text == "") { tName.Focus(); tName.Text = ""; return; } else { buName = tName.Text; } if (tPhoneNum.Text == "") { tPhoneNum.Focus(); tPhoneNum.Text = ""; return; } else { buPhone = tPhoneNum.Text; } if (tAddress.Text == "") { tAddress.Focus(); tAddress.Text = ""; return; } else { buAdd = tAddress.Text; } if (tMemEmail.Text == "") { tMemEmail.Focus(); tMemEmail.Text = ""; return; } else { buEmail = tMemEmail.Text; } /////////////buEffDate = DateTime.ParseExact(tEffDate.Text," yyyy MM dd", CultureInfo.InvariantCulture); SaveAsDocPath = SaveAsDocPath + buName + @"\"; DirectoryInfo DirInfo = System.IO.Directory.CreateDirectory(SaveAsDocPath); DateRangeCaculation(); #endregion Member Info Verification #region Membership Detail Verification if (cbMemDetail.SelectedItem.ToString() != "Drop-In") { if (tDOB.Text == "") { tDOB.Focus(); tDOB.Text = ""; return; } else { try { buDOB = DateTime.ParseExact(tDOB.Text, "yyyy/MM/dd", CultureInfo.InvariantCulture); } catch (Exception e) { MessageBox.Show("Date Format: yyyy/MM/dd"); } } if (tMemID.Text == "") { tMemID.Focus(); tMemID.Text = ""; return; } else { buMemID = tMemID.Text; } buIDType = cbIDType.SelectedItem.ToString(); SavePath = SaveAsDocPath + "Membership " + buName + EffectiveDate.Date.ToString("_yy_MM_dd") + ".docx"; } else { SavePath = SaveAsDocPath + "Waiver " + buName + EffectiveDate.Date.ToString("_yy_MM_dd") + ".docx"; } #endregion #region Emegency Contact varification if (tEMEName.Text == "") { tEMEName.Focus(); tEMEName.Text = ""; return; } else { buEMEName = tEMEName.Text; } if (tEMEPhone.Text == "") { tEMEPhone.Focus(); tEMEPhone.Text = ""; return; } else { buEMEPhone = tEMEPhone.Text; } if (tEMERel.Text == "") { tEMERel.Focus(); tEMERel.Text = ""; return; } else { buEMERel = tEMERel.Text; } #endregion Emegency Contact varification #region Under Age Check if (UnderAge) { if (tParentName.Text == "") { tParentName.Focus(); tParentName.Text = ""; return; } else { buPName = tParentName.Text; } if (tParentPhone.Text == "") { tParentPhone.Focus(); tParentPhone.Text = ""; return; } else { buPPhone = tParentPhone.Text; } if (tParentEmail.Text == "") { tParentEmail.Focus(); tParentEmail.Text = ""; return; } else { buPEmail = tParentEmail.Text; } } #endregion Under Age Check #region Take Picture byte[] ConvertedPics; MemberImage = CapPic.SaveImage; ConvertedPics = ConvertPicture(MemberImage); #endregion #region Create Path string EventPath; EventPath = SaveAsDocPath + "EventLog " + buName + ".csv"; #endregion ////////////////////////////////////////////////// Signature.UnderAge = UnderAge; if (cbMemDetail.SelectedItem.ToString() == "Drop-In") { Member = new MemberClass(); ////Create Document here Member.CreateDropIn(buName, buPhone, buEmail, buAdd, EffectiveDate, ConvertedPics); var MemAccRet = MemberAccess.AddMember(Member); switch (MemAccRet) { case EventLogManipulation.EventTranslationFirst.Member_DropIn: CreateEventLog(EventPath); Signature.SignWaiverMethod(SourceDocPath + waiverpath, SavePath, buName, buAdd, buPhone, buEmail, buPName, buPPhone, buPEmail, buEMEName, buEMEPhone, buEMERel, EffectiveDate.Date.ToString("yyyy/MM/dd")); Document = new DocumentClass(); Document.CreateDocument(EventPath, SavePath, "", null); //Document.SystemID = DocumentAccess.AddDocument(Document); //update event logw DocumentAccess.UpdatePersonalLog(Document, MemAccRet); break; case EventLogManipulation.EventTranslationFirst.Member_New: break; default: break; } } else { Member = new MemberClass(); ////Create Document here Member.CreateNewMember(buName, buDOB, buIDType, buMemID, buPhone, buEmail, buAdd, EffectiveDate, EndDate, true, ConvertedPics); var MemAccRet = MemberAccess.AddMember(Member); switch (MemAccRet) { case EventLogManipulation.EventTranslationFirst.Member_New: CreateEventLog(EventPath); Document = new DocumentClass(); Document.CreateDocument(EventPath, "", SavePath, DocumentAccess.FindLastDocID() + 1); DocumentAccess.AddDocument(Document); //update event log DocumentAccess.UpdatePersonalLog(Document, MemAccRet); Signature.SignMembershipMethod(SourceDocPath + memberpath, SavePath, buName, buAdd, buPhone, buEmail, buDOB.Date.ToString("yyyy/MM/dd"), buMemID, buPName, buPPhone, buPEmail, buEMEName, buEMEPhone, buEMERel, EffectiveDate.Date.ToString("yyyy/MM/dd")); break; case EventLogManipulation.EventTranslationFirst.Member_Promote: Document = new DocumentClass(); Document = DocumentAccess.FindDocument("Id", Member.ID); Document.MembershipDoc = SavePath; Document.DocID = DocumentAccess.FindLastDocID() + 1; DocumentAccess.UpdateExistingDoc(Document); //update event log DocumentAccess.UpdatePersonalLog(Document, MemAccRet); Signature.SignMembershipMethod(SourceDocPath + memberpath, SavePath, buName, buAdd, buPhone, buEmail, buDOB.Date.ToString("yyyy/MM/dd"), buMemID, buPName, buPPhone, buPEmail, buEMEName, buEMEPhone, buEMERel, EffectiveDate.Date.ToString("yyyy/MM/dd")); break; case EventLogManipulation.EventTranslationFirst.Process_Cancel: break; default: break; } } Signature.OpentoSignMethod(SavePath); DBUpdated = true; }