Exemple #1
0
        private void btnAdjectives_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            CyrAdjectiveCollection collection = new CyrAdjectiveCollection();
            ConcurrentBag <Dictionary <string, object> > words = new ConcurrentBag <Dictionary <string, object> >();
            string filePath = Path.Combine(txtFolder.Text, "adjectives.json");

            GendersEnum[] genders = new GendersEnum[] { GendersEnum.Neuter, GendersEnum.Masculine, GendersEnum.Feminine };

            collection.SelectAdjectives().AsParallel().ForAll(adj =>
            {
                Dictionary <string, object> result = new Dictionary <string, object>();

                result.Add(nameof(CyrAdjective.Name), adj.Name);

                {
                    CyrResult animated = adj.DeclinePlural(AnimatesEnum.Animated);
                    result[nameof(NumbersEnum.Plural)] = animated.ToArray();
                }

                foreach (GendersEnum gender in genders)
                {
                    CyrResult animated        = adj.Decline(gender, AnimatesEnum.Animated);
                    result[gender.ToString()] = animated.ToArray();
                }

                words.Add(result);
            });

            string json = JsonConvert.SerializeObject(words.OrderBy(x => x[nameof(CyrAdjective.Name)]), Formatting.Indented);

            this.WriteToFile(json, filePath);
            this.Cursor = Cursors.Default;
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            Console.WriteLine("# Загружаю словарь существительных.");
            cyrNounCollection = new CyrNounCollection();

            Console.WriteLine("# Загружаю словарь прилагательных.");
            cyrAdjectiveCollection = new CyrAdjectiveCollection();

            cyrPhrase = new CyrPhrase(cyrNounCollection, cyrAdjectiveCollection);

            Console.WriteLine("# Склоняю существительные.");
            Console.WriteLine();
            NounSamples();

            Console.WriteLine("# Склоняю прилагательные.");
            Console.WriteLine();
            AdjectiveSamples();

            Console.WriteLine("# Склоняю словосочетания.");
            Console.WriteLine();
            PhraseSamples();

            Console.WriteLine("# Склоняю имена без использования словаря.");
            Console.WriteLine();
            NameSamples();

            Console.WriteLine("# Склоняю числа, количества и суммы прописью.");
            Console.WriteLine();
            NumberSamples();
        }
 private void AdjectiveForm_Load(object sender, EventArgs e)
 {
     ddlAction.SelectedIndex = 0;
     ddlGender.SelectedIndex = 0;
     cyrCollection = new CyrAdjectiveCollection();
     this.ParentForm.AcceptButton = btnDecline;
 }
Exemple #4
0
 private void PhraseForm_Load(object sender, EventArgs e)
 {
     ddlAction.SelectedIndex      = 0;
     adjCollection                = new CyrAdjectiveCollection();
     nounCollection               = new CyrNounCollection();
     this.ParentForm.AcceptButton = btnDecline;
 }
 public DeclensionFacade()
 {
     cyrNounCollection      = new CyrNounCollection();
     cyrAdjectiveCollection = new CyrAdjectiveCollection();
     cyrPhrase = new CyrPhrase(cyrNounCollection, cyrAdjectiveCollection);
     cyrName   = new CyrName();
 }
Exemple #6
0
        private async Task LoadCollection()
        {
            if (cyrCollection != null)
            {
                return;
            }

            Stopwatch watch = new Stopwatch(); LoadingForm formLoading = new LoadingForm()

            {
                Dock = DockStyle.Fill
            };

            this.Cursor          = Cursors.WaitCursor;
            this.tlpMain.Visible = false;
            this.Controls.Add(formLoading);

            watch.Start();
            await Task.Run(() =>
            {
                cyrCollection = new CyrAdjectiveCollection();
            });

            watch.Stop();

            this.Log($"Создание {nameof(CyrAdjectiveCollection)} заняло {watch.Elapsed}.");
            this.Cursor          = Cursors.Default;
            this.tlpMain.Visible = true;
            this.Controls.Remove(formLoading);
        }
