Пример #1
0
 public void bindRepeaterByLoginID(int LoginID)
 {
     try
     {
         List <FeatureConfigurationModel> list = obj.getFeatureListByLogin(LoginID, -1);
         if (list.Count > 0)
         {
             BindingClass.RepeaterViewBind(rptReports, list);
         }
         else
         {
             BindingClass.ClearRepeaterView(rptReports);
             BindingClass.CallScriptManager(this.Page, this.GetType(), "toastr.error('No Report assigned to " + Session["DisplayName"] + "!', 'N/A',{positionClass:'toast-bottom-right'});");
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ClearControls();
         try
         {
             if (Session["admin"] != null)
             {
                 ddlClientbind();
                 ddlgroup.Visible = false;
             }
             else if (Session["poweruser"] != null)
             {
                 string   ID           = Session["poweruser"].ToString();
                 string[] powerSession = ID.Split(',');
                 int      clientID     = Convert.ToInt32(powerSession[1]);
                 ddlGroupbind(clientID);
                 sessionId.Text       = clientID.ToString() + "ClientID";
                 ddlclientdiv.Visible = false;
                 allowStaticMethods("setInterval(function () {$(GetAlertsByClient('" + clientID + "'));}, 10000); $('#imgnotify').show();");
             }
             else if (Session["user"] != null)
             {
                 ddlclientdiv.Visible = false;
                 ddlgroupdiv.Visible  = false;
                 int loginID = Convert.ToInt32(Session["user"]);
                 int groupID = globalobj.getGroupIDForUser(loginID);
                 if (groupID != 0)
                 {
                     BindObjectRepeater(groupID);
                     sessionId.Text = groupID.ToString() + "GroupID";
                     allowStaticMethods("setInterval(function () {$(GetAlertsByGroup('" + groupID + "'))}, 10000); $('#imgnotify').show();");
                 }
             }
             else
             {
                 Response.Redirect("Login.aspx");
             }
         }
         catch (Exception)
         { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
     }
 }
Пример #3
0
 public void bindRepeater()
 {
     try
     {
         List <ConfigurationModel> list = obj.getConfigurationList(-1);
         if (list.Count > 0)
         {
             rptReports.DataSource = list;
             rptReports.DataBind();
         }
         else
         {
             BindingClass.ClearRepeaterView(rptReports);
             BindingClass.CallScriptManager(this.Page, this.GetType(), "toastr.error('No Report assigned to " + Session["DisplayName"] + "!', 'N/A',{positionClass:'toast-bottom-right'});");
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #4
0
 protected void ddlObject_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (ddlObject.SelectedValue != "0")
         {
             gridBind(Convert.ToInt32(ddlObject.SelectedValue));
             ddlObjsensorbind(Convert.ToInt32(ddlObject.SelectedValue));
             gvdEventConfig.Visible = true;
             allowStaticMethods("applyDatatable('.gvdEventConfigClass');staticMethod('Disable');");
         }
         else
         {
             BindingClass.ClearDropDown(ddlObjSensor, "Select Location");
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             if (Session["admin"] != null)
             {
                 clearControls();
             }
             else
             {
                 Response.Redirect("Login.aspx");
             }
         }
         catch (Exception)
         { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             if (Session["admin"] != null)
             {
                 ddlclient(); BindingClass.ClearDropDown(ddlGroup, "Select Branch"); BindingClass.ClearDropDown(ddlObject, "Select Device");
             }
             else
             {
                 Response.Redirect("Login.aspx");
             }
         }
         catch (Exception)
         { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
     }
 }
        public void StrongBindingDoesNotRetainNotifier()
        {
            WeakReference Test(out IEventBinding binder)
            {
                var binding   = new BindingClass();
                var notifying = new NotifyingClass();

                // Retain the IPropertyChangedBinding, in case that causes NotifyingClass to be retained
                binder = binding.BindStrong(notifying);
                return(new WeakReference(notifying));
            }

            var weakNotifying = Test(out var retained);

            GC.Collect();

            Assert.IsFalse(weakNotifying.IsAlive);
            GC.KeepAlive(retained);
        }
Пример #8
0
 public void gridBind(string type)
 {
     try
     {
         List <ConfigurationModel> list = new List <ConfigurationModel>();
         if (type == "Reports")
         {
             list = obj.getFeatureList(-1);
         }
         if (type == "Configuration")
         {
             list = obj.getFeatureList(0);
         }
         BindingClass.GridViewBind(gvdFeatures, list);
         gvdFeatures.Visible = true;
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #9
0
 protected void ddlObject_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (ddlObject.SelectedValue != "0")
         {
             ddlNAsensorBind();
             gridBind();
             allowStaticMethods("applyDatatable('.gvdObjectSensorClass');staticMethod('Disable');");
         }
         else
         {
             gvdObjectSensor.Visible = false;
             BindingClass.ClearDropDown(ddlSensor, "Select Sensor");
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #10
0
        protected void ddlClient_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (ddlClient.SelectedValue != "0")
                {
                    gvdObjectMnt.Visible = false;
                    ddlObjectBind();
                }
                else
                {
                    BindingClass.ClearDropDown(ddlObject, "Select Device");
                }
                allowStaticMethods("staticMethod();");
            }

            catch (Exception)
            { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
        }
Пример #11
0
 protected void linkbtnEdit_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "UpdateID")
         {
             BindingClass.CallScriptManager(this, this.GetType(), "applyDatatable('.gvdObjectGroupClass'); staticMethod('Enable');");
             int ID = Convert.ToInt32(e.CommandArgument);
             ObjectGroupModel li = obj.getObjectGroupByID(ID);
             ddlObject.SelectedValue  = li.ObjectID.ToString();
             ddlGroup.SelectedValue   = li.GroupID.ToString();
             Session["objectGroupId"] = ID.ToString();
             btnAddObjectGroup.Text   = "Update";
             gridBind();
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #12
0
 protected void ddlgroup_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (ddlgroup.SelectedValue != "0")
         {
             int val = Convert.ToInt32(ddlgroup.SelectedValue);
             ddlObjectbind(val);
         }
         else
         {
             BindingClass.ClearDropDown(ddlobject, "Select");
         }
         hideControls();
         allowStaticMethods("staticMethod();");
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #13
0
 public void ddlClientBind()
 {
     try
     {
         List <ClientIDName> list = comObj.getClientList();
         if (list.Count > 0)
         {
             BindingClass.BindDropDown(ddlClient, list, "Name", "ClientID", "Select Client");
             BindingClass.ClearDropDown(ddlObject, "Select Device");
             BindingClass.ClearDropDown(ddlSensor, "Select Sensor");
         }
         else
         {
             BindingClass.ClearDropDown(ddlClient, "Select Client");
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #14
0
 protected void rptObject_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     try
     {
         if (e.CommandName.Equals("lnkbtnviewObjdt"))
         {
             //Session["ObjIDTimer"] = null;
             string val = Convert.ToString(e.CommandArgument);
             int    id  = Convert.ToInt32(val);
             //Session["ObjIDTimer"] = id;
             if (val != null)
             {
                 ObjectGridBind(id);
                 allowStaticMethods("$('#myModal').modal();togl();chngeDin();ddlselect2('.ddlSelect');");
             }
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #15
0
 public void GvdBindObjdetail(int objectId, bool relayStatus)
 {
     try
     {
         List <ObjectRelayStatus> lirelays = obj.getObjectRelays(objectId, relayStatus);
         List <ObjectAnalog>      liAin    = obj.getObjectAin(objectId);
         List <ObjectDigital>     liDin    = obj.getObjectDin(objectId);
         List <ObjectTemperature> liTemp   = obj.getObjectTemp(objectId);
         Gvdobjsensor.DataSource     = lirelays; Gvdobjsensor.DataBind();
         rptappliances.DataSource    = lirelays; rptappliances.DataBind();
         rptDIN.DataSource           = liDin; rptDIN.DataBind();
         rptdigitalsensor.DataSource = liDin; rptdigitalsensor.DataBind();
         rptAnalog.DataSource        = liAin; rptAnalog.DataBind();
         rptAnalogsensor.DataSource  = liAin; rptAnalogsensor.DataBind();
         rptTemp.DataSource          = liTemp; rptTemp.DataBind();
         rpttempsensor.DataSource    = liTemp; rpttempsensor.DataBind();
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #16
0
 protected void linkbtnEdit_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "UpdateID")
         {
             allowStaticMethods("applyDatatable('.gvdGroupClass');  staticMethod('Enable');");
             int           cmdArg = Convert.ToInt32(e.CommandArgument);
             GetGroupModel li     = obj.getGroupByGroupID(cmdArg);
             txtComments.Text        = li.Comment;
             txtGroupName.Text       = li.Name;
             ddlClient.SelectedValue = li.ClientID.ToString();
             gridBind();
             Session["GroupId"] = cmdArg.ToString();
             btnGroup.Text      = "Update";
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #17
0
 public void ddlListItemDaysForUser()
 {
     try{
         ListItem[] items = new ListItem[9];
         items[0] = new ListItem("Select Days", "0");
         items[1] = new ListItem("Monday", "1");
         items[2] = new ListItem("Tuesday", "2");
         items[3] = new ListItem("Wednesday", "3");
         items[4] = new ListItem("Thursday", "4");
         items[5] = new ListItem("Friday", "5");
         items[6] = new ListItem("Saturday", "6");
         items[7] = new ListItem("Sunday", "7");
         items[8] = new ListItem("Weekly", "8");
         //items[9] = new ListItem("Holidays", "9");
         ddlDays.Items.AddRange(items);
         ddlDays.DataBind();
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #18
0
 protected void linkbtnEdit_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "UpdateID")
         {
             allowStaticMethods("staticMethod('Enable');applyDatatable('.gvdcategoryclass');");
             int           cmdArg = Convert.ToInt32(e.CommandArgument);
             CategoryModel li     = obj.getCategoryByCategoryID(cmdArg);
             txtName.Text          = li.Name;
             txtMin.Text           = li.Name;
             txtMax.Text           = li.Name;
             chkEnable.Checked     = Convert.ToBoolean(li.EnableORDisable);
             Session["CategoryId"] = cmdArg.ToString();
             btnAddCategory.Text   = "Update";
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #19
0
 public void gvdBind_Controlling(int ObjectId, DateTime StartDate, DateTime EndDate)
 {
     try
     {
         if (StartDate.Date == DateTime.Now.Date)
         {
             List <SwitchesReportControllingModel> Li = obj.getControllingToday(ObjectId);
             BindingClass.GridViewBind(gvdcontrollingReport, Li);
             gvdcontrollingReport.Visible = true;
         }
         else
         {
             List <SwitchesReportControllingModel> Li = obj.getControllingByDT(ObjectId, StartDate, EndDate);
             BindingClass.GridViewBind(gvdcontrollingReport, Li);
             gvdcontrollingReport.Visible = true;
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #20
0
 public void ddlClientBind()
 {
     try
     {
         List <ClientIDName> list = cobj.getClientList();
         if (list.Count > 0)
         {
             BindingClass.BindDropDown(ddlClient, list, "Name", "ClientID", "Select Client");
             BindingClass.ClearDropDown(ddlLogin, "Select User");
             BindingClass.ClearDropDown(ddlFeature, "Select Feature");
             gvdLoginFeature.Visible = false;
         }
         else
         {
             BindingClass.ClearDropDown(ddlClient, "Select Client");
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #21
0
 protected void ddlgroup_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (ddlgroup.SelectedValue != "0")
         {
             Timer1.Enabled    = true;
             rptObject.Visible = true;
             var _sltdval = ddlgroup.SelectedValue;
             int val      = Convert.ToInt32(_sltdval);
             BindObjectRepeater(val);
         }
         else
         {
             BindingClass.ClearRepeaterView(rptObject);
         }
         allowStaticMethods("ddlselect2('.ddlSelect');");
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Пример #22
0
        void Schedule_AppointmentEditorOpening(object sender, AppointmentEditorOpeningEventArgs e)
        {
            Appointment app;

            app      = (Appointment)(e.Appointment);
            eSauve   = e;
            e.Cancel = true;
            Schedule1.IsHitTestVisible = false;
            AddDataContext             = new BindingClass()
            {
                CurrentSelectedDate = e.StartTime, Appointment = e.Appointment
            };
            if (e.Appointment != null)
            {
                editAppointmentCourse();
            }
            else
            {
                addAppointmentCourse();
            }
        }
Пример #23
0
 public void ddlClientBind()
 {
     try
     {
         List <ClientIDName> list = cobj.getClientList();
         if (list.Count > 0)
         {
             BindingClass.BindDropDown(ddlClient, list, "Name", "ClientID", "Select Client");
             BindingClass.ClearDropDown(ddlGroup, "Select Branch");
             BindingClass.ClearDropDown(ddlObject, "Select Device");
             BindingClass.ClearDropDown(ddlObjSensor, "Select Location");
             gvdEventConfig.Visible = false;
         }
         else
         {
             BindingClass.ClearDropDown(ddlClient, "Select Client");
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
        void IVisitor.Visit(BindingClass @class)
        {
            Generate(new ClassInstanceModel
            {
                BaseName = @class.BaseName,
                OriginalName = @class.OriginalName,
                Name = @class.Name,
                OriginalNamespace = @class.OriginalNamespace,
                Namespace = _options.Namespace,
                GenericArguments = GenericRef(@class),
                Getters = @class.Getters.Select(CreateMethod).ToArray(),
                Setters = @class.Setters.Select(CreateMethod).ToArray(),
                Deleters = @class.Deleters.Select(CreateMethod).ToArray(),
                Fields = @class.GetAll<BindingField>().Select(m => CreateField(m.Key, m.Value)).ToArray()
            });

            Generate(new ClassPrototypeModel
            {
                OriginalName = @class.OriginalName,
                Name = @class.Name,
                OriginalNamespace = @class.OriginalNamespace,
                Namespace = _options.Namespace,
                Prototype = String.Concat("engine.Constructors.", @class.BaseName, ".PrototypeObject"),
                Events = @class.GetAll<BindingEvent>().Select(m => CreateEvent(m.Key, m.Value)).ToArray(),
                Properties = @class.GetAll<BindingProperty>().Select(m => CreateProperty(m.Key, m.Value)).ToArray(),
                Methods = @class.GetAll<BindingMethod>().Select(m => CreateMethod(m.Key, m.Value)).ToArray()
            });

            Generate(new ClassConstructorModel
            {
                Name = @class.Name,
                Namespace = _options.Namespace,
                OriginalNamespace = @class.OriginalNamespace,
                OriginalName = @class.OriginalName,
                Constructors = @class.Constructors.Select(CreateMethod).ToArray(),
                Constants = @class.GetAll<BindingField>().Select(m => CreateField(m.Key, m.Value)).ToArray()
            });

            _names.Include(@class.Name, @class.BaseName);
        }
Пример #25
0
        protected void linkUpdateAll_Command(object sender, CommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Update")
                {
                    int             _cmdArg = Convert.ToInt32(e.CommandArgument);
                    SchedulingModel li      = SS.GetSchedulingById(_cmdArg);
                    Session["scheduleId"] = _cmdArg.ToString();
                    int obs   = li.ObjectSensorId;
                    int _days = li.Days;

                    bool cbstatus = false;
                    var  lb       = (LinkButton)sender;
                    var  row      = (GridViewRow)lb.NamingContainer;
                    if (row != null)
                    {
                        TextBox  S_Time    = row.FindControl("txtstarttime") as TextBox;
                        string   StartTime = S_Time.Text;
                        TextBox  E_Time    = row.FindControl("txtendtime") as TextBox;
                        string   EndTime   = E_Time.Text;
                        CheckBox chk       = (CheckBox)row.FindControl("chkstatus");
                        if (chk.Checked == true)
                        {
                            cbstatus = true;
                        }

                        bool responce = SS.PutEquipmentScheduling(_cmdArg, Convert.ToInt32(ddlObject.SelectedValue), StartTime, EndTime, _days, obs, cbstatus);
                        if (responce == true)
                        {
                            GvdBindObjdetail(Convert.ToInt32(ddlObject.SelectedValue), Convert.ToInt32(ddlDays.SelectedValue));
                            _alert = AlertsClass.SuccessUpdate;
                        }
                    }
                    allowStaticMethods("ALerts('" + _alert + "');staticMethod();");
                }
            }
            catch (Exception)
            { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             if (Session["admin"] != null)
             {
                 ddlClientbind();
                 BindingClass.ClearDropDown(ddlgroup, "Select Branch");
                 BindingClass.ClearDropDown(ddlObject, "Select Device");
                 ddlScheduleBind();
                 ddlHoursBind();
                 ddlMinsBind();
                 ddlSecsBind();
             }
             //else if (Session["poweruser"] != null)
             //{
             //    var list = (LoginModelForUser)Session["poweruser"];
             //    int _clId = list.ClientID;
             //    ddlGroupbind(_clId);
             //    ddlgroup.Visible = true;
             //}
             //else if (Session["user"] != null)
             //{
             //    var list = (LoginModelForUser)Session["user"];
             //    int sessionLoginID = list.LoginID;
             //    LoginGroupModel li = LGS.GetLoginGroupByLogin(sessionLoginID);
             //    if (li != null)
             //    {
             //        ddlObjectbind(li.GroupID);
             //        ddlObject.Visible = true;
             //    }
             //}
         }
         catch (Exception)
         { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
     }
 }
Пример #27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             if (Session["admin"] != null)
             {
                 ddlclient(); BindingClass.ClearDropDown(ddlGroup, "Select Branch"); BindingClass.ClearDropDown(ddlObject, "Select Device");
             }
             else
             {
                 Response.Redirect("Login.aspx");
             }
         }
         catch (Exception)
         {
             Alert = AlertsClass.ErrorWentWrong;
         }
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "ALerts('" + Alert + "')", true);
     }
 }
Пример #28
0
 protected void linkbtnEdit_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "UpdateID")
         {
             allowStaticMethods("staticMethod('Enable');  applyDatatable('.gvdSensorclass');");
             clearControls();
             int         _cmdArg = Convert.ToInt32(e.CommandArgument);
             SensorModel li      = SNS.GetSensor(_cmdArg);
             Session["sensorId"] = _cmdArg.ToString();
             txtSourceName.Text  = li.SourceName;
             txtSourceId.Text    = li.SourceID;
             txtUnit.Text        = li.Unit;
             cbEnabled.Checked   = li.EnableOrDisable;
             txtSourceName.Text  = li.SourceName;
             btnAddSensor.Text   = "Update";
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
 protected void linkbtnDel_Command(object sender, CommandEventArgs e)
 {
     if (e.CommandName == "Remove")
     {
         try
         {
             int _cmdArg = Convert.ToInt32(e.CommandArgument); bool response = OBJ.PutAttendanceObjectStatus(_cmdArg);
             if (response == true)
             {
                 Alert = AlertsClass.SuccessRemove;
             }
             else
             {
                 Alert = AlertsClass.ErrorWentWrong;
             }
             Gridbind(Convert.ToInt32(ddlObject.SelectedValue));
             allowStaticMethods("ALerts('" + Alert + "'); staticMethod();");
         }
         catch (Exception)
         { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
     }
 }
Пример #30
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             if (Session["admin"] != null)
             {
                 ddlClientbind();
                 ddlDays.Items.Clear();
                 ddlgroup.Visible  = false;
                 ddlObject.Visible = false;
             }
             else if (Session["poweruser"] != null)
             {
                 divClient.Visible = false;
                 ddlObject.Visible = false;
                 var list  = (LoginModelForUser)Session["poweruser"];
                 int _clId = list.ClientID;
                 ddlGroupbind(_clId);
                 ddlgroup.Visible = true;
             }
             else if (Session["user"] != null)
             {
                 divClient.Visible = false;
                 divGroup.Visible  = false;
                 int             loginID = Convert.ToInt32(Session["user"]);
                 LoginGroupModel li      = LGS.GetLoginGroupByLogin(loginID);
                 if (li != null)
                 {
                     ddlObjectbind(li.GroupID);
                     ddlObject.Visible = true;
                 }
             }
         }
         catch (Exception)
         { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
     }
 }
        public static IEnumerable<BindingClass> GetBindings(this IDictionary<String, List<Type>> mappings)
        {
            foreach (var mapping in mappings)
            {
                var name = mapping.Key;
                var types = mapping.Value;
                var type = types.Where(m => !m.IsEnum).FirstOrDefault() ?? types.First();
                
                if (type.IsNotInterfaced())
                    continue;
                
                var binding = new BindingClass(name, type.Name.Replace("`1", ""), type.Namespace, type.ResolveBase());

                if (type.IsGenericType)
                {
                    var args = type.GetGenericArguments();
                    binding.GenericArguments.AddRange(args);
                }

                yield return binding.GetClassBindings(types, name);
            }
        }
Пример #32
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             clearControls();
             if (Session["admin"] != null)
             {
                 ddlClientbind();
             }
             if (Session["poweruser"] != null)
             {
                 string   ID           = Session["poweruser"].ToString();
                 string[] powerSession = ID.Split(',');
                 if (powerSession[1] != "")
                 {
                     ddlclientdiv.Visible = false;
                     int clientID = Convert.ToInt32(powerSession[1]);
                     ddlGroupbind(clientID);
                 }
             }
             if (Session["user"] != null)
             {
                 int loginID = Convert.ToInt32(Session["user"]);
                 if (loginID != 0)
                 {
                     ddlclientdiv.Visible = false;
                     ddlgroupdiv.Visible  = false;
                     int groupID = cObj.getGroupIDForUser(loginID);
                     ddlObjectbind(groupID);
                 }
             }
         }
         catch (Exception)
         { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
     }
 }
        public void WeakBindingDoesNotRetainBindingClass()
        {
            var binding = new BindingClass();

            // Means of determining whether the class has been disposed
            var weakBinding = new WeakReference<BindingClass>(binding);

            var notifying = new NotifyingClass();
            binding.BindWeak(notifying);

            

            binding = null;
            GC.Collect();
            Assert.IsFalse(weakBinding.TryGetTarget(out binding));
        }
        public void StrongBindingDoesNotRetainNotifier()
        {
            var binding = new BindingClass();
            var notifying = new NotifyingClass();
            // Means of determining whether the class has been disposed
            var weakNotifying = new WeakReference<NotifyingClass>(notifying);
            // Retain the IPropertyChangedBinding, in case that causes NotifyingClass to be retained
            var binder = binding.BindStrong(notifying);

            notifying = null;
            GC.Collect();
            Assert.IsFalse(weakNotifying.TryGetTarget(out notifying));
        }
 public void Visit(BindingClass @class)
 {
     foreach (var member in @class.GetMembers())
         member.Accept(this);
 }
        public void WeakBindingDoesNotRetainNotifier()
        {
            var binding = new BindingClass();
            var notifying = new NotifyingClass();
            // Means of determining whether the class has been disposed
            var weakNotifying = new WeakReference<NotifyingClass>(notifying);
            // Retain binder, as that shouldn't affect anything
            var binder = binding.BindWeak(notifying);

            notifying = null;
            GC.Collect();
            Assert.IsFalse(weakNotifying.TryGetTarget(out notifying));
        }
        static String GenericRef(BindingClass @class)
        {
            if (@class.GenericArguments.Count > 0)
            {
                var strs = @class.GenericArguments.
                                  Select(m => m.GetGenericParameterConstraints().FirstOrDefault() ?? typeof(Object)).
                                  Select(m => m.Name);
                var rep = String.Join(", ", strs);
                return String.Concat("<", rep, ">");
            }

            return String.Empty;
        }