Exemplo n.º 1
0
    static DaysAttributeCache()
    {
        Type enumType = typeof(Days);

        Cache = new string[Enum.GetValues(typeof(Days)).Length];
        foreach (Enum value in Enum.GetValues(typeof(Days)))
        {
            var          name      = Days.GetName(enumType, value);
            DayAttribute attribute = enumType
                                     .GetField(name)
                                     .GetCustomAttributes(false)
                                     .OfType <DayAttribute>()
                                     .SingleOrDefault();
            string weekDay = attribute?.Name;
            Cache[((IConvertible)value).ToInt32(CultureInfo.InvariantCulture)] = weekDay;
        }
    }
Exemplo n.º 2
0
        public void UpdateWindow(int rowIndex)
        {
            try
            {
                int          id             = int.Parse(this.recordGrid.Rows[rowIndex].Cells[DailyAttributeController.ID_INDEX].Value.ToString());
                DayAttribute dailyAttribute = this.View_QueryResults
                                              .Where(x => x.Id == id)
                                              .FirstOrDefault();

                this.lblId.Text          = dailyAttribute.Id.ToString();
                this.date.Value          = dailyAttribute.Date.Date;
                this.txtDescription.Text = dailyAttribute.Description;
                this.txtLink.Text        = dailyAttribute.Link;
            }
            catch (ArgumentOutOfRangeException) { /*Skip*/ }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DayAttribute attribute = new DayAttribute
            {
                System_Created = DateTime.Now,
            };

            if (!string.IsNullOrEmpty(this.lblId.Text))
            {
                attribute = this.View_QueryResults
                            .Where(x => x.Id == int.Parse(this.lblId.Text))
                            .FirstOrDefault();
            }

            attribute.Date                 = this.date.Value.Date;
            attribute.Description          = this.txtDescription.Text;
            attribute.Link                 = this.txtLink.Text;
            attribute.SystemUpdateDateTime = DateTime.Now;

            this.View_SaveRecord(attribute);
            this.View_QueryRecords(null);
            this.WindowInputChanges(ModifierState.Save);
        }