private void bAssign_Click(object sender, EventArgs e) { CardTableAccess CardAccess = new CardTableAccess(); DocumentTableAccess DocumentAccess = new DocumentTableAccess(); MemberTableAccess MemberAccess = new MemberTableAccess(); DocumentClass buffDoc; List <CardClass> CardList; if (!Member.IsMember) { MessageBox.Show("Person is not a member, Please Sign up first"); } else { CardList = CardAccess.FindCard("CustomerID", Member.ID); if (CardList.Count != 0) { foreach (CardClass buff in CardList) { buff.IsActive = false; buff.EndDate = DateTime.Today; CardAccess.UpdateExistingCard(buff); } buffDoc = DocumentAccess.FindDocument("SystemID", Member.ID); DocumentAccess.UpdatePersonalLog(buffDoc, EventLogManipulation.EventTranslationFirst.Card_Loss); ////Update Daily log /// Card.CustomerID = Member.ID; Card.IsActive = Member.Validity; Card.EffDate = Member.EffDate; Card.EndDate = Member.EndDate; CardAccess.UpdateExistingCard(Card); //MemberAccess.UpdateExistingMember(Member); DocumentAccess.UpdatePersonalLog(buffDoc, EventLogManipulation.EventTranslationFirst.Card_Replace); } else { Card.CustomerID = Member.ID; Card.IsActive = Member.Validity; Card.EffDate = Member.EffDate; Card.EndDate = Member.EndDate; CardAccess.UpdateExistingCard(Card); //MemberAccess.UpdateExistingMember(Member); buffDoc = DocumentAccess.FindDocument("SystemID", Member.ID); DocumentAccess.UpdatePersonalLog(buffDoc, EventLogManipulation.EventTranslationFirst.Card_Replace); //// Update daily log } } }
private void OnCardPresent(object sender, EventArgs e) { MemberAccess = new MemberTableAccess(); DocAccess = new DocumentTableAccess(); List <CardClass> CardList; byte[] bufferKey; string LastLine = ""; string[] LineComp; bufferKey = CardThread.KeyNo; CardList = CardAccess.FindCard("CardNo", bufferKey); if (CardList.Count != 0) { if (CardList[0].IsActive) { Member = MemberAccess.FindMember("Id", CardList[0].CustomerID); Doc = DocAccess.FindDocument("SystemID", Member.ID); if (Doc != null) { if (string.IsNullOrEmpty(Doc.EventLog)) { char[] Trimmer = { '\r', '\n' }; Doc.EventLog = SaveAsDocPath + Member.Name.Trim(Trimmer); System.IO.DirectoryInfo dir = Directory.CreateDirectory(Doc.EventLog); Doc.EventLog = Doc.EventLog + @"\" + "EventLog " + Member.Name.Trim(Trimmer) + ".csv"; DocAccess.UpdateExistingDoc(Doc); } if (File.Exists(Doc.EventLog)) { LastLine = File.ReadLines(Doc.EventLog).Last(); } LineComp = LastLine.Split(','); switch (LineComp[0]) { case "CheckIn": FindTodayLog(false); DocAccess.UpdatePersonalLog(Doc, EventLogManipulation.EventTranslationFirst.CheckOut); break; case "CheckOut": FindTodayLog(true); DocAccess.UpdatePersonalLog(Doc, EventLogManipulation.EventTranslationFirst.CheckIn); break; default: FindTodayLog(true); DocAccess.UpdatePersonalLog(Doc, EventLogManipulation.EventTranslationFirst.CheckIn); break; } } } else { MessageBox.Show("The card is not Active"); } } else { MessageBox.Show("The card is not in the system"); } }
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; }