Example #1
0
        public void OpenDocumentFile(FormsType fileType)
        {
            string destFile = GetDestFileName(fileType);

            Task.Run(() =>
            {
                Process wordProcess                   = new Process();
                wordProcess.StartInfo.FileName        = destFile;
                wordProcess.StartInfo.UseShellExecute = true;
                wordProcess.Start();
            });
        }
Example #2
0
        public void GenerateNewForm(FormsType fileType)
        {
            string sourceFile = GetSourceFileName(fileType);
            string destFile   = GetDestFileName(fileType);

            WordprocessingDocument wordprocessingDocument;

            CopyTemplateFile(sourceFile, destFile);

            wordprocessingDocument = WordprocessingDocument.Open(destFile, true);
            Body body = wordprocessingDocument.MainDocumentPart.Document.Body;

            var    xml          = body.OuterXml;
            string tokenziedXML = TokenizeNewFormDoc(xml);

            body.InnerXml = tokenziedXML;

            wordprocessingDocument.Close();
            wordprocessingDocument.Dispose();
        }
Example #3
0
        private string GetSourceFileName(FormsType fileType)
        {
            switch (fileType)
            {
            case FormsType.ContactForm:
                return(@"./resources/new_person_contact_form_template.docx");

            case FormsType.EconomyDetails:
                return(@"./resources/new_person_economy_details_form_template.docx");

            case FormsType.EmpowerForm:
                return(@"./resources/new_person_empower_form_template.docx");

            case FormsType.FullForm:
                return(@"./resources/new_person_full_form_template.docx");

            default:
                throw new FileNotFoundException($"file type {fileType} not exist");
            }
        }
Example #4
0
        private string GetDestFileName(FormsType fileType)
        {
            string fileUniqueName = $"{contactFormPerson.Person_1.Id}-{contactFormPerson.Person_2.Id}";

            switch (fileType)
            {
            case FormsType.ContactForm:
                return(Path.Combine(targetPath, $"טופס_הזמנת_עבודה_{fileUniqueName}.docx"));

            case FormsType.EconomyDetails:
                return(Path.Combine(targetPath, $"טופס_הזנת_נתונים_{fileUniqueName}.docx"));

            case FormsType.EmpowerForm:
                return(Path.Combine(targetPath, $"טופס_יפוי_כוח_{fileUniqueName}.docx"));

            case FormsType.FullForm:
                return(Path.Combine(targetPath, $"טופס_לקוח_חדש_{fileUniqueName}.docx"));

            default:
                throw new FileNotFoundException($"file type {fileType} not exist");
            }
        }
Example #5
0
        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);
            }
        }
Example #6
0
        public DomTypeModel(FormsType formsType, Dictionary <Type, List <FormsUiTest> > typeiOsuiTestDictionary,
                            Dictionary <Type, List <FormsUiTest> > typeAndroidUiTestDictionary)
        {
            TypeName = formsType.Type.Name;

            var iOsTests     = new List <FormsUiTest>();
            var androidTests = new List <FormsUiTest>();

            _iosTypeTests     = new List <string>();
            _androidTypeTests = new List <string>();

            Rank = 0;

            if (typeiOsuiTestDictionary.ContainsKey(formsType.Type))
            {
                iOsTests =
                    (from test in typeiOsuiTestDictionary[formsType.Type]
                     select test).ToList();
            }

            if (typeAndroidUiTestDictionary.ContainsKey(formsType.Type))
            {
                androidTests =
                    (from test in typeAndroidUiTestDictionary[formsType.Type]
                     select test).ToList();
            }

            _iosTypeTests =
                (from test in iOsTests
                 where test.MemberName == ""
                 select test.TestName).ToList();

            _androidTypeTests =
                (from test in androidTests
                 where test.MemberName == ""
                 select test.TestName).ToList();

            Rank -= _iosTypeTests.Count;
            Rank -= _androidTypeTests.Count;

            Children = new List <DomMemberModel>();

            foreach (var formsMember in formsType.Members())
            {
                var iOsMemberTests =
                    (from test in iOsTests
                     where test.MemberName == formsMember.MemberInfo.Name
                     select test.TestName).ToList();

                Rank -= iOsMemberTests.Count;

                var androidMemberTests =
                    (from test in androidTests
                     where test.MemberName == formsMember.MemberInfo.Name
                     select test.TestName).ToList();

                Rank -= androidMemberTests.Count;

                Children.Add(new DomMemberModel(formsMember.MemberInfo.Name, iOsMemberTests, androidMemberTests));
            }

            Rank += Children.Count;
        }