Exemple #7
0
 private void PhraseForm_Load(object sender, EventArgs e)
 {
     ddlAction.SelectedIndex = 0;
     adjCollection = new CyrAdjectiveCollection();
     nounCollection = new CyrNounCollection();
     this.ParentForm.AcceptButton = btnDecline;
 }
 private void AdjectiveForm_Load(object sender, EventArgs e)
 {
     ddlAction.SelectedIndex      = 0;
     ddlGender.SelectedIndex      = 0;
     cyrCollection                = new CyrAdjectiveCollection();
     this.ParentForm.AcceptButton = btnDecline;
 }
Exemple #9
0
        private static void InitializeAdjectives()
        {
            Console.WriteLine("Initializing adjectives collection");
            var result = new CyrAdjectiveCollection();

            Console.WriteLine("Complete adjectives collection");
            _cyrAdjectiveCollection = result;
        }
Exemple #10
0
        public ActionResult Adjective(string w)
        {
            ViewBag.Page = "Decline.Adjective";

            if (string.IsNullOrEmpty(w))
            {
                return(View());
            }

            List <string> errors = new List <string>();
            List <CyrAdjectiveDeclineResult> results    = new List <CyrAdjectiveDeclineResult>();
            CyrAdjectiveCollection           collection = this.AdjectiveCollection;

            foreach (string s in w.Split(' ').Where(val => !string.IsNullOrEmpty(val)))
            {
                CyrAdjective word;
                string       foundWord;
                GendersEnum  foundGender;
                CasesEnum    foundCase;
                NumbersEnum  foundNumber;
                AnimatesEnum foundAnimate;

                try
                {
                    word = collection.Get(s, out foundWord, out foundGender, out foundCase, out foundNumber, out foundAnimate);
                }
                catch (CyrWordNotFoundException)
                {
                    errors.Add(string.Format("Слово \"<strong>{0}</strong>\" не найдено в коллекции. Попбробуйте другое слово.", s));
                    continue;
                }

                CyrAdjectiveDeclineResult result = new CyrAdjectiveDeclineResult()
                {
                    Name         = word.Name,
                    OriginalWord = s,
                    FoundWord    = foundWord,
                    FoundGender  = foundGender,
                    FoundCase    = foundCase,
                    FoundNumber  = foundNumber,
                    FoundAnimate = foundAnimate,
                    Singular     = word.Decline(foundGender == 0 ? GendersEnum.Masculine : foundGender, foundAnimate),
                    Plural       = word.DeclinePlural(foundAnimate)
                };

                results.Add(result);
            }

            ViewBag.Text    = w;
            ViewBag.Errors  = errors;
            ViewBag.Results = results;
            ViewBag.Cases   = CyrDeclineCase.GetEnumerable().ToArray();

            return(View());
        }
