Esempio n. 1
0
 protected override void SetCellsDataSource(string gridName)
 {
     switch (gridName)
     {
     case "Material_Grid":
     {
         foreach (DataGridViewRow row in Material_Grid.Rows)
         {
             if (row.IsNewRow)
             {
                 continue;
             }
             if (lista_sources.Count >= row.Index + 1)
             {
                 continue;
             }
             Material_Plan info = (Material_Plan)row.DataBoundItem;
             if (info != null)
             {
                 RevisionMaterialInfo revision = _revisiones.GetItem(info.OidRevision);
                 if (revision != null)
                 {
                     lista_sources.Add(_combo_materiales.GetFilteredChilds(revision.OidMaterial));
                     ((DataGridViewComboBoxCell)row.Cells["Version_CBC"]).DataSource = lista_sources[row.Index];
                 }
             }
         }
     } break;
     }
 }
 /// <summary>
 /// Asigna los valores del grid que no están asociados a propiedades
 /// </summary>
 protected override void SetUnlinkedGridValues(string gridName)
 {
     switch (gridName)
     {
     case "Material_Grid":
     {
         SetCellsDataSource(Material_Grid.Name);
         foreach (DataGridViewRow row in Material_Grid.Rows)
         {
             if (row.IsNewRow)
             {
                 continue;
             }
             Material_Plan info = (Material_Plan)row.DataBoundItem;
             if (info != null)
             {
                 RevisionMaterialInfo revision = _revisiones.GetItem(info.OidRevision);
                 if (revision != null)
                 {
                     row.Cells["Material_CBC"].Value = revision.OidMaterial;
                     row.Cells["Autor"].Value        = revision.Autor;
                 }
             }
         }
     } break;
     }
 }
Esempio n. 3
0
        //public override void PrintObject()
        //{
        //}

        //#endregion

        //#region Buttons

        //protected override void PrintAction()
        //{
        //    switch (TabControl.SelectedTab.Name)
        //    {
        //        case "General_TP":
        //            {
        //                PrintObject();
        //            } break;

        //        default:
        //            {
        //                PrintSelectSkinForm psform = new PrintSelectSkinForm(true);
        //                psform.EnableDetail(false);
        //                psform.ShowDialog();
        //                if (psform.DialogResult == DialogResult.Cancel) return;

        //                switch (TabControl.SelectedTab.Name)
        //                {
        //                    case "Redes_TP":
        //                        {
        //                            PrintData(Entidad.Red, psform.Source, psform.Type);
        //                        } break;

        //                }
        //            } break;
        //    }
        //}

        #endregion

        #region Buttons

        #endregion

        #region Events

        private void Material_Grid_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (Material_Grid.Columns[e.ColumnIndex].Name == "Material_CBC" && Datos_MaterialesD.Current != null && ((ComboBoxSource)
                                                                                                                     Datos_MaterialesD.Current).Oid > 0)
            {
                if (Material_Grid["Material_CBC", e.RowIndex].Value != null)
                {
                    //se está modificando una línea ya existente
                    if (lista_sources.Count > e.RowIndex)
                    {
                        lista_sources[e.RowIndex] = _combo_materiales.GetFilteredChilds(((ComboBoxSource)Datos_MaterialesD.Current).Oid);
                    }
                    else //hay que añadir un nuevo datasource a la lista
                    {
                        lista_sources.Add(_combo_materiales.GetFilteredChilds(((ComboBoxSource)Datos_MaterialesD.Current).Oid));
                    }
                    ((DataGridViewComboBoxCell)(Material_Grid["Version_CBC", e.RowIndex])).DataSource = lista_sources[e.RowIndex];
                }
            }
            if (Material_Grid.Columns[e.ColumnIndex].Name == "Version_CBC")
            {
                Material_Plan        info     = (Material_Plan)Material_Grid.Rows[e.RowIndex].DataBoundItem;
                RevisionMaterialInfo revision = RevisionMaterialList.GetList(false).GetItem(info.OidRevision);
                if (info.OidRevision != 0)
                {
                    Material_Grid["Autor", e.RowIndex].Value = revision.Autor;
                }
            }
        }