Exemplo n.º 1
0
        private void RenderWorkCalendar(WorkCalendar workCalendar)
        {
            var item = new ListViewItem(workCalendar.ID.ToString());

            item.SubItems.Add(workCalendar.MonthPeriod.ToString());
            item.SubItems.Add(workCalendar.YearPeriod.ToString());
            item.SubItems.Add(workCalendar.WorkDay.ToString());
            item.SubItems.Add(workCalendar.OffDay.ToString());

            if (workCalendar.IsClosed == true)
            {
                item.SubItems.Add("V");
            }
            else
            {
                item.SubItems.Add("-");
            }

            if (workCalendar.IsThrClosed == true)
            {
                item.SubItems.Add("V");
            }
            else
            {
                item.SubItems.Add("-");
            }

            lvwData.Items.Add(item);
        }
Exemplo n.º 2
0
 protected override ValidationResult IsValid(object value, ValidationContext validationContext)
 {
     if (value != null)
     {
         ReservationData rsd = (ReservationData)validationContext.ObjectInstance;
         if (rsd.Date == null)
         {
             // if date is empty, we do not check whether it is working day
             return(ValidationResult.Success);
         }
         bool workday = (WorkCalendar.IsCalWorkDay(DateTime.ParseExact(rsd.Date + " 00:00:00", "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture)) == 1);
         if (workday)
         {
             return(ValidationResult.Success);
         }
         else
         {
             var errorMessage = FormatErrorMessage(validationContext.DisplayName);
             return(new ValidationResult(errorMessage));
         }
     }
     else
     {
         return(ValidationResult.Success);
     }
 }
Exemplo n.º 3
0
 private void ViewWorkCalendarDetail(WorkCalendar workCalendar)
 {
     txtID.Text             = workCalendar.ID.ToString();
     nudMonth.Value         = workCalendar.MonthPeriod;
     nudYear.Value          = workCalendar.YearPeriod;
     txtWorkDay.Text        = workCalendar.WorkDay.ToString();
     txtDayOff.Text         = workCalendar.OffDay.ToString();
     chkIsClosed.Checked    = workCalendar.IsClosed;
     chkIsThrClosed.Checked = workCalendar.IsThrClosed;
 }
Exemplo n.º 4
0
        private WorkCalendarBase LoadCalendar(string file, int calUID)
        {
            WorkCalendar retVal = null;
            XmlDocument  srcDoc = new XmlDocument();

            srcDoc.Load(file);
            XmlNamespaceManager nsXmlMmngr =
                new XmlNamespaceManager(srcDoc.NameTable);

            nsXmlMmngr.AddNamespace("ns", @"http://schemas.microsoft.com/project");

            string  calXPath     = String.Format("ns:Calendars/ns:Calendar[ns:UID = '{0}']", calUID);
            XmlNode calendarNode = srcDoc.DocumentElement.SelectSingleNode(calXPath, nsXmlMmngr);

            retVal = new SerializableCalendar(calendarNode.OuterXml);

            return(retVal);
        }
Exemplo n.º 5
0
 public static WorkCalendar CreateWorkCalendar(bool isWorkingDay, global::System.DateTime date, global::System.Guid ID)
 {
     WorkCalendar workCalendar = new WorkCalendar();
     workCalendar.IsWorkingDay = isWorkingDay;
     workCalendar.Date = date;
     workCalendar.Id = ID;
     return workCalendar;
 }
Exemplo n.º 6
0
 public void AddToHolidays(WorkCalendar workCalendar)
 {
     base.AddObject("Holidays", workCalendar);
 }