/// <summary>
        /// Show the Entitu in EntyForm
        /// With default value of objet
        /// and Defailt value of filter
        /// </summary>
        public virtual void ShowEntity(Dictionary <string, object> CritereRechercheFiltre, EntityActions EntityAction)
        {
            // Generate the the form if is note generated
            CreateFieldIfNotGenerated();

            // set SetpInitalize to true to not execute EventsChange
            isStepInitializingValues = true;

            BaseEntity entity     = this.Entity;
            Type       typeEntity = this.EntityBLO.TypeEntity;

            foreach (PropertyInfo item in ListeChampsFormulaire())
            {
                ConfigProperty configProperty = new ConfigProperty(item, this.ConfigEntity);
                // Param
                WriteEntity_To_EntryForm_Param param = new WriteEntity_To_EntryForm_Param();
                param.Entity                 = this.Entity;
                param.ConfigProperty         = configProperty;
                param.CritereRechercheFiltre = CritereRechercheFiltre;
                param.FromContainer          = ConteneurFormulaire;
                param.EntityAction           = EntityAction;

                // Get FieldTraitement Type
                IFieldTraitements fieldTraitement = BaseFieldTraitement.CreateInstance(configProperty);

                // Invok Create Field Method
                fieldTraitement.ShowEntity_To_EntryForm(param);
            }
            // Fin de la phase d'initialisaiton
            this.isStepInitializingValues = false;
        }
コード例 #2
0
        public void ShowEntity_To_EntryForm(WriteEntity_To_EntryForm_Param param)
        {
            LocalizedString valeur = (LocalizedString)param.Entity.GetType().GetProperty(param.ConfigProperty.PropertyInfo.Name).GetValue(param.Entity);

            // Use Filter Value
            if (param.CritereRechercheFiltre != null && param.CritereRechercheFiltre.ContainsKey(param.ConfigProperty.PropertyInfo.Name))
            {
                valeur.Current = param.CritereRechercheFiltre[param.ConfigProperty.PropertyInfo.Name].ToString();
            }

            // Find baseField control in ConteneurFormulaire
            // And Set Value
            Control[] recherche = param.FromContainer.Controls.Find(param.ConfigProperty.PropertyInfo.Name, true);
            if (recherche.Count() > 0)
            {
                BaseField baseField = (BaseField)recherche.First();
                if (baseField == null)
                {
                    throw new GwinException("The field " + param.ConfigProperty.PropertyInfo.Name + "not exit in EntryForm");
                }

                if (valeur != null)
                {
                    baseField.Value = valeur.Current;
                }
            }
        }
コード例 #3
0
        public void ShowEntity_To_EntryForm(WriteEntity_To_EntryForm_Param param)
        {
            BaseEntity valeur = (BaseEntity)param.Entity.GetType().GetProperty(param.ConfigProperty.PropertyInfo.Name).GetValue(param.Entity);

            if (valeur == null)
            {
                return;
            }
            Int64 valeur_id = valeur.Id;

            // Use Filter Value
            if (param.CritereRechercheFiltre != null && param.CritereRechercheFiltre.ContainsKey(param.ConfigProperty.PropertyInfo.Name))
            {
                valeur_id = Convert.ToInt64(param.CritereRechercheFiltre[param.ConfigProperty.PropertyInfo.Name]);
            }

            // Find baseField control in ConteneurFormulaire
            // And Set Value
            Control[] recherche = param.FromContainer.Controls.Find(param.ConfigProperty.PropertyInfo.Name, true);
            if (recherche.Count() > 0)
            {
                BaseField baseField = (BaseField)recherche.First();
                if (baseField == null)
                {
                    throw new GwinException("The field " + param.ConfigProperty.PropertyInfo.Name + "not exit in EntryForm");
                }
                baseField.Value = valeur_id;
            }
        }
コード例 #4
0
        // We can not check validation of DateTime Control because we can not knew the default value
        //private void DateTimeField_Validating(object sender, CancelEventArgs e)
        //{
        //    DateTimeField dateTimeField = (DateTimeField)sender;
        //    string message = "La saisie de ce champs est oblégatoir";

        //    // à vérifer avec les second
        //    DateTime value = (DateTime)dateTimeField.Value;
        //    if (value.Year == DateTime.Now.Year)
        //    {
        //        errorProvider.SetError(controle, message);
        //        e.Cancel = true;
        //    }
        //    else
        //        errorProvider.SetError(controle, "");
        //}



        public void ShowEntity_To_EntryForm(WriteEntity_To_EntryForm_Param param)
        {
            DateTime value = (DateTime)param.Entity.GetType().GetProperty(param.ConfigProperty.PropertyInfo.Name).GetValue(param.Entity);

            // Use Filter Value
            if (param.CritereRechercheFiltre != null && param.CritereRechercheFiltre.ContainsKey(param.ConfigProperty.PropertyInfo.Name))
            {
                value = Convert.ToDateTime(param.CritereRechercheFiltre[param.ConfigProperty.PropertyInfo.Name]);
            }

            // Find baseField control in ConteneurFormulaire
            // And Set Value
            Control[] recherche = param.FromContainer.Controls.Find(param.ConfigProperty.PropertyInfo.Name, true);
            if (recherche.Count() > 0)
            {
                BaseField baseField = (BaseField)recherche.First();
                if (baseField == null)
                {
                    throw new GwinException("The field " + param.ConfigProperty.PropertyInfo.Name + "not exit in EntryForm");
                }


                if (value.Year == 1)
                {
                    // [DataBase] Imcompatiblite with other DataBase
                    baseField.Value = ( DateTime)System.Data.SqlTypes.SqlDateTime.MinValue;
                }
                else
                {
                    baseField.Value = value;
                }
            }
        }
        public void ShowEntity_To_EntryForm(WriteEntity_To_EntryForm_Param param)
        {
            IList v_ls_object = param.Entity.GetType().GetProperty(param.ConfigProperty.PropertyInfo.Name).GetValue(param.Entity) as IList;

            if (v_ls_object == null)
            {
                return;
            }
            List <object> ls_object = v_ls_object.Cast <Object>().ToList();

            List <BaseEntity> ls_valeur = ls_object.Cast <BaseEntity>().ToList();

            if (ls_valeur == null)
            {
                return;
            }



            // Use Filter Value
            if (param.CritereRechercheFiltre != null && param.CritereRechercheFiltre.ContainsKey(param.ConfigProperty.PropertyInfo.Name))
            {
                throw new NotImplementedException();
            }

            // Find baseField control in ConteneurFormulaire
            // And Set Value
            Control[] recherche = param.FromContainer.Controls.Find(param.ConfigProperty.PropertyInfo.Name, true);
            if (recherche.Count() > 0)
            {
                BaseField baseField = (BaseField)recherche.First();
                if (baseField == null)
                {
                    throw new GwinException("The field " + param.ConfigProperty.PropertyInfo.Name + "not exit in EntryForm");
                }
                baseField.Value = ls_valeur;
            }
        }
        public void ShowEntity_To_EntryForm(WriteEntity_To_EntryForm_Param param)
        {
            var valeur = param.Entity.GetType().GetProperty(param.ConfigProperty.PropertyInfo.Name).GetValue(param.Entity);

            // Use Filter Value
            if (param.CritereRechercheFiltre != null && param.CritereRechercheFiltre.ContainsKey(param.ConfigProperty.PropertyInfo.Name))
            {
                throw new GwinNotImplementedException("Enumeation in Filter not yet implmented");
            }

            // Find baseField control in ConteneurFormulaire
            // And Set Value
            Control[] recherche = param.FromContainer.Controls.Find(param.ConfigProperty.PropertyInfo.Name, true);
            if (recherche.Count() > 0)
            {
                BaseField baseField = (BaseField)recherche.First();
                if (baseField == null)
                {
                    throw new GwinException("The field " + param.ConfigProperty.PropertyInfo.Name + "not exit in EntryForm");
                }
                baseField.Value = valeur;
            }
        }
コード例 #7
0
        /// <summary>
        /// Step2 : Show Entity to EntryForm
        /// </summary>
        /// <param name="param">Parameters</param>
        public void ShowEntity_To_EntryForm(WriteEntity_To_EntryForm_Param param)
        {
            object value = null;

            // Determine Value if EntryForm.isShowDefaultValueWhenAdd is true
            if (param.EntityAction != BaseEntryForm.EntityActions.Add ||
                param.EntityAction == BaseEntryForm.EntityActions.Add && param.ConfigProperty.EntryForm.isShowDefaultValueWhenAdd)
            {
                value = param
                        .Entity
                        .GetType()
                        .GetProperty(param.ConfigProperty.PropertyInfo.Name)
                        .GetValue(param.Entity);
            }

            // Use Filter Value if exist
            if (param.CritereRechercheFiltre != null && param.CritereRechercheFiltre.ContainsKey(param.ConfigProperty.PropertyInfo.Name))
            {
                value = param.CritereRechercheFiltre[param.ConfigProperty.PropertyInfo.Name].ToString();
            }

            // Find baseField control in ConteneurFormulaire and set Value
            if (value != null)
            {
                Control[] recherche = param.FromContainer.Controls.Find(param.ConfigProperty.PropertyInfo.Name, true);
                if (recherche.Count() > 0)
                {
                    BaseField baseField = (BaseField)recherche.First();
                    if (baseField == null)
                    {
                        throw new GwinException("The field " + param.ConfigProperty.PropertyInfo.Name + "not exit in EntryForm");
                    }
                    baseField.Value = value;
                }
            }
        }
コード例 #8
0
 public void ShowEntity_To_EntryForm(WriteEntity_To_EntryForm_Param param)
 {
     throw new GwinException("Field Many to Many Creation in EntryForm not yet implemented in Gwin Application");
 }