public XlsxGenerator(ContactFormPerson contactForm, ConfigMgr configMgr) { contactFormPerson = contactForm; destFolder = configMgr.GetDestenationPath(); targetPath = Path.Combine(destFolder, $"מודל_תחשיב_חלוקת רכוש_{contactFormPerson.Person_1.Id}-{contactFormPerson.Person_2.Id}.xlsx"); }
private void AddNewClient(ContactFormPerson contactFormDetails, List <CheckListRow> checkListRows) { Client client = new Client() { StatusValue = Enums.CaseStatuses[Client.YET_TO_BEGIN_STATUS_INDEX], ContactForm = contactFormDetails, CheckListRows = checkListRows }; client.CheckListRows[0].Person_1_value = client.ContactForm.Person_1.FullName; client.CheckListRows[0].Person_2_value = client.ContactForm.Person_2.FullName; IClientDAO clientDAO = new ClientFileDAO(new ConfigMgr()); clientDAO.AddNewClient(client); }
private ContactFormPerson CreateContactDetails() { if (case_owner.SelectedValue == null || case_type.SelectedValue == null) { throw new ArgumentNullException(); } ContactFormPerson contactFormDetails = new ContactFormPerson() { CaseOwnerValue = case_owner.SelectedValue, CaseInfo = new CaseDetails() { CaseTypeEnum = CaseDetails.GetCaseTypeKey(case_type.SelectedValue.ToString()), OpenDate = DateTime.Now, DecisionDate = case_decision_date.SelectedDate ?? null, CaseReceivementDate = receiving_case_date.SelectedDate ?? null, PublishDays = publish_days.Text, CourtName = court_name.SelectedValue != null?court_name.SelectedValue.ToString() : string.Empty, CaseNum = case_num.Text, JudgeName = judge_name.Text }, Person_1 = new Person() { FullName = fullName_1.Text, Id = id_1.Text, BirthDate = birth_date_1.SelectedDate ?? null, LowyerName = lowyer_1.Text }, Person_2 = new Person() { FullName = fullName_2.Text, Id = id_2.Text, BirthDate = birth_date_2.SelectedDate ?? null, LowyerName = lowyer_2.Text }, PartnershipStartDate = partnership_start.SelectedDate ?? null, PartnershipEndDate = partnership_end.SelectedDate ?? null, WorkEssence = work_essence.Text, TotalPrice = total_price.Text, TotalPriceType = (PaymentType)new_client_total_price_type.SelectedIndex, AdvancePrice = advance_price.Text, CreationDate = DateTime.Now }; return(contactFormDetails); }
private void OnSaveNewFormTemplate(FormsType formType) { try { ContactFormPerson contactFormDetails = CreateContactDetails(); DocxGenerator docxGenerator = new DocxGenerator(contactFormDetails, new ConfigMgr()); docxGenerator.GenerateNewForm(formType); if (IsSavingClientData.IsChecked.Value) { AddNewClient(contactFormDetails, Defaults.CheckListDefaultCollection); } snack_bar_with_action.IsActive = true; snack_bar_with_action.MessageQueue.Enqueue("יצירת טופס בוצעה בהצלחה ונתונים נשמרו", "פתח", generate_forms_snack_barAction, new Tuple <DocxGenerator, FormsType>(docxGenerator, formType)); } catch (ArgumentNullException) { DisplaySnackbar("שגיאה. בדוק את שדות חובה. מטפל בתיק, סוג התיק"); } catch (FileNotFoundException) { DisplaySnackbar("התקיית קבצים לא קיימת, בדוק בהגדרות מערכת את ההגדרות שלך"); } catch (IOException) { DisplaySnackbar("שגיאה ביצירת הטופס, בדוק שהוא לא פתוח כבר ונסה שוב"); } catch (Exception ex) { DisplaySnackbar("שגיאה כללית במערכת, אנא נסה שוב"); Logger log = new Logger(new ConfigMgr()); log.Error("general error on load tab", ex); } }
private void NewPersonContactSaveOnlyBtn_Click(object sender, RoutedEventArgs e) { try { ContactFormPerson contactFormDetails = CreateContactDetails(); AddNewClient(contactFormDetails, Defaults.CheckListDefaultCollection); DisplaySnackbar("נתונים נשמרו בהצלחה"); } catch (FileNotFoundException) { DisplaySnackbar("שגיאה בשמירת הנתונים, בדוק בהגדרות מערכת את ההגדרות שלך"); } catch (ArgumentNullException) { DisplaySnackbar("שגיאה. בדוק את שדות חובה. מטפל בתיק, סוג התיק"); } catch (Exception ex) { DisplaySnackbar("שגיאה כללית במערכת, אנא נסה שוב"); Logger log = new Logger(new ConfigMgr()); log.Error("general error on load tab", ex); } }
//private readonly string targetPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); public DocxGenerator(ContactFormPerson contactForm, ConfigMgr configMgr) { contactFormPerson = contactForm; targetPath = configMgr.GetDestenationPath(); }