private void CheckDescendantCheckboxes(ClsItem objTreeItemModel)
 {
     foreach (ClsItem child in GetChildren(objTreeItemModel))
     {
         CheckObject(child);
         CheckDescendantCheckboxes(child);
     }
 }
示例#2
0
        public static ResultadoTransaccion ListarItemsTarifas()
        {
            ResultadoTransaccion res       = new ResultadoTransaccion();
            IList <ClsItem>      listItems = new List <ClsItem>();

            try
            {
                //Abrir Conexion
                conn = BaseDatos.Conexion();

                //Consultar Asuntos x Tipo Actividad
                objParams = SqlHelperParameterCache.GetSpParameterSet(conn, "SP_L_Cotizacion_Items");

                SqlCommand command = new SqlCommand("SP_L_Cotizacion_Items", conn);

                command.Transaction = transaction;
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                dreader             = command.ExecuteReader();

                while (dreader.Read())
                {
                    var item = new ClsItem();
                    item.Id   = Convert.ToInt32(dreader["ID"]);
                    item.Id32 = Convert.ToInt32(dreader["ID"]);

                    if (dreader["Nombre"] != null)
                    {
                        item.Nombre = dreader["Nombre"].ToString();
                    }
                    if (dreader["Descripcion"] != null)
                    {
                        item.Descripcion = dreader["Descripcion"].ToString();
                    }

                    listItems.Add(item);
                }
                res.Accion            = Entidades.Enums.Enums.AccionTransaccion.Consultar;
                res.ObjetoTransaccion = listItems;
            }
            catch (Exception ex)
            {
                Log.EscribirLog(ex.Message);

                res.Descripcion  = ex.Message;
                res.ArchivoError = "clsTarifaADO";
                res.MetodoError  = "ListarItemsTarifas";
            }
            finally
            {
                conn.Close();
            }
            return(res);
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            if (!this.CheckIsLoaded())
            {
                this.EOCb_Browse.Execute    += this.EOCb_Browse_Execute;
                this.EOCb_View.Execute      += this.EOCb_View_Execute;
                this.EOCb_Selection.Execute += this.EOCb_Selection_Execute;

                base.Page_Load(sender, e);
                this.mObj = (ClsItem)this.pObj_Base;
                this.UcFileBrowser.EvAccept += this.Handle_FileBrowser;
                this.UcSelection.EvAccept   += this.Handle_Selection;

                if (!this.IsPostBack)
                {
                    this.SetupPage();
                }
            }
        }
示例#4
0
        public static ResultadoTransaccion ListarTodosLosItems()
        {
            ResultadoTransaccion res = new ResultadoTransaccion();
            IList<ClsItem> listItems = new List<ClsItem>();
            try
            {
                //Abrir Conexion
                conn = BaseDatos.Conexion();

                //Consultar Asuntos x Tipo Actividad
                objParams = SqlHelperParameterCache.GetSpParameterSet(conn, "SP_C_Cotizacion_Items");

                SqlCommand command = new SqlCommand("SP_C_Cotizacion_Items", conn);

                command.Transaction = transaction;
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                dreader = command.ExecuteReader();

                while (dreader.Read())
                {
                    var item = new ClsItem();
                    item.Id = Convert.ToInt32(dreader["id"]);
                    item.Id32 = Convert.ToInt32(dreader["id"]);
                    item.Nombre = dreader["nombre"].ToString();
                    item.Descripcion = dreader["descripcion"].ToString();
                    listItems.Add(item);
                }
                res.Accion = Entidades.Enums.Enums.AccionTransaccion.Consultar;
                res.ObjetoTransaccion = listItems;
            }
            catch (Exception ex)
            {
                Log.EscribirLog(ex.Message);

                res.Descripcion = ex.Message;
                res.ArchivoError = "ClsCotizacionADO";
                res.MetodoError = "ListarTodosLosItems";
            }
            finally
            {
                conn.Close();
            }
            return res;
        }
        private void FooTreeListView_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            Console.WriteLine("In FooTreeListView_ItemChecked");
            ItemChecked -= FooTreeListView_ItemChecked;
            ClsItem objTreeItemModel = (ClsItem)((OLVListItem)e.Item).RowObject;

            //set descendant checkboxes
            if (IsChecked(objTreeItemModel))
            {
                CheckDescendantCheckboxes(objTreeItemModel);
            }
            else
            {
                UncheckDescendantCheckboxes(objTreeItemModel);
            }
            ClsItem objTreeItemModelParent = (ClsItem)GetParent(objTreeItemModel);

            //Set ancestor checkboxes
            while (objTreeItemModelParent != null)
            {
                bool allChildrenChecked   = true;
                bool allChildrenUnchecked = true;
                // If all 1st generation children of the parent are checked, set parent to checked
                // If all 1st generation children of the parent are unchecked, set parent to unchecked
                // Otherwise, set parent to indeterminte
                foreach (ClsItem child in GetChildren(objTreeItemModelParent))
                {
                    if (IsChecked(child))
                    {
                        allChildrenUnchecked = false;
                    }
                    if (!IsChecked(child))
                    {
                        allChildrenChecked = false;
                    }
                    if (IsCheckedIndeterminate(child))
                    {
                        allChildrenUnchecked = false;
                        allChildrenChecked   = false;
                        break;
                    }
                }
                if (allChildrenChecked)
                {
                    CheckObject(objTreeItemModelParent);
                }
                else if (allChildrenUnchecked)
                {
                    UncheckObject(objTreeItemModelParent);
                }
                else
                {
                    CheckIndeterminateObject(objTreeItemModelParent);
                }
                objTreeItemModelParent = (ClsItem)GetParent(objTreeItemModelParent);
            }                     // while

            if (showHeaderCheckBox)
            {
                bool allChecked   = true;
                bool allUnchecked = true;
                foreach (ClsItem topLevelItem in this.Objects)
                {
                    if (IsChecked(topLevelItem))
                    {
                        allUnchecked = false;
                    }
                    if (!IsChecked(topLevelItem))
                    {
                        allChecked = false;
                    }
                    if (IsCheckedIndeterminate(topLevelItem))
                    {
                        allUnchecked = false;
                        allChecked   = false;
                        break;
                    }
                }
                HeaderCheckBoxChanging -= ClsFooTreeListView_HeaderCheckBoxChanging;
                if (allChecked)
                {
                    CheckHeaderCheckBox(olvColumnName);
                }
                else if (allUnchecked)
                {
                    UncheckHeaderCheckBox(olvColumnName);
                }
                else
                {
                    CheckIndeterminateHeaderCheckBox(olvColumnName);
                }
                HeaderCheckBoxChanging += ClsFooTreeListView_HeaderCheckBoxChanging;
            }             // if (showHeaderCheckBox)
            ItemChecked += FooTreeListView_ItemChecked;
        }                 // private void FooTreeListView_ItemChecked(object sender, ItemCheckedEventArgs e)