Exemple #11
0
        protected virtual Task InitCollections() => Task.Run(() =>
        {
            lock (Locker)
            {
                if (IsInitialized)
                {
                    return;
                }

                this.CyrNounCollection      = new CyrNounCollection();
                this.CyrAdjectiveCollection = new CyrAdjectiveCollection();
                this.IsInitialized          = true;
            }
        });
        public static string GetNameDativeByName(string name)
        {
            // Создаем коллекцию всех существительных.
            CyrNounCollection nouns = new CyrNounCollection();
            // Создаем коллекцию всех прилагательных.
            CyrAdjectiveCollection adjectives = new CyrAdjectiveCollection();
            // Создаем фразу с использование созданных коллекций.
            CyrPhrase phrase  = new CyrPhrase(nouns, adjectives);
            CyrName   cyrName = new CyrName();

            var newName = string.Format("{0}{1}", cyrName.DeclineSurnameDative(GetLastNameByName(name), GetGenderByName(name)), GetInitialsByName(name));

            return(newName);
        }
        public ActionResult Adjective(string w)
        {
            ViewBag.Page = "Decline.Adjective";

            if (string.IsNullOrEmpty(w))
            {
                return(View());
            }

            List <string>          errors     = new List <string>();
            List <CyrAdjective>    words      = new List <CyrAdjective>();
            List <CyrResult>       singulars  = new List <CyrResult>();
            List <CyrResult>       plurals    = new List <CyrResult>();
            CyrAdjectiveCollection collection = this.AdjectiveCollection;

            foreach (string s in w.Split(' ').Where(val => !string.IsNullOrEmpty(val)))
            {
                CyrAdjective word;

                try
                {
                    word = collection.Get(s, GetConditionsEnum.Similar);
                }
                catch (CyrWordNotFoundException)
                {
                    errors.Add(string.Format("Слово \"<strong>{0}</strong>\" не найдено в коллекции. Попбробуйте другое слово.", s));
                    continue;
                }

                words.Add(word);
                singulars.Add(word.Decline(AnimatesEnum.Animated));
                plurals.Add(word.DeclinePlural(AnimatesEnum.Animated));
            }

            ViewBag.Text      = w;
            ViewBag.Errors    = errors;
            ViewBag.Words     = words;
            ViewBag.Singulars = singulars;
            ViewBag.Plurals   = plurals;
            ViewBag.Cases     = CyrDeclineCase.List;

            return(View());
        }
        static void Main(string[] args)
        {
            ParserResult <Arguments> parseResult = Parser.Default.ParseArguments <Arguments>(args);

            if (parseResult.Errors.Any())
            {
                return;
            }

            Arguments arguments = parseResult.Value;

            // Создаем коллекцию всех существительных.
            CyrNounCollection nouns = new CyrNounCollection();

            // Создаем коллекцию всех прилагательных.
            CyrAdjectiveCollection adjectives = new CyrAdjectiveCollection();

            // Создаем фразу с использование созданных коллекций.
            CyrPhrase phrase = new CyrPhrase(nouns, adjectives);

            InjectionAnalyzer analyzer = new InjectionAnalyzer();

            HashSet <string> defTypes = new HashSet <string>(arguments.DefsTypes.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));

            HashSet <string> ignoredInjections = File.Exists(arguments.IgnoreFile)
                                ? new HashSet <string>(File.ReadAllLines(arguments.IgnoreFile))
                                : new HashSet <string>();

            HashSet <string> pluralizedLabels = File.Exists(arguments.Output)
                                ? new HashSet <string>(File.ReadAllLines(arguments.Output).Select(line => new string(line.TakeWhile(c => c != ';').ToArray())))
                                : new HashSet <string>();

            Injection[] allLabels = analyzer
                                    .ReadInjections(arguments.DefsPath)
                                    .Where(inj => defTypes.Contains(inj.DefType))
                                    .Where(inj => GetLastPart(inj).ToLowerInvariant().Contains("label"))
                                    .Distinct(new InjectionTypeTranslationComparer())
                                    .Where(inj =>
                                           !ignoredInjections.Contains(FormInjectionLine(inj)) &&
                                           !pluralizedLabels.Contains(inj.Translation))
                                    .ToArray();

            Console.WriteLine($"Check plural forms for {allLabels.Length} labels.");

            List <Option> history = new List <Option>();

            string prevDefType = "";

            PluralPair pluralPair = null;

            for (int labelIndex = 0; labelIndex < allLabels.Length;)
            {
                Injection injection = allLabels[labelIndex];
                string    label     = injection.Translation;

                Console.WriteLine();
                Console.WriteLine($"{labelIndex + 1}/{allLabels.Length} {injection.DefType} <{injection.DefPath}> \"{label}\":");

                if (pluralPair == null)
                {
                    pluralPair = PluralizeIgnoreSuffix(phrase, label, " (", " из ", " для ", " с ", " в ");
                }

                if (pluralPair == null)
                {
                    Console.WriteLine($"	Failed to pluralize");
                }
                else
                {
                    WritePluralization(pluralPair);
                }

                Console.Write("<Enter> - accept; <Space> - edit; <Backspace> - back; <Delete> - ignore");
                ConsoleKey key = Console.ReadKey().Key;
                Console.WriteLine();

                switch (key)
                {
                case ConsoleKey.Escape:
                    return;

                case ConsoleKey.Spacebar:
                    if (pluralPair == null)
                    {
                        pluralPair = new PluralPair(label, label);
                    }

                    pluralPair = EditPluralization(pluralPair);

                    if (injection.DefType != prevDefType)
                    {
                        FileUtil.PushLine(arguments.Output, string.Empty);
                        FileUtil.PushLine(arguments.Output, "// " + injection.DefType);
                    }
                    FileUtil.PushLine(arguments.Output, ToLine(pluralPair));
                    pluralPair = null;
                    history.Add(Option.Accept);
                    labelIndex++;
                    break;

                case ConsoleKey.Enter:
                    if (pluralPair != null)
                    {
                        if (injection.DefType != prevDefType)
                        {
                            FileUtil.PushLine(arguments.Output, string.Empty);
                            FileUtil.PushLine(arguments.Output, "// " + injection.DefType);
                        }
                        FileUtil.PushLine(arguments.Output, ToLine(pluralPair));
                        pluralPair = null;
                        history.Add(Option.Accept);
                        labelIndex++;
                    }
                    break;

                case ConsoleKey.Delete:
                    FileUtil.PushLine(arguments.IgnoreFile, FormInjectionLine(injection));
                    pluralPair = null;
                    history.Add(Option.Ignore);
                    labelIndex++;
                    break;

                case ConsoleKey.Backspace:
                    Option prevOption = history[labelIndex - 1];
                    history.RemoveAt(labelIndex - 1);
                    labelIndex--;

                    if (prevOption == Option.Accept)
                    {
                        string prevDeclinationLine = FileUtil.PopLine(arguments.Output);
                        pluralPair = FromLine(prevDeclinationLine);
                    }
                    else if (prevOption == Option.Ignore)
                    {
                        FileUtil.PopLine(arguments.IgnoreFile);
                        pluralPair = null;
                    }
                    break;

                default:
                    break;
                }

                prevDefType = injection.DefType;
            }
        }
Exemple #15
0
 public CyrillerService()
 {
     cyrNounCollection      = new CyrNounCollection();
     cyrAdjectiveCollection = new CyrAdjectiveCollection();
 }
Exemple #16
0
        public ActionResult CreateContract(Guid callID)
        {
            var callData    = db.Calls.ToList();
            var itemsData   = db.Items.ToList();
            var custData    = db.Customers.ToList();
            var repData     = db.Representatives.ToList();
            var callDetails = db.CallDetails.ToList();
            //var progdata = db.Programs.ToList();

            var callData2 = (from c in db.CallDetails
                             join item in itemsData on c.ItemID equals item.ItemID
                             join calcdet in db.CalcDetails.ToList() on item.CalcDetailsID equals calcdet.CalcID
                             where (c.CallID == callID)
                             select new ContractViewModel.Itm {
                itemname = item.ItemName, Qty = c.ItemQty.ToString(), itemsubtype = item.ItemSubtype.ItemSubtype1, additionals = item.Additional, calcDate = calcdet.CalcDate.ToString(), calcNum = calcdet.CalcNum
            }).ToList();


            ContractViewModel contract = new ContractViewModel();

            CultureInfo ci = new CultureInfo("RU-ru");

            contract = (from cd in callData
                        join cust in custData on cd.CustomerID equals cust.CustomerID
                        join rep in repData on cust.RepresentativeID equals rep.RepresentativeID
                        join calldet in callDetails on cd.CallID equals calldet.CallID
                        join item in itemsData on calldet.ItemID equals item.ItemID

                        where (cd.CallID == (Guid)callID)
                        select new ContractViewModel {
                CallID = cd.CallID,
                callDate = cd.CallDate.ToString("dd MMMM yyyy г.", ci),
                sampleActDate = cd.SampleActDate.ToString("dd MMMM yyyy г.", ci),
                callNumber = cd.DocNumber.ToString(),
                expAffNum = cd.AffidavitNum.ToString(),
                expAffDate = cd.AffidavitDate.ToString("dd MMMM yyyy г.", ci),
                contractDate = cd.ContractDate,
                repdoc = rep.RepDoc.ToString(),
                repFName = rep.FirstName.ToString(),
                repMName = rep.MidName.ToString(),
                repFamName = rep.FamilyName.ToString(),
                repPosition = rep.Position.ToString(),
                repPhone = rep.PhoneNumber.ToString(),
                custName = cust.Name.ToString(),
                custAddress = cust.Address.ToString(),
                custTaxID = cust.TaxID.ToString(),
                custBIC = cust.BIC.ToString(),
                custPhoneNumber = cust.PhoneNumber.ToString(),
                custOKPO = cust.OKPO.ToString(),
                custAccount = cust.Account.ToString(),
                custBankBranch = cust.BankBranch.ToString(),
                custBranchAddress = cust.BranchAddress.ToString(),
                custBankCode = cust.BankCode.ToString(),
                custMPhoneNumber = cust.MPhoneNumber.ToString()
            }

                        ).FirstOrDefault();

            contract.itmList = callData2;

            ////////////////////////////////////////////////////////////////////////////////////////////////////////

            //                              ВВОД ДАННЫХ В ШАБЛОН ДОГОВОРА                                        //

            ///////////////////////////////////////////////////////////////////////////////////////////////////////


            List <string> expertData = callexp.Split(' ').Reverse().ToList();

            string expName = expertData[0] + expertData[1] + expertData[2];

            int nameIndex = callexp.IndexOf(expName);

            string expertPosition = callexp.Remove(nameIndex, expName.Length);

            string firstWordInPosition = callexp.Split(' ').First();

            int firstWordIndex = expertPosition.IndexOf(firstWordInPosition);

            string expPositionTail = expertPosition.Remove(firstWordIndex, firstWordInPosition.Length);

            CyrNounCollection      nouns = new CyrNounCollection();
            CyrAdjectiveCollection adj   = new CyrAdjectiveCollection();
            CyrPhrase phrase             = new CyrPhrase(nouns, adj);
            CyrResult expname            = phrase.Decline(expName, GetConditionsEnum.Strict);

            expName = expname.Genitive;

            CyrNoun   strict        = nouns.Get(firstWordInPosition, GetConditionsEnum.Strict);
            CyrResult expPosition   = strict.Decline();
            string    firstWordDecl = expPosition.Genitive;

            expertPosition = string.Concat(firstWordDecl, expPositionTail);

            firstWordInPosition = contract.repPosition.Split(' ').First();

            firstWordIndex = contract.repPosition.IndexOf(firstWordInPosition);

            string repPositionTail = contract.repPosition.Remove(firstWordIndex, firstWordInPosition.Length);

            CyrResult repname = phrase.Decline((contract.repFamName + contract.repFName + contract.repMName), GetConditionsEnum.Strict);
            string    repName = repname.Genitive;

            strict = nouns.Get(firstWordInPosition, GetConditionsEnum.Strict);
            CyrResult repPosition = strict.Decline();

            firstWordDecl = repPosition.Genitive;
            string representativePosition = string.Concat(firstWordDecl, expPositionTail);


            try
            {
                Document document = new Document();
                document.LoadFromFile("~/Content/FileTemplates/ContractTemplateCorporate.docx");
                BookmarksNavigator bookmarkNavigator = new BookmarksNavigator(document);
                bookmarkNavigator.MoveToBookmark("ContractNum");
                bookmarkNavigator.ReplaceBookmarkContent(contract.callNumber, true);

                bookmarkNavigator.MoveToBookmark("ContractDay");
                if (contract.contractDate.HasValue)
                {
                    bookmarkNavigator.ReplaceBookmarkContent((contract.contractDate?.ToString("dd", new CultureInfo("ru-RU"))), true);

                    bookmarkNavigator.MoveToBookmark("ContractMonth");
                    bookmarkNavigator.ReplaceBookmarkContent(contract.contractDate?.ToString(" MMMM ", new CultureInfo("ru-RU")), true);

                    bookmarkNavigator.MoveToBookmark("ContractYear");
                    bookmarkNavigator.ReplaceBookmarkContent(contract.contractDate?.ToString(" yyyy г.", new CultureInfo("ru-RU")), true);
                }

                else
                {
                    bookmarkNavigator.ReplaceBookmarkContent((DateTime.Today.ToString("dd", new CultureInfo("ru-RU"))), true);

                    bookmarkNavigator.MoveToBookmark("ContractMonth");
                    bookmarkNavigator.ReplaceBookmarkContent(DateTime.Today.ToString(" MMMM ", new CultureInfo("ru-RU")), true);

                    bookmarkNavigator.MoveToBookmark("ContractYear");
                    bookmarkNavigator.ReplaceBookmarkContent(DateTime.Today.ToString(" yyyy г.", new CultureInfo("ru-RU")), true);
                }

                bookmarkNavigator.MoveToBookmark("ContractExpertPosition");
                bookmarkNavigator.ReplaceBookmarkContent(expertPosition, true);

                bookmarkNavigator.MoveToBookmark("ContractExpertFullName");
                bookmarkNavigator.ReplaceBookmarkContent(expName, true);

                bookmarkNavigator.MoveToBookmark("AffidavitNum");
                bookmarkNavigator.ReplaceBookmarkContent(contract.expAffNum, true);

                bookmarkNavigator.MoveToBookmark("AffidavitDate");
                bookmarkNavigator.ReplaceBookmarkContent(contract.expAffDate, true);

                bookmarkNavigator.MoveToBookmark("CustomerName");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custName, true);

                bookmarkNavigator.MoveToBookmark("CustomerDoc");
                bookmarkNavigator.ReplaceBookmarkContent(" ", true);

                bookmarkNavigator.MoveToBookmark("RepresentativePosition");
                bookmarkNavigator.ReplaceBookmarkContent(representativePosition, true);

                bookmarkNavigator.MoveToBookmark("RepresentativeName");
                bookmarkNavigator.ReplaceBookmarkContent(repName, true);

                bookmarkNavigator.MoveToBookmark("CustomerCompanyDoc");
                bookmarkNavigator.ReplaceBookmarkContent(contract.repdoc, true);

                foreach (ContractViewModel.Itm i in contract.itmList)
                {
                    CyrResult it_name = phrase.Decline(i.itemsubtype, GetConditionsEnum.Strict);
                    i.itemsubtype = it_name.Genitive;

                    bookmarkNavigator.MoveToBookmark("ItemName");
                    bookmarkNavigator.ReplaceBookmarkContent(i.itemsubtype + i.itemname, true);

                    string progname = (from prog in db.Programs.ToList()
                                       join t in db.ItemTypes.ToList() on prog.ItemTypeID equals t.ItemTypeID
                                       join st in db.ItemSubtypes.ToList() on t.ItemTypeID equals st.ItemTypeID
                                       join item in db.Items.ToList() on st.ItemSubtypeID equals item.ItemSubtypeID
                                       where item.ItemName == i.itemname
                                       select prog.ProgramNameShort).FirstOrDefault();


                    bookmarkNavigator.MoveToBookmark("ProgramShortName");
                    bookmarkNavigator.ReplaceBookmarkContent(progname, true);

                    bookmarkNavigator.MoveToBookmark("ItemsNum");
                    bookmarkNavigator.ReplaceBookmarkContent(i.Qty, true);


                    string [] stringarr       = i.additionals.Split(' ');
                    CyrResult addCyr          = phrase.Decline(stringarr[0], GetConditionsEnum.Strict);
                    string    additionals     = addCyr.Genitive;
                    int       index           = i.additionals.IndexOf(additionals);
                    string    additionalsTail = i.additionals.Remove(index, stringarr[0].Length);

                    bookmarkNavigator.MoveToBookmark("Additionals");
                    bookmarkNavigator.ReplaceBookmarkContent(additionals + additionalsTail, true);

                    bookmarkNavigator.MoveToBookmark("CalculationOrderDate");
                    bookmarkNavigator.ReplaceBookmarkContent(i.calcDate, true);

                    bookmarkNavigator.MoveToBookmark("CalculationOrderNum");
                    bookmarkNavigator.ReplaceBookmarkContent(i.calcNum, true);
                }

                decimal TotalSum = 0;
                var     costs    = from callitem in callDetails
                                   where (callitem.CallID == callID)
                                   select callitem.ItemTestCost;
                TotalSum = costs.Sum(c => Convert.ToDecimal(c));

                bookmarkNavigator.MoveToBookmark("TotalSum");
                bookmarkNavigator.ReplaceBookmarkContent(TotalSum.ToString(), true);

                bookmarkNavigator.MoveToBookmark("TestingDurationCalDays");
                bookmarkNavigator.ReplaceBookmarkContent("30", true);

                bookmarkNavigator.MoveToBookmark("ExpertFIO");
                bookmarkNavigator.ReplaceBookmarkContent(expName, true);

                bookmarkNavigator.MoveToBookmark("RepresentativeFIO");
                bookmarkNavigator.ReplaceBookmarkContent(repName, true);

                bookmarkNavigator.MoveToBookmark("CustomerName2");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custName, true);

                bookmarkNavigator.MoveToBookmark("TaxID");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custTaxID, true);

                bookmarkNavigator.MoveToBookmark("OKPO");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custOKPO, true);

                bookmarkNavigator.MoveToBookmark("CustomerAddress");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custAddress, true);

                bookmarkNavigator.MoveToBookmark("CustomerPhoneNum");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custPhoneNumber, true);

                bookmarkNavigator.MoveToBookmark("CustomerMphoneNum");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custMPhoneNumber, true);

                bookmarkNavigator.MoveToBookmark("BankAccount");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custAccount, true);

                bookmarkNavigator.MoveToBookmark("BankBranch");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custBankBranch, true);

                bookmarkNavigator.MoveToBookmark("BankAddress");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custBranchAddress, true);

                bookmarkNavigator.MoveToBookmark("BankCode");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custBankCode, true);

                bookmarkNavigator.MoveToBookmark("BIC");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custBIC, true);

                //Save doc file.

                if (document != null)
                {
                    string path = Server.MapPath(@"~\Area\Manager\Files\Contracts\");
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    document.SaveToFile(path + @"docx\" + contract.CallID.ToString() + ".docx", Spire.Doc.FileFormat.Docx);
                    document.SaveToFile(path + @"pdf\" + contract.CallID.ToString() + ".pdf", Spire.Doc.FileFormat.PDF);
                    ViewBag.pdf = (path + @"pdf\" + contract.CallID.ToString() + ".pdf");
                }
            }

            catch (Exception e)
            {
                return(new HttpNotFoundResult(e.ToString()));
            }



            return(View());
        }
Exemple #17
0
 public CyrPhrase(CyrNounCollection NouCollection, CyrAdjectiveCollection AdjCollection)
 {
     this.nouCollection = NouCollection;
     this.adjCollection = AdjCollection;
 }