Ejemplo n.º 1
0
        public void Inicializar(BusinessMapper.eEntities entidad)
        {
            ObjetoDTO = DTOHelper.InstanciarObjetoPorNombreDeTabla(entidad.ToString());
            Entidad   = entidad;
            dao       = BusinessMapper.GetDaoByEntity(entidad);

            this.create     = Create;
            this.update     = Update;
            this.ReadMethod = Read;
            this.delete     = Delete;

            List <ABMControl> controls = GetControlsByEntity(entidad);

            BuildControls(controls.ToArray());
        }
Ejemplo n.º 2
0
        internal static GridViewDataComboBoxColumn BuildComboColumn(string caption, string fieldName, BusinessMapper.eEntities entity)
        {
            GridViewDataComboBoxColumn gvc = new GridViewDataComboBoxColumn();

            gvc.Name      = fieldName;
            gvc.Caption   = caption;
            gvc.FieldName = fieldName;

            var mapInfo = BusinessMapper.GetMapInfo(entity.ToString());

            gvc.PropertiesComboBox.TextField  = mapInfo.EntityTextField;
            gvc.PropertiesComboBox.ValueField = mapInfo.EntityValueField;
            gvc.PropertiesComboBox.DataSource = mapInfo.DAOHandler.ReadAll("");

            return(gvc);
        }
Ejemplo n.º 3
0
 internal void Inicializar(BusinessMapper.eEntities entityName, bool autoPostBack)
 {
     EntityName = entityName.ToString();
     Inicializar(MapInfo.DAOHandler.ReadAll(""), MapInfo.EntityTextField, MapInfo.EntityValueField);
     cmbEntidad.AutoPostBack = autoPostBack;
 }
Ejemplo n.º 4
0
 internal void Inicializar(BusinessMapper.eEntities entityName, string where)
 {
     EntityName = entityName.ToString();
     Inicializar(MapInfo.DAOHandler.ReadAll(where), MapInfo.EntityTextField, MapInfo.EntityValueField);
 }
Ejemplo n.º 5
0
        internal static void BuildColumnsByEntity(BusinessMapper.eEntities entidad, ASPxGridView gv)
        {
            if (BusinessMapper.AbmConfigXmlPath == null || BusinessMapper.AbmConfigXmlPath == string.Empty)
            {
                throw new Exception("Path del archivo AbmConfig.xml sin definir.");
            }

            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(BusinessMapper.AbmConfigXmlPath);

            gv.Columns.Clear();

            if (xDoc.SelectSingleNode(
                    "Entities/Entity[@EntityName='" + entidad.ToString() + "']") == null)
            {
                throw new AbmConfigXMLException("No existe la configuración de mapeo para la entidad: " + entidad.ToString());
            }


            foreach (XmlNode nodeControl in xDoc.SelectSingleNode(
                         "Entities/Entity[@EntityName='" + entidad.ToString() + "']").ChildNodes)
            {
                if (nodeControl.Attributes["ControlType"].Value == "ComboBox")
                {
                    GridViewDataComboBoxColumn gvc = new GridViewDataComboBoxColumn();

                    gvc.Name      = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption   = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    var mapInfo = BusinessMapper.GetMapInfo(nodeControl.Attributes["EntityName"].Value);

                    gvc.PropertiesComboBox.TextField  = mapInfo.EntityTextField;
                    gvc.PropertiesComboBox.ValueField = mapInfo.EntityValueField;
                    gvc.PropertiesComboBox.DataSource = mapInfo.DAOHandler.ReadAll("");

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "RadioButtonList")
                {
                    GridViewDataComboBoxColumn gvc = new GridViewDataComboBoxColumn();

                    gvc.Name      = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption   = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gvc.PropertiesComboBox.Items.Clear();
                    foreach (XmlNode item in nodeControl.ChildNodes[0].ChildNodes)
                    {
                        gvc.PropertiesComboBox.Items.Add(item.Attributes["Name"].Value, item.Attributes["Value"].Value);
                    }

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "TextBox" ||
                         nodeControl.Attributes["ControlType"].Value == "SpinEdit" ||
                         nodeControl.Attributes["ControlType"].Value == "TimeEdit")
                {
                    GridViewDataTextColumn gvc = new GridViewDataTextColumn();

                    gvc.Name      = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption   = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "DateEdit")
                {
                    GridViewDataDateColumn gvc = new GridViewDataDateColumn();

                    gvc.Name      = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption   = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "CheckBox")
                {
                    GridViewDataCheckColumn gvc = new GridViewDataCheckColumn();

                    gvc.Name      = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption   = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gv.Columns.Add(gvc);
                }
            }
        }
Ejemplo n.º 6
0
        private List <ABMControl> GetControlsByEntity(BusinessMapper.eEntities entidad)
        {
            List <ABMControl> controls = new List <ABMControl>();

            if (BusinessMapper.AbmConfigXmlPath == null || BusinessMapper.AbmConfigXmlPath == string.Empty)
            {
                throw new Exception("Path del archivo AbmConfig.xml sin definir.");
            }

            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(BusinessMapper.AbmConfigXmlPath);

            foreach (XmlNode nodeControl in xDoc.SelectSingleNode(
                         "Entities/Entity[@EntityName='" + entidad.ToString() + "']").ChildNodes)
            {
                if (nodeControl.Attributes["ControlType"].Value == "ComboBox")
                {
                    controls.Add(new ABMControl()
                    {
                        ComboBox   = (ucComboBox)Page.LoadControl("~/Controls/ucComboBox.ascx"),
                        Title      = nodeControl.Attributes["Title"].Value,
                        FieldName  = nodeControl.Attributes["FieldName"].Value,
                        EntityName = nodeControl.Attributes["FieldName"].Value
                    });
                    controls[controls.Count - 1].ComboBox.Inicializar(nodeControl.Attributes["EntityName"].Value);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "TextBox")
                {
                    controls.Add(new ABMControl()
                    {
                        TextBox   = new ASPxTextBox(),
                        Title     = nodeControl.Attributes["Title"].Value,
                        FieldName = nodeControl.Attributes["FieldName"].Value,
                    });
                }
                else if (nodeControl.Attributes["ControlType"].Value == "SpinEdit")
                {
                    controls.Add(new ABMControl()
                    {
                        Control   = new ASPxSpinEdit(),
                        Title     = nodeControl.Attributes["Title"].Value,
                        FieldName = nodeControl.Attributes["FieldName"].Value,
                    });
                }
                else if (nodeControl.Attributes["ControlType"].Value == "CheckBox")
                {
                    controls.Add(new ABMControl()
                    {
                        Control   = new ASPxCheckBox(),
                        Title     = nodeControl.Attributes["Title"].Value,
                        FieldName = nodeControl.Attributes["FieldName"].Value,
                    });
                }
                else if (nodeControl.Attributes["ControlType"].Value == "RadioButtonList")
                {
                    controls.Add(new ABMControl()
                    {
                        Control   = new ASPxRadioButtonList(),
                        Title     = nodeControl.Attributes["Title"].Value,
                        FieldName = nodeControl.Attributes["FieldName"].Value
                    });

                    controls[controls.Count - 1].Items = new List <Item>();
                    foreach (XmlNode nodeItem in nodeControl.SelectNodes("Items/Item"))
                    {
                        controls[controls.Count - 1].Items.Add(
                            new Item(nodeItem.Attributes["Value"].Value, nodeItem.Attributes["Name"].Value));
                    }
                }
            }
            return(controls);
        }