示例#1
0
 internal static void AddNew(Entities.Tour tour, Entities.TourGroup group, Entities.GeneralType serviceType)
 {
     using (FrmGroupServiceEditor frm = new
                                        FrmGroupServiceEditor(tour, group, serviceType))
     {
         frm.ShowDialog();
     }
 }
        public FrmGroupServiceEditor(Entities.Tour tour, Entities.TourGroup group, Entities.GeneralType serviceType)
        {
            this.group = group;

            CreateService(tour, group);
            this.service.Detail.ServiceType = serviceType;

            Init();
        }
        public void OnGroupStateMenu(Entities.GeneralType item)
        {
            Entities.GeneralType old = this.group.Status;

            this.group.Status = item;
            if (!DomainModel.TourGroups.Save(this.group))
            {
                this.group.Status = old;
            }
        }
        public void OnSignupTypeMenu(Entities.GeneralType item)
        {
            Entities.GeneralType old = this.group.SignUpType;

            this.group.SignUpType = item;
            if (!DomainModel.TourGroups.Save(this.group))
            {
                this.group.SignUpType = old;
            }
        }
        public override void InitializeEditingControl(int rowIndex, object
                                                      initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            // Set the value of the editing control to the current cell value.
            base.InitializeEditingControl(rowIndex, initialFormattedValue,
                                          dataGridViewCellStyle);

            ImageComboBox ctl =
                DataGridView.EditingControl as ImageComboBox;

            // Use the default row value when Value property is null.
            try
            {
                Entities.GeneralType value = (Entities.GeneralType)initialFormattedValue;
                ctl.SelectedItem = value;
            }
            catch (Exception)
            {
                ctl.SelectedItem = null;
            }
        }
示例#6
0
 void ToursGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
     {
         DataGridViewCell cell = this.Rows[e.RowIndex].Cells[e.ColumnIndex];
         if (cell != null && cell.Value is Entities.GeneralType)
         {
             Entities.GeneralType type = (Entities.GeneralType)cell.Value;
             if (DomainModel.TourStates.Exists(type))
             {
                 if (type.Id == 14 /*Reserved*/)
                 {
                     //cell.Style.BackColor = Color.Gold;
                     cell.Style.ForeColor = Color.Orange;
                 }
                 else if (type.Id == 15 /*Reserved*/)
                 {
                     //cell.Style.BackColor = Color.LightGreen;
                     cell.Style.ForeColor = Color.DarkGreen;
                 }
             }
         }
     }
 }
 public void OnNewServiceTypeClicked(Entities.GeneralType item)
 {
     Presentation.Controllers.GroupServices.AddNew(this.tour, this.group, item);
 }