示例#1
0
 private static void MakeDataBindColl(ControlCollection _coll, object _obj)
 {
     foreach (Control c in _coll)
     {
         if (c is MCDataBoundControl)
         {
             MCDataBoundControl dbcontrol = (MCDataBoundControl)c;
             dbcontrol.DataItem = _obj;
             dbcontrol.DataBind();
             continue;
         }
         else if (c.Controls.Count > 0)
         {
             MakeDataBindColl(c.Controls, _obj);
         }
     }
 }
示例#2
0
 private void MakeDataBind(Control _cntrl)
 {
     foreach (Control c in _cntrl.Controls)
     {
         MCDataBoundControl boundControl = c as MCDataBoundControl;
         if (boundControl != null)
         {
             boundControl.ShowSystemInfo = ShowSystemInfo;
             boundControl.DataItem       = mc;
             boundControl.DataBind();
             continue;
         }
         else if (c.Controls.Count > 0)
         {
             MakeDataBind(c);
         }
     }
 }
        private int BindAssignment()
        {
            int itemsCount = 0;

            if (AssignmentId != PrimaryKeyId.Empty)
            {
                FilterElementCollection filters = new FilterElementCollection();
                filters.Add(FilterElement.EqualElement(OwnerType, OwnerId));
                filters.Add(FilterElement.EqualElement(AssignmentEntity.FieldUserId, Bus.Security.CurrentUser.UserID));
                filters.Add(FilterElement.EqualElement(AssignmentEntity.FieldState, AssignmentState.Active));
                filters.Add(FilterElement.EqualElement("PrimaryKeyId", AssignmentId));

                EntityObject[] assignments = BusinessManager.List(AssignmentEntity.ClassName, filters.ToArray());
                if (assignments != null && assignments.Length > 0)
                {
                    AssignmentEntity assignment = (AssignmentEntity)assignments[0];

                    SavedPath = AssignmentEntity.GetControlPath(assignment);

                    MCDataBoundControl control = (MCDataBoundControl)LoadAssignment();
                    if (control != null)
                    {
                        control.DataItem = assignment;
                        control.DataBind();
                    }

                    itemsCount = 1;
                }
                else
                {
                    SavedPath = String.Empty;
                    MainPlaceHolder.Controls.Clear();
                    itemsCount = 0;
                }
            }

            return(itemsCount);
        }