Ejemplo n.º 1
0
        //public Print(string name, string title, PrintFrequency frequency, string directory, Date refPrintDate, int refPrintNumber, DayOfWeek? weekday, SpecialDay noPrintDays)
        //{
        //    _name = name;
        //    _title = title;
        //    _frequency = frequency;
        //    _directory = directory;
        //    //_refPrintDate = refPrintDate;
        //    //_refPrintNumber = refPrintNumber;
        //    _weekday = weekday;
        //    _noPrintDays = noPrintDays;
        //}

        public Print(string name, string title, string directory)
        {
            _name = name;
            _title = title;
            _directory = directory;
            _frequency = PrintFrequency.Unknow;
            _noDateAndNumberCalculate = true;
        }
Ejemplo n.º 2
0
        //public Print(string name, string title, PrintFrequency frequency, string directory, Date refPrintDate, int refPrintNumber, DayOfWeek? weekday, SpecialDay noPrintDays)
        //{
        //    _name = name;
        //    _title = title;
        //    _frequency = frequency;
        //    _directory = directory;
        //    //_refPrintDate = refPrintDate;
        //    //_refPrintNumber = refPrintNumber;
        //    _weekday = weekday;
        //    _noPrintDays = noPrintDays;
        //}

        public Print(string name, string title, string directory)
        {
            _name      = name;
            _title     = title;
            _directory = directory;
            _frequency = PrintFrequency.Unknow;
            _noDateAndNumberCalculate = true;
        }
Ejemplo n.º 3
0
        //protected RegexValues _normalizedFilename = null;
        //protected RegexValues _normalizedSpecialFilename = null;

        public Print1(string name, string title, PrintFrequency frequency, DayOfWeek? weekday, string directory, Date refPrintDate, int refPrintNumber, SpecialDay noPrintDays)
        {
            _name = name;
            _title = title;
            _frequency = frequency;
            _weekday = weekday;
            _directory = directory;
            _refPrintDate = refPrintDate;
            _refPrintNumber = refPrintNumber;
            _noPrintDays = noPrintDays;
        }
Ejemplo n.º 4
0
        //protected RegexValues _normalizedFilename = null;
        //protected RegexValues _normalizedSpecialFilename = null;

        public Print1(string name, string title, PrintFrequency frequency, DayOfWeek?weekday, string directory, Date refPrintDate, int refPrintNumber, SpecialDay noPrintDays)
        {
            _name           = name;
            _title          = title;
            _frequency      = frequency;
            _weekday        = weekday;
            _directory      = directory;
            _refPrintDate   = refPrintDate;
            _refPrintNumber = refPrintNumber;
            _noPrintDays    = noPrintDays;
        }
Ejemplo n.º 5
0
        public virtual string GetFilename(int index = 0)
        {
            string file = _print.Title;

            if (_special || _specialMonth)
            {
                file += " - hors-série";
            }
            if (!_special || !_print.SpecialNoDate)
            {
                PrintFrequency frequency = _print.Frequency;
                //Date? date = Date;
                TryGetPrintDate();
                if (_date != null)
                {
                    //if ((frequency == PrintFrequency.Daily || frequency == PrintFrequency.Weekly || frequency == PrintFrequency.EveryTwoWeek) && !_specialMonth)
                    //    file += string.Format(" - {0:yyyy-MM-dd}", date);
                    //else
                    //    file += string.Format(" - {0:yyyy-MM}", date);
                    if (_dateType == pb.DateType.Day)
                    {
                        file += string.Format(" - {0:yyyy-MM-dd}", _date);
                    }
                    else
                    {
                        file += string.Format(" - {0:yyyy-MM}", _date);
                    }
                }
            }
            if (!_print.NoNumber)
            {
                int number = GetPrintNumber(throwException: false);
                if (number != 0)
                {
                    //file += string.Format(" - no {0}", GetPrintNumber());
                    file += string.Format(" - no {0}", number);
                }
            }
            file += GetFilenameOption();
            if (_specialText != null && _specialText != "")
            {
                file += " - " + _specialText;
            }
            if (_label != null && _label != "")
            {
                file += " - " + _label;
            }
            if (index != 0)
            {
                file += "_" + index.ToString();
            }
            return(file + ".pdf");
        }
Ejemplo n.º 6
0
 public LeParisien(string name, string title, PrintFrequency frequency, DayOfWeek? weekday, string directory, Date refPrintDate, int refPrintNumber, SpecialDay noPrintDays)
     : base(name, title, frequency, weekday, directory, refPrintDate, refPrintNumber, noPrintDays)
 {
 }
Ejemplo n.º 7
0
        public Print(XElement xe, string baseDirectory = null, Dictionary <string, RegexValuesModel> regexModels = null)
        {
            _name      = xe.zXPathValue("Name");
            _title     = xe.zXPathValue("Title");
            _frequency = GetFrequency(xe.zXPathValue("Frequency"));

            _directory = xe.zXPathValue("Directory").zRootPath(baseDirectory);
            //if (!Path.IsPathRooted(_directory) && baseDirectory != null)
            //    _directory = Path.Combine(baseDirectory, _directory);
            SetOption(xe.zXPathValue("Option"));
            if (!_noDateAndNumberCalculate)
            {
                //string dateRef = xe.zXPathValue("DateReference");
                //string numberRef = xe.zXPathValue("NumberReference");
                //if (dateRef == null && numberRef != null)
                //    throw new PBException("error missing reference number \"{0}\"", _name);
                //if (dateRef != null && numberRef == null)
                //    throw new PBException("error missing reference date \"{0}\"", _name);
                //if (dateRef == null)
                //    _noDateAndNumberCalculate = true;
                //else
                //{
                //    _refPrintDate = Date.Parse(dateRef);
                //    _refPrintNumber = int.Parse(numberRef);
                //    GetNoPrintDates(xe.zXPathValues("NoPrintDate"));
                //    GetNoPrintNumbers(xe.zXPathValues("NoPrintNumber"));
                //}

                _dateNumberReferences = new PrintDateNumberReferences(xe.Elements("DateNumberReference"));
                if (_dateNumberReferences.Count == 0)
                {
                    _noDateAndNumberCalculate = true;
                }
                else
                {
                    GetNoPrintDates(xe.zXPathValues("NoPrintDate").ToArray());
                    GetNoPrintNumbers(xe.zXPathValues("NoPrintNumber").ToArray());
                }
            }
            if (_frequency == PrintFrequency.Weekly || _frequency == PrintFrequency.EveryTwoWeek)
            {
                _weekday = zdate.GetDayOfWeek(xe.zXPathValue("Weekday"));
            }
            if (regexModels != null)
            {
                string model;
                if (_frequency == PrintFrequency.Daily || _frequency == PrintFrequency.Weekly || _frequency == PrintFrequency.EveryTwoWeek)
                {
                    if (!_noNumber)
                    {
                        model = "name_day_number";
                    }
                    else
                    {
                        model = "name_day";
                    }
                }
                else
                {
                    model = "name_month_number";
                }
                RegexValuesModel            rvm        = regexModels[model];
                Dictionary <string, string> textValues = new Dictionary <string, string>();
                textValues.Add("v_title", _title);
                XElement xe2 = xe.zXPathElement("NormalizedFilename");
                if (xe2 != null)
                {
                    //(from xa in xe2.Attributes() where xa.Name.ToString().StartsWith("v_") select xa).zAttribs(textValues);
                    textValues.zAdd(from xa in xe2.Attributes() where xa.Name.ToString().StartsWith("v_") select xa);
                }
                string pattern = rvm.pattern.zSetTextVariables(textValues, true);
                string values  = rvm.values.zSetTextVariables(textValues, true);
                _normalizedFilename = new RegexValues(rvm.key, rvm.name, pattern, rvm.options, values);

                if (_specialNoDate)
                {
                    model = "special_name_number";
                }
                else
                {
                    model = "special_name_month_number";
                }
                rvm        = regexModels[model];
                textValues = new Dictionary <string, string>();
                textValues.Add("v_title", _title);
                xe2 = xe.zXPathElement("NormalizedSpecialFilename");
                if (xe2 != null)
                {
                    //(from xa in xe2.Attributes() where xa.Name.ToString().StartsWith("v_") select xa).zAttribs(textValues);
                    textValues.zAdd(from xa in xe2.Attributes() where xa.Name.ToString().StartsWith("v_") select xa);
                }
                pattern = rvm.pattern.zSetTextVariables(textValues, true);
                values  = rvm.values.zSetTextVariables(textValues, true);
                _normalizedSpecialFilename = new RegexValues(rvm.key, rvm.name, pattern, rvm.options, values);
            }
        }
Ejemplo n.º 8
0
        public Print1(XElement xe, string baseDirectory, Dictionary<string, RegexValuesModel> regexModels = null)
        {
            _name = xe.zXPathValue("Name");
            _title = xe.zXPathValue("Title");
            _frequency = GetFrequency(xe.zXPathValue("Frequency"));
            if (_frequency == PrintFrequency.Weekly || _frequency == PrintFrequency.EveryTwoWeek)
                _weekday = zdate.GetDayOfWeek(xe.zXPathValue("Weekday"));
            _directory = xe.zXPathValue("Directory").zRootPath(baseDirectory);
            //if (!Path.IsPathRooted(_directory))
            //    _directory = Path.Combine(baseDirectory, _directory);
            SetOption(xe.zXPathValue("Option"));
            if (!_noDateAndNumberCalculate)
            {
                string dateRef = xe.zXPathValue("DateReference");
                string numberRef = xe.zXPathValue("NumberReference");
                if (dateRef == null && numberRef != null)
                    throw new PBException("error missing reference number \"{0}\"", _name);
                if (dateRef != null && numberRef == null)
                    throw new PBException("error missing reference date \"{0}\"", _name);
                if (dateRef == null)
                    _noDateAndNumberCalculate = true;
                else
                {
                    _refPrintDate = Date.Parse(dateRef);
                    _refPrintNumber = int.Parse(numberRef);
                    GetNoPrintDays(xe.zXPathValues("NoPrintDays/NoPrintDay"));
                    GetNoPrintMonths(xe.zXPathValues("NoPrintMonths/NoPrintMonth"));
                }
            }
            //if (regexModels != null)
            //{
            //    string model;
            //    if (_frequency == PrintFrequency.Daily || _frequency == PrintFrequency.Weekly || _frequency == PrintFrequency.EveryTwoWeek)
            //    {
            //        if (!_noNumber)
            //            model = "name_day_number";
            //        else
            //            model = "name_day";
            //    }
            //    else
            //        model = "name_month_number";
            //    RegexValuesModel rvm = regexModels[model];
            //    Dictionary<string, string> textValues = new Dictionary<string, string>();
            //    textValues.Add("v_title", _title);
            //    XElement xe2 = xe.zXPathElement("NormalizedFilename");
            //    if (xe2 != null)
            //        (from xa in xe2.Attributes() where xa.Name.ToString().StartsWith("v_") select xa).zAttribs(textValues);
            //    string pattern = rvm.pattern.zSetTextValues(textValues, true);
            //    string values = rvm.values.zSetTextValues(textValues, true);
            //    _normalizedFilename = new RegexValues(rvm.key, rvm.name, pattern, rvm.options, values);

            //    if (_specialNoDate)
            //        model = "special_name_number";
            //    else
            //        model = "special_name_month_number";
            //    rvm = regexModels[model];
            //    textValues = new Dictionary<string, string>();
            //    textValues.Add("v_title", _title);
            //    xe2 = xe.zXPathElement("NormalizedSpecialFilename");
            //    if (xe2 != null)
            //        (from xa in xe2.Attributes() where xa.Name.ToString().StartsWith("v_") select xa).zAttribs(textValues);
            //    pattern = rvm.pattern.zSetTextValues(textValues, true);
            //    values = rvm.values.zSetTextValues(textValues, true);
            //    _normalizedSpecialFilename = new RegexValues(rvm.key, rvm.name, pattern, rvm.options, values);
            //}
        }
Ejemplo n.º 9
0
 public LeVifExpress(string name, string title, PrintFrequency frequency, DayOfWeek?weekday, string directory, Date refPrintDate, int refPrintNumber, SpecialDay noPrintDays)
     : base(name, title, frequency, weekday, directory, refPrintDate, refPrintNumber, noPrintDays)
 {
 }