示例#1
0
        public ActionResult Create([Bind(Include = "Id,ConcurrencyKey,EntityName,DataSource,SourceType,MethodType,Action,flag,other")] EntityDataSource entitydatasource, string UrlReferrer, bool?IsDDAdd)
        {
            CheckBeforeSave(entitydatasource);
            if (ModelState.IsValid)
            {
                string command = Request.Form["hdncommand"];
                db.EntityDataSources.Add(entitydatasource);
                db.SaveChanges();
                if (command == "Create & Continue")
                {
                    return(RedirectToAction("Edit", new { Id = entitydatasource.Id, UrlReferrer = UrlReferrer }));
                }
                if (!string.IsNullOrEmpty(UrlReferrer))
                {
                    return(Redirect(UrlReferrer));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }

            if (IsDDAdd != null)
            {
                ViewBag.IsDDAdd = Convert.ToBoolean(IsDDAdd);
            }
            LoadViewDataAfterOnCreate(entitydatasource);
            return(View(entitydatasource));
        }
示例#2
0
        public static IFieldConverter GetDataSource(Column field)
        {
            IFieldConverter result = null;

            if (field.Type.ToLower() == "bit")
            {
                result = new EnumDataSource()
                {
                    EnumTypeFullName = typeof(YesOrNo).FullName
                };
            }
            if (field.Name.IndexOf("UserId") >= 0 || field.Name.IndexOf("Creator") >= 0)
            {
                result = new EntityDataSource()
                {
                    EntityType = typeof(User)
                };
            }
            if (field.Name.IndexOf("DepartmentId") >= 0)
            {
                result = new EntityDataSource()
                {
                    EntityType = typeof(Department)
                };
            }
            return(result);
        }
示例#3
0
        // GET: /EntityDataSource/Edit/5
        public ActionResult Edit(int?id, string UrlReferrer, string HostingEntityName, string AssociatedType)
        {
            if (!User.CanEdit("EntityDataSource"))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EntityDataSource entitydatasource = db.EntityDataSources.Find(id);

            if (entitydatasource == null)
            {
                return(HttpNotFound());
            }
            if (UrlReferrer != null)
            {
                ViewData["EntityDataSourceParentUrl"] = UrlReferrer;
            }
            if (ViewData["EntityDataSourceParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/EntityDataSource") && !Request.UrlReferrer.AbsolutePath.EndsWith("/EntityDataSource/Edit/" + entitydatasource.Id + "") && !Request.UrlReferrer.AbsolutePath.EndsWith("/EntityDataSource/Create"))
            {
                ViewData["EntityDataSourceParentUrl"] = Request.UrlReferrer;
            }
            ViewData["HostingEntityName"] = HostingEntityName;
            ViewData["AssociatedType"]    = AssociatedType;
            LoadViewDataBeforeOnEdit(entitydatasource);
            ViewBag.EntityDataSourceIsHiddenRule = checkHidden("EntityDataSource");
            ViewBag.EntityName = new SelectList(GeneratorBase.MVC.ModelReflector.Entities.Where(p => !p.IsAdminEntity && p.IsExternalEntity), "Name", "DisplayName", entitydatasource.EntityName);
            return(View(entitydatasource));
        }
        public ServiceController()
        {
            var contextName             = "FinancialManagerModel";
            IFinancialDataSource source = new EntityDataSource(contextName);

            _service = new ServicesService(source);
        }
示例#5
0
 public ActionResult EditWizard([Bind(Include = "Id,ConcurrencyKey,EntityName,DataSource,SourceType,MethodType,Action,flag,other")] EntityDataSource entitydatasource, string UrlReferrer)
 {
     CheckBeforeSave(entitydatasource);
     if (ModelState.IsValid)
     {
         db.Entry(entitydatasource).State = EntityState.Modified;
         db.SaveChanges();
         if (!string.IsNullOrEmpty(UrlReferrer))
         {
             var uri   = new Uri(UrlReferrer);
             var query = HttpUtility.ParseQueryString(uri.Query);
             if (Convert.ToBoolean(query.Get("IsFilter")) == true)
             {
                 return(RedirectToAction("Index"));
             }
             else
             {
                 return(Redirect(UrlReferrer));
             }
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     LoadViewDataAfterOnEdit(entitydatasource);
     return(View(entitydatasource));
 }
示例#6
0
        // GET: /EntityDataSource/EditWizard/5
        public ActionResult EditWizard(int?id, string UrlReferrer)
        {
            if (!User.CanEdit("EntityDataSource"))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EntityDataSource entitydatasource = db.EntityDataSources.Find(id);

            if (entitydatasource == null)
            {
                return(HttpNotFound());
            }

            if (UrlReferrer != null)
            {
                ViewData["EntityDataSourceParentUrl"] = UrlReferrer;
            }
            if (ViewData["EntityDataSourceParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/EntityDataSource"))
            {
                ViewData["EntityDataSourceParentUrl"] = Request.UrlReferrer;
            }
            LoadViewDataBeforeOnEdit(entitydatasource);
            ViewBag.EntityDataSourceIsHiddenRule = checkHidden("EntityDataSource");
            return(View(entitydatasource));
        }
示例#7
0
 public ActionResult DeleteConfirmed(EntityDataSource entitydatasource, string UrlReferrer)
 {
     if (!User.CanDelete("EntityDataSource"))
     {
         return(RedirectToAction("Index", "Error"));
     }
     if (CheckBeforeDelete(entitydatasource))
     {
         //Delete Document
         db.Entry(entitydatasource).State = EntityState.Deleted;
         db.EntityDataSources.Remove(entitydatasource);
         db.SaveChanges();
         if (!string.IsNullOrEmpty(UrlReferrer))
         {
             return(Redirect(UrlReferrer));
         }
         if (ViewData["EntityDataSourceParentUrl"] != null)
         {
             string parentUrl = ViewData["EntityDataSourceParentUrl"].ToString();
             ViewData["EntityDataSourceParentUrl"] = null;
             return(Redirect(parentUrl));
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(entitydatasource));
 }
示例#8
0
        public ActionResult BulkUpdate([Bind(Include = "Id,ConcurrencyKey,EntityName,DataSource,SourceType,MethodType,Action,flag,other")] EntityDataSource entitydatasource, FormCollection collection, string UrlReferrer)
        {
            var bulkIds   = collection["BulkUpdate"].Split(',').ToList();
            var chkUpdate = collection["chkUpdate"];

            if (!string.IsNullOrEmpty(chkUpdate))
            {
                foreach (var id in bulkIds.Where(p => p != string.Empty))
                {
                    long             objId  = long.Parse(id);
                    EntityDataSource target = db.EntityDataSources.Find(objId);
                    EntityCopy.CopyValuesForSameObjectType(entitydatasource, target, chkUpdate);
                    db.Entry(target).State = EntityState.Modified;
                    try
                    {
                        db.SaveChanges();
                    }
                    catch { }
                }
            }
            if (!string.IsNullOrEmpty(UrlReferrer))
            {
                return(Redirect(UrlReferrer));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
示例#9
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            // We can only get a list of possible EntityTypeFilter values if we have:
            //    (1) Connection string so we can load metadata
            //    (2) DefaultContainerName to give scope to the lookup
            //    (3) EntitySetName that exists in DefaultContainerName so we can get its type and derived types
            // Even if these values are set, it may not be possible to actually find them in metadata, but at least we can try the lookup if requested

            EntityDataSource entityDataSource = context.Instance as EntityDataSource;

            if (entityDataSource != null &&
                !String.IsNullOrEmpty(entityDataSource.ConnectionString) &&
                !String.IsNullOrEmpty(entityDataSource.DefaultContainerName) &&
                !String.IsNullOrEmpty(entityDataSource.EntitySetName))
            {
                List <EntityDataSourceEntityTypeFilterItem> entityTypeFilterItems =
                    new EntityDataSourceDesignerHelper(entityDataSource, false /*interactiveMode*/).GetEntityTypeFilters(
                        entityDataSource.DefaultContainerName, entityDataSource.EntitySetName);

                string[] entityTypeFilters = new string[entityTypeFilterItems.Count];
                for (int i = 0; i < entityTypeFilterItems.Count; i++)
                {
                    entityTypeFilters[i] = entityTypeFilterItems[i].EntityTypeName;
                }
                return(new StandardValuesCollection(entityTypeFilters));
            }

            return(null);
        }
示例#10
0
 public ActionResult CreateQuick([Bind(Include = "Id,ConcurrencyKey,EntityName,DataSource,SourceType,MethodType,Action,flag,other")] EntityDataSource entitydatasource, string UrlReferrer, bool?IsAddPop, string AssociatedEntity)
 {
     CheckBeforeSave(entitydatasource);
     if (ModelState.IsValid)
     {
         db.EntityDataSources.Add(entitydatasource);
         db.SaveChanges();
         return(Json("FROMPOPUP", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
     }
     else
     {
         var errors = "";
         foreach (ModelState modelState in ViewData.ModelState.Values)
         {
             foreach (ModelError error in modelState.Errors)
             {
                 errors += error.ErrorMessage + ".  ";
             }
         }
         return(Json(errors, "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
     }
     LoadViewDataAfterOnCreate(entitydatasource);
     if (!string.IsNullOrEmpty(AssociatedEntity))
     {
         LoadViewDataForCount(entitydatasource, AssociatedEntity);
     }
     return(View(entitydatasource));
 }
示例#11
0
        public ActionResult EditQuick([Bind(Include = "Id,ConcurrencyKey,EntityName,DataSource,SourceType,MethodType,Action,flag,other")] EntityDataSource entitydatasource, string UrlReferrer, bool?IsAddPop, string AssociatedEntity)
        {
            CheckBeforeSave(entitydatasource);
            if (ModelState.IsValid)
            {
                string command = Request.Form["hdncommand"];
                db.Entry(entitydatasource).State = EntityState.Modified;

                db.SaveChanges();
                return(Json(UrlReferrer, "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var errors = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        errors += error.ErrorMessage + ".  ";
                    }
                }
                return(Json(errors, "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
            }

            LoadViewDataAfterOnEdit(entitydatasource);
            return(View(entitydatasource));
        }
        public void Page_Load(object sender, EventArgs e)
        {
            // Registrar el evento de actualización de DataSource
            EntityDataSource ds = (EntityDataSource)this.FindDataSourceControl();

            // Esta plantilla de campo se usa para la edición y para la inserción
            ds.Updating  += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
            ds.Inserting += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
        }
        public void Page_Load(object sender, EventArgs e)
        {
            // Register for the DataSource's updating event
            EntityDataSource ds = (EntityDataSource)this.FindDataSourceControl();

            // This field template is used both for Editing and Inserting
            ds.Updating  += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
            ds.Inserting += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
        }
示例#14
0
        public void Page_Load(object sender, EventArgs e)
        {
            // 註冊 DataSource 的更新事件
            EntityDataSource ds = (EntityDataSource)this.FindDataSourceControl();

            // 此欄位範本同時用於編輯和插入作業
            ds.Updating  += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
            ds.Inserting += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
        }
示例#15
0
        public void Page_Load(object sender, EventArgs e)
        {
            // 注册 DataSource 的更新事件
            EntityDataSource ds = (EntityDataSource)this.FindDataSourceControl();

            // 此字段模板用于执行编辑和插入操作
            ds.Updating  += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
            ds.Inserting += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
        }
示例#16
0
        public void Page_Load(object sender, EventArgs e)
        {
            EntityDataSource ds = (EntityDataSource)this.FindDataSourceControl();

            ds.ContextCreated += (_, ctxCreatedEnventArgs) => ObjectContext = ctxCreatedEnventArgs.Context;

            ds.Updating  += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
            ds.Inserting += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
        }
示例#17
0
 //private static readonly ILog LOG = LogManager.GetLogger(typeof(EntityDataSourceView));
 public EntityDataSourceView(EntityDataSource owner, ICacheService cache)
     : base(owner, "")
 {
     _cache = cache;
     _owner = owner;
     ((IDataSource)_owner).DataSourceChanged += delegate
     {
         OnDataSourceViewChanged(EventArgs.Empty);
     };
     MatchByAnyKey = false;
 }
示例#18
0
    private void next()
    {
        AllNewsTb altb = new AllNewsTb();

        PagedDataSource  pg = new PagedDataSource();
        EntityDataSource dt = new EntityDataSource();


        pg.AllowPaging = true;
        more.Enabled   = !pg.IsFirstPage;
    }
示例#19
0
        public ActionResult ControlList()
        {
            var table = new FoxOne.Controls.Table()
            {
                ShowIndex         = true,
                ShowCheckBox      = true,
                AllowPaging       = false,
                AutoGenerateColum = false,
                AutoHeight        = true
            };

            table.KeyFieldName = "Id";
            table.Columns.Add(new TableColumn()
            {
                FieldName = "Id"
            });
            table.Columns.Add(new TableColumn()
            {
                FieldName = "Type"
            });
            table.Columns.Add(new TableColumn()
            {
                FieldName = "Rank"
            });
            table.Columns.Add(new TableColumn()
            {
                FieldName = "TargetId"
            });
            table.Columns.Add(new TableColumn()
            {
                FieldName = "LastUpdateTime"
            });
            table.Buttons.Add(new TableButton()
            {
                CssClass = "btn btn-primary btn-sm", Id = "btnEdit", Name = "编辑", OnClick = "editCtrl('{0}','{1}')", DataFields = "PageId,Id"
            });
            table.Buttons.Add(new TableButton()
            {
                CssClass = "btn btn-danger btn-sm", Id = "btnDelete", Name = "删除", OnClick = "deleteCtrl('{0}','{1}')", DataFields = "PageId,Id"
            });
            var ds = new EntityDataSource()
            {
                EntityType = typeof(ComponentEntity)
            };

            ds.DataFilter = new RequestParameterDataFilter()
            {
                ParameterRange = ParameterRange.QueryString
            };
            table.DataSource  = ds;
            ViewData["table"] = table;
            return(View());
        }
        // Configures and displays the editor dialog based on the specified property name
        private bool Initialize(EntityDataSourceDesigner designer, EntityDataSource entityDataSource, string propertyName, IServiceProvider serviceProvider, string statement)
        {
            string propertyParameters      = GetOperationParameterProperty(propertyName);
            string autoGenProperty         = GetOperationAutoGenerateProperty(propertyName);
            bool   hasAutoGen              = (autoGenProperty != null);
            bool   autoGen                 = GetAutoGen(propertyName, designer);
            ParameterCollection parameters = GetParameters(propertyName, designer);
            string label          = GetStatementLabel(propertyName, false);
            string accessibleName = GetStatementLabel(propertyName, true);
            string helpTopic      = GetHelpTopic(propertyName);

            EntityDataSourceStatementEditorForm form = new EntityDataSourceStatementEditorForm(entityDataSource, serviceProvider,
                                                                                               hasAutoGen, autoGen, propertyName, label, accessibleName, helpTopic, statement, parameters);

            DialogResult result = UIHelper.ShowDialog(serviceProvider, form);

            if (result == DialogResult.OK)
            {
                // We use the property descriptors to reset the values to
                // make sure we clear out any databindings or expressions that
                // may be set.
                PropertyDescriptor propDesc = null;

                if (autoGenProperty != null)
                {
                    propDesc = TypeDescriptor.GetProperties(entityDataSource)[autoGenProperty];
                    propDesc.ResetValue(entityDataSource);
                    propDesc.SetValue(entityDataSource, form.AutoGen);
                }

                if (propertyName != null)
                {
                    propDesc = TypeDescriptor.GetProperties(entityDataSource)[propertyName];
                    propDesc.ResetValue(entityDataSource);
                    propDesc.SetValue(entityDataSource, form.Statement);
                }

                if (propertyParameters != null)
                {
                    SetParameters(propertyName, designer, form.Parameters);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#21
0
 public ActionResult DeleteBulk(long[] ids, string UrlReferrer)
 {
     foreach (var id in ids.Where(p => p > 0))
     {
         EntityDataSource entitydatasource = db.EntityDataSources.Find(id);
         db.Entry(entitydatasource).State = EntityState.Deleted;
         db.EntityDataSources.Remove(entitydatasource);
         try
         {
             db.SaveChanges();
         }
         catch { }
     }
     return(Json("Success", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
 }
示例#22
0
        internal async Task Update()
        {
            try
            {
                var list = await QueryData();

                if (list == null)
                {
                    throw new ArgumentNullException();
                }

                if (Binding == null)
                {
                    Binding = new BindingSource();
                    _source = new EntityDataSource();

                    _source.DbContextType = typeof(DbSSContext);

                    Binding.SuspendBinding();

                    Binding.DataSource    = new EntityBindingList <TEntity>(_source, list, null);
                    DGVJournal.DataSource = Binding;

                    OperationColumn();

                    Binding.ResumeBinding();

                    SetSelectCell();
                }
                else
                {
                    RememberSelectCell();

                    Binding.SuspendBinding();

                    Binding.DataSource = new EntityBindingList <TEntity>(_source, list, null);

                    Binding.ResumeBinding();

                    SetSelectCell();
                }
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
        }
        private bool EditQueryChangeCallback(object pair)
        {
            // pair.First is a wrapper that contains the EntityDataSource instance and property name being edited
            // pair.Second contains the value of the property being edited
            ITypeDescriptorContext context = (ITypeDescriptorContext)((Pair)pair).First;
            string value = (string)((Pair)pair).Second;

            EntityDataSource entityDataSource = (EntityDataSource)context.Instance;
            IServiceProvider serviceProvider  = entityDataSource.Site;

            IDesignerHost designerHost = (IDesignerHost)serviceProvider.GetService(typeof(IDesignerHost));

            Debug.Assert(designerHost != null, "Did not get DesignerHost service.");

            EntityDataSourceDesigner designer = (EntityDataSourceDesigner)designerHost.GetDesigner(entityDataSource);

            // Configure the dialog for the specified property and display it
            return(Initialize(designer, entityDataSource, context.PropertyDescriptor.Name, serviceProvider, value));
        }
示例#24
0
        internal static HealthcareLinkingProperties DeserializeHealthcareLinkingProperties(JsonElement element)
        {
            Optional <HealthcareEntityAssertion> assertion = default;
            Optional <string> name = default;
            Optional <IReadOnlyList <EntityDataSource> > links = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("assertion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    assertion = HealthcareEntityAssertion.DeserializeHealthcareEntityAssertion(property.Value);
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("links"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <EntityDataSource> array = new List <EntityDataSource>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EntityDataSource.DeserializeEntityDataSource(item));
                    }
                    links = array;
                    continue;
                }
            }
            return(new HealthcareLinkingProperties(assertion.Value, name.Value, Optional.ToList(links)));
        }
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            // We can only get a list of possible DefaultContainerName values if we have:
            //    (1) Connection string so we can load metadata
            // Even if this value is set, it may not be possible to actually load the metadata, but at least we can try the lookup if requested

            EntityDataSource entityDataSource = context.Instance as EntityDataSource;

            if (entityDataSource != null && !String.IsNullOrEmpty(entityDataSource.ConnectionString))
            {
                List <EntityDataSourceContainerNameItem> containerNameItems = new EntityDataSourceDesignerHelper(entityDataSource, false /*interactiveMode*/).GetContainerNames(true /*sortResults*/);
                string[] containers = new string[containerNameItems.Count];
                for (int i = 0; i < containerNameItems.Count; i++)
                {
                    containers[i] = containerNameItems[i].ToString();
                }
                return(new StandardValuesCollection(containers));
            }

            return(null);
        }
示例#26
0
        public ActionResult CreateWizard([Bind(Include = "Id,ConcurrencyKey,EntityName,DataSource,SourceType,MethodType,Action,flag,other")] EntityDataSource entitydatasource, string UrlReferrer)
        {
            CheckBeforeSave(entitydatasource);
            if (ModelState.IsValid)
            {
                db.EntityDataSources.Add(entitydatasource);
                db.SaveChanges();

                if (!string.IsNullOrEmpty(UrlReferrer))
                {
                    return(Redirect(UrlReferrer));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }

            LoadViewDataAfterOnCreate(entitydatasource);
            return(View(entitydatasource));
        }
示例#27
0
        // GET: /EntityDataSource/Details/5
        public ActionResult Details(int?id, string HostingEntityName, string AssociatedType)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EntityDataSource entitydatasource = db.EntityDataSources.Find(id);

            if (entitydatasource == null)
            {
                return(HttpNotFound());
            }
            ViewData["AssociatedType"]    = AssociatedType;
            ViewData["HostingEntityName"] = HostingEntityName;
            LoadViewDataBeforeOnEdit(entitydatasource);
            if (!string.IsNullOrEmpty(AssociatedType))
            {
                LoadViewDataForCount(entitydatasource, AssociatedType);
            }
            return(View(entitydatasource));
        }
示例#28
0
        private async void OnLoad(object sender, EventArgs eventArgs)
        {
            dgv_EmployeeToDepartment.AutoGenerateColumns = false;
            Cursor = Cursors.WaitCursor;
            //Создание компонента для привязки к источнику данных
            entityDataSource_Org = new EntityDataSource(components)
            {
                NameOrConnectionString = _conString,
                DbContextType          = typeof(TestDbContext)
            };
            entityDataSource_Org.DataError     += EntityDataSourceOrgOnDataError;
            entityDataSource_Org.SavingChanges += EntityDataSourceOrgOnSavingChanges;

            await Task.Run(() => entityDataSource_Org.EntitySets["Departments"].Query.Load());

            var bind = new Binding("Tag", entityDataSource_Org, "Departments");

            tv_Department.DataBindings.Add(bind);
            PopulateTreeView();
            if (tv_Department.Nodes.Count <= 0)
            {
                Cursor = DefaultCursor;
                return;
            }

            await entityDataSource_Org.EntitySets["Employees"].Query.LoadAsync();

            dgv_EmployeeToDepartment.DataSource = entityDataSource_Org;
            dgv_EmployeeToDepartment.DataMember = "Employees";

            cb_DepartmentToEmployee.DataSource = entityDataSource_Org;

            cb_DepartmentToEmployee.DisplayMember = "Departments.Name";
            cb_DepartmentToEmployee.ValueMember   = "Departments.DepartmentId";

            tv_Department.SelectedNode = tv_Department.TopNode;
            BindingEmployeeDetails(bindSrc_DepartmentToEmployee);
            Cursor = DefaultCursor;
        }
    private EntityDataSource getGridViewDataSource()
    {
        EntityDataSource dataSource = null;

        Control parent = this.Parent;

        dataSource = parent.FindControl(this.GridViewDataSourceID) as EntityDataSource;

        while (dataSource == null)
        {
            parent = parent.Parent;

            if (parent == null)
            {
                break;
            }

            dataSource = parent.FindControl(this.GridViewDataSourceID) as EntityDataSource;
        }

        return(dataSource);
    }
示例#30
0
        // GET: /EntityDataSource/Delete/5
        public ActionResult Delete(int id)
        {
            if (!User.CanDelete("EntityDataSource"))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EntityDataSource entitydatasource = db.EntityDataSources.Find(id);

            if (entitydatasource == null)
            {
                throw(new Exception("Deleted"));
            }
            if (ViewData["EntityDataSourceParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/EntityDataSource"))
            {
                ViewData["EntityDataSourceParentUrl"] = Request.UrlReferrer;
            }
            return(View(entitydatasource));
        }
示例#31
0
        internal static HealthcareEntityInternal DeserializeHealthcareEntityInternal(JsonElement element)
        {
            Optional <HealthcareEntityAssertion> assertion = default;
            Optional <string> name = default;
            Optional <IReadOnlyList <EntityDataSource> > links = default;
            string            text        = default;
            string            category    = default;
            Optional <string> subcategory = default;
            int    offset          = default;
            int    length          = default;
            double confidenceScore = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("assertion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    assertion = HealthcareEntityAssertion.DeserializeHealthcareEntityAssertion(property.Value);
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("links"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <EntityDataSource> array = new List <EntityDataSource>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EntityDataSource.DeserializeEntityDataSource(item));
                    }
                    links = array;
                    continue;
                }
                if (property.NameEquals("text"))
                {
                    text = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("category"))
                {
                    category = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("subcategory"))
                {
                    subcategory = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("offset"))
                {
                    offset = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("length"))
                {
                    length = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("confidenceScore"))
                {
                    confidenceScore = property.Value.GetDouble();
                    continue;
                }
            }
            return(new HealthcareEntityInternal(text, category, subcategory.Value, offset, length, confidenceScore, assertion.Value, name.Value, Optional.ToList(links)));
        }
 internal EntitySetTypeDescriptor(EntityDataSource dataSource)
 {
     _dataSource = dataSource;
 }
			/// <summary>
			/// Initializes a new instance of the EntityDataSourceView class.
			/// </summary>
			/// <param name="owner">A reference to the EntityDataSource which created this instance.</param>
			/// <param name="viewName">The name of the view, which defaults to EntityView.</param>
			public EntityDataSourceView(EntityDataSource owner, String viewName)
				: base(owner, viewName)
			{
				_owner = owner;
			}