C# (CSharp) Класс System. Object Code Examples

C# (CSharp) System.Object - 30 примеров найдено. Это лучшие примеры C# (CSharp) кода для класса System.Object, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Пример #1
0
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Edit")
         {
             Response.Redirect("edit.aspx?ID=" + gID.ToString());
         }
         else if (e.CommandName == "Cancel")
         {
             Response.Redirect("default.aspx");
         }
         else if (e.CommandName == "Delete")
         {
            
                 SqlProcs.spTQLogisticsInvoice_Delete(gID);
                 Response.Redirect("default.aspx");
             
            
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         ctlDynamicButtons.ErrorText = ex.Message;
     }
 }
    // 
    // Un-marshal an object instance from the data input stream
    // 
    public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs) 
    {
        base.TightUnmarshal(wireFormat, o, dataIn, bs);

        ConsumerInfo info = (ConsumerInfo)o;
        info.ConsumerId = (ConsumerId) TightUnmarshalCachedObject(wireFormat, dataIn, bs);
        info.Browser = bs.ReadBoolean();
        info.Destination = (ActiveMQDestination) TightUnmarshalCachedObject(wireFormat, dataIn, bs);
        info.PrefetchSize = dataIn.ReadInt32();
        info.MaximumPendingMessageLimit = dataIn.ReadInt32();
        info.DispatchAsync = bs.ReadBoolean();
        info.Selector = TightUnmarshalString(dataIn, bs);
        info.SubscriptionName = TightUnmarshalString(dataIn, bs);
        info.NoLocal = bs.ReadBoolean();
        info.Exclusive = bs.ReadBoolean();
        info.Retroactive = bs.ReadBoolean();
        info.Priority = dataIn.ReadByte();

        if (bs.ReadBoolean()) {
            short size = dataIn.ReadInt16();
            BrokerId[] value = new BrokerId[size];
            for( int i=0; i < size; i++ ) {
                value[i] = (BrokerId) TightUnmarshalNestedObject(wireFormat,dataIn, bs);
            }
            info.BrokerPath = value;
        }
        else {
            info.BrokerPath = null;
        }
        info.AdditionalPredicate = (BooleanExpression) TightUnmarshalNestedObject(wireFormat, dataIn, bs);
        info.NetworkSubscription = bs.ReadBoolean();
        info.OptimizedAcknowledge = bs.ReadBoolean();
        info.NoRangeAcks = bs.ReadBoolean();

    }
Пример #3
0
 private void addClick(Object sender, EventArgs e)
 {
     //EditText edit = FindViewById<EditText>(Resource.Id.editText1);
     //DBRepository dbr = new DBRepository();
     ////string result = dbr.insertRecord(edit.Text);
     //Toast.MakeText(this, result, ToastLength.Short).Show();
 }
Пример #4
0
 private static void ArgumentCheck(Side side, int m, int n, int k, int ilo, int ihi, Object A, int lda, Object tau, Object C, int ldc) {
   if ( A == null ) {
     throw new ArgumentNullException("A","A cannot be null.");
   }
   if ( tau == null ) {
     throw new ArgumentNullException("tau","tau cannot be null.");
   }
   if ( C == null ) {
     throw new ArgumentNullException("C","C cannot be null.");
   }
   if ( m<0 ) {
     throw new ArgumentException("m must be at least zero.", "m");
   }
   if ( n<0 ) {
     throw new ArgumentException("n must be at least zero.", "n");
   }
   if( side == Side.Left ){
     if( k < 0 || k > m ){
       throw new ArgumentException("k must be positive and less than or equal to m.", "k");
     }
     if (m>0) {
       if (ilo<1 || ilo>m || ilo>ihi)
         throw new ArgumentException("ilo must be a positive number and less than or equal to min(ihi,m) if m>0", "ilo");
       if (ihi<1 || ihi>m)
         throw new ArgumentException("ihi must be between 1 and m if m>0", "ihi");
     } else {
       if (ilo!=1)
         throw new ArgumentException("ilo must be 1 if m=0", "ilo");
       if (ihi!=0)
         throw new ArgumentException("ihi must be 0 if m=0", "ihi");
     }
   }else{
     if( k < 0 || k > n ){
       throw new ArgumentException("k must be positive and less than or equal to n.", "k");
     }
     if (n>0) {
       if (ilo<1 || ilo>n || ilo>ihi)
         throw new ArgumentException("ilo must be a positive number and less than or equal to min(ihi,n) if n>0", "ilo");
       if (ihi<1 || ihi>n)
         throw new ArgumentException("ihi must be a positive number and less than or equal to n if n>0", "ihi");
     } else {
       if (ilo!=1)
         throw new ArgumentException("ilo must be 1 if n=0", "ilo");
       if (ihi!=0)
         throw new ArgumentException("ihi must be 0 if n=0", "ihi");
     }
   }
   if( side == Side.Left ){
     if ( lda < System.Math.Max(1,m) ) {
       throw new ArgumentException("lda must be at least max(1,m)", "lda");
     }
   }else{
     if ( lda < System.Math.Max(1,n) ) {
       throw new ArgumentException("lda must be at least max(1,n)", "lda");
     }
   }
   if ( ldc < System.Math.Max(1,m) ) {
     throw new ArgumentException("ldc must be at least max(1,m)", "ldc");
   }
 }
Пример #5
0
        ///<summary>
        /// This method is called to Add a Setter object as a child of the Style.
        ///</summary>
        ///<param name="value">
        /// The object to add as a child; it must be a Setter or subclass.
        ///</param>
        void IAddChild.AddChild (Object value)
        {
            // Verify Context Access
            VerifyAccess();

            Setters.Add(Trigger.CheckChildIsSetter(value));
        }
Пример #6
0
 /* Events' handlers */
 private void ActionEasterEgg(Object sender, EventArgs e)
 {
     if (--easterEgg < 0)
     {
         lAppName.Text = "O_O";
     }
 }
		public object Create (object parent, object configContext, XmlNode section)
		{
#if (XML_DEP)
			XmlNode file = null;
			if (section.Attributes != null)
				file = section.Attributes.RemoveNamedItem ("file");

			NameValueCollection pairs = ConfigHelper.GetNameValueCollection (
									parent as NameValueCollection,
									section,
									"key",
									"value");

			if (file != null && file.Value != String.Empty) {
				string fileName = ((IConfigXmlNode) section).Filename;
				fileName = Path.GetFullPath (fileName);
				string fullPath = Path.Combine (Path.GetDirectoryName (fileName), file.Value);
				if (!File.Exists (fullPath))
					return pairs;

				ConfigXmlDocument doc = new ConfigXmlDocument ();
				doc.Load (fullPath);
				if (doc.DocumentElement.Name != section.Name)
					throw new ConfigurationException ("Invalid root element", doc.DocumentElement);

				pairs = ConfigHelper.GetNameValueCollection (pairs, doc.DocumentElement,
									     "key", "value");
			}

			return pairs;
#else
			return null;
#endif			
		}
Пример #8
0
	private void OnProcessFileDialog(Object sender, FileDialogEventArgs e)
	{
		switch (e.Mode)
		{
			case FileDialogMode.Save:
				using (var saveDialog = new SaveFileDialog())
				{
					saveDialog.Title = e.Title;
					saveDialog.Filter = e.Filter;
					saveDialog.FileName = e.DefaultFileName;
					if (saveDialog.ShowDialog() != DialogResult.Cancel)
					{
						FormProgress.ShowProgress();
						FormProgress.SetTitle("Downloading…", true);
						FormProgress.SetDetails(Path.GetFileName(saveDialog.FileName));
						TabControl.Enabled = false;
						Application.DoEvents();
						e.Continue(saveDialog.FileName);
					}
					else
						e.Cancel();
				}
				break;
		}
		e.Handled = true;
	}
Пример #9
0
 public static void TestDatabaseConnection(Object sender, TestDatabaseConnectionEventArgs e)
 {
     using (var connection = new FbConnection(GetConnectionString(e.DatabaseSettings)))
     {
         connection.Open();
     }
 }
Пример #10
0
 private void field_DataBinding(Object sender, EventArgs e)
 {
     Control c = (Control)sender;
     GridViewRow row = (GridViewRow)c.NamingContainer;
     if (sender.GetType() == typeof(Label))
     {
         (c as Label).Text = DataBinder.Eval(row.DataItem, columnNameData).ToString();
         (c as Label).Font.Size = 7;
         (c as Label).Font.Name = "Arial";
     }
     else if (sender.GetType() == typeof(TextBox))
     {
         (c as TextBox).Text = DataBinder.Eval(row.DataItem, columnNameData).ToString();
         (c as TextBox).Font.Size = 7;
         (c as TextBox).Font.Name = "Arial";
     }
     else if (sender.GetType() == typeof(DropDownList))
     {
         (c as DropDownList).SelectedValue = DataBinder.Eval(row.DataItem, columnNameData).ToString();
         (c as DropDownList).Font.Size = 7;
         (c as DropDownList).Font.Name = "Arial";
     }
     else if (sender.GetType() == typeof(CheckBox))
     {
         (c as CheckBox).Checked = (bool)DataBinder.Eval(row.DataItem, columnNameData);
     }
 }
Пример #11
0
 protected void Application_BeginRequest(Object sender, EventArgs e) {
     string filePath = HttpContext.Current.Request.PhysicalPath;
     if (!string.IsNullOrEmpty(filePath)
         && (filePath.IndexOf("Images") >= 0) && !System.IO.File.Exists(filePath)) {
         HttpContext.Current.Response.End();
     }
 }
 protected void SaveShareButton_Command(Object sender, CommandEventArgs e)
 {
     SaveButton_Command(sender, e);
     var patron = (Patron)Session["Patron"];
     Response.Redirect(string.Format("~/Avatar/View.aspx?AvatarId={0}",
         patron.AvatarState));
 }
 GetDialogTitle
 (
     Object oObjectBeingSaved
 )
 {
     return (DialogTitle);
 }
Пример #14
0
        /// <summary>The AddModuleToPane_Click server event handler on this page is used
        /// to add a new portal module into the tab
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AddModuleToPane_Click(Object sender, EventArgs e)
        {
            // All new modules go to the end of the contentpane
            ModuleItem m = new ModuleItem();
            m.ModuleTitle = moduleTitle.Text;
            m.ModuleDefId = Int32.Parse(moduleType.SelectedItem.Value);
            m.ModuleOrder = 999;

            // save to database
            Configuration config = new Configuration();
            m.ModuleId =
                config.AddModule(tabId, m.ModuleOrder, "ContentPane", m.ModuleTitle, m.ModuleDefId, 0, "Admins", false);

            // Obtain portalId from Current Context
            PortalSettings portalSettings = (PortalSettings) Context.Items["PortalSettings"];

            // reload the portalSettings from the database
            HttpContext.Current.Items["PortalSettings"] = new PortalSettings(portalSettings.PortalId, tabId);

            // reorder the modules in the content pane
            ArrayList modules = GetModules("ContentPane");
            OrderModules(modules);

            // resave the order
            foreach (ModuleItem item in modules)
            {
                config.UpdateModuleOrder(item.ModuleId, item.ModuleOrder, "ContentPane");
            }

            // Redirect to the same page to pick up changes
            Response.Redirect(Request.RawUrl);
        }
Пример #15
0
 public static string ObjetoSerializado(Object Objeto)
 {
     System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(Objeto.GetType());
     System.IO.StringWriter textWriter = new System.IO.StringWriter();
     x.Serialize(textWriter, Objeto);
     return textWriter.ToString();
 }
Пример #16
0
 private static void CurrentDomain_UnhandledException(Object sender, UnhandledExceptionEventArgs e)
 {
     if (e != null && e.ExceptionObject != null)
     {
         log.Error("Error: " + e.ExceptionObject);
     }
 }
 public NodeEventEditor(CharEvents _chev, Object[] obj)
 {
     InitializeComponent();
     chev = _chev;
     comboBox1.Items.AddRange(obj);
     comboBox2.Items.AddRange(obj);
 }
Пример #18
0
        void DrawGraphics(Object sender, PaintEventArgs PaintNow)
        {
            Rectangle Dot = new Rectangle(SpriteX, SpriteY, SpriteWidth, SpriteHeight); // Create rectangle (start position, and size X & Y)
            SolidBrush WhiteBrush = new SolidBrush(Color.White); // Create Brush(Color) to paint rectangle

            PaintNow.Graphics.FillRectangle(WhiteBrush, Dot);
        }
    // 
    // Write a object instance to data output stream
    //
    public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs) {
        base.TightMarshal2(wireFormat, o, dataOut, bs);

        RemoveInfo info = (RemoveInfo)o;
        TightMarshalCachedObject2(wireFormat, (DataStructure)info.ObjectId, dataOut, bs);

    }
 protected void Application_AuthenticateRequest(Object sender, EventArgs e)
 {
     if (string.Compare(this.Request.Params["profile"], "true", true) != 0)
     {
         MiniProfiler.Stop(discardResults: true);
     }
 }
Пример #21
0
 public override bool Equals(Object obj)
 {
     TestDiagnosisInfo p = obj as TestDiagnosisInfo;
     if ((object)p == null)
     {
         return false;
     }
     if (this.info == p.info)
         return true;
     if ((this.info == null) || (p.info == null))
     {
         return false;
     }
     if ((this.info.Comment == p.info.Comment)&&
     (this.info.DiagnosedDate == p.info.DiagnosedDate)&&
     (this.info.DiagnosisChangeReason == p.info.DiagnosisChangeReason)&&
     (this.info.DiagnosisStage == p.info.DiagnosisStage)&&
     (this.info.IdDiagnosisType == p.info.IdDiagnosisType)&&
     (this.info.IdDiseaseType == p.info.IdDiseaseType)&&
     (this.info.IdDispensaryState == p.info.IdDispensaryState)&&
     (this.info.IdTraumaType == p.info.IdTraumaType)&&
     (this.info.MedicalStandard == p.info.MedicalStandard)&&
     (this.info.MESImplementationFeature == p.info.MESImplementationFeature)&&
     (this.info.MkbCode == p.info.MkbCode))
     {
         return true;
     }
     else
     {
         this.FindMismatch(p);
         Global.errors3.Add("несовпадение TestDiagnosisInfo");
         return false;
     }
 }
Пример #22
0
 public SoapFault(String faultCode, String faultString, String faultActor, ServerFault serverFault)
 {
     this.faultCode = faultCode;
     this.faultString = faultString;
     this.faultActor = faultActor;
     this.detail = serverFault;
 }
Пример #23
0
	public override bool Equals(Object obj)
	{
		TimeRange rhs = obj as TimeRange;
		return rhs != null
			&& this.minHour == rhs.minHour
			&& this.maxHour == rhs.maxHour;
	}
Пример #24
0
        internal SoapFault(SerializationInfo info, StreamingContext context)
        {
            SerializationInfoEnumerator siEnum = info.GetEnumerator();        

            while(siEnum.MoveNext())
            {
                String name = siEnum.Name;
                Object value = siEnum.Value;
                SerTrace.Log(this, "SetObjectData enum ",name," value ",value);
                if (String.Compare(name, "faultCode", true, CultureInfo.InvariantCulture) == 0)
                {
                    int index = ((String)value).IndexOf(':');
                    if (index > -1)
                        faultCode = ((String)value).Substring(++index);
                    else
                        faultCode = (String)value;
                }
                else if (String.Compare(name, "faultString", true, CultureInfo.InvariantCulture) == 0)
                    faultString = (String)value;
                else if (String.Compare(name, "faultActor", true, CultureInfo.InvariantCulture) == 0)
                    faultActor = (String)value;
                else if (String.Compare(name, "detail", true, CultureInfo.InvariantCulture) == 0)
                    detail = value;
            }
        }
        /// <summary>
        /// Füllt die Seite mit Inhalt auf, der bei der Navigation übergeben wird. Gespeicherte Zustände werden ebenfalls
        /// bereitgestellt, wenn eine Seite aus einer vorherigen Sitzung neu erstellt wird.
        /// </summary>
        /// <param name="navigationParameter">Der Parameterwert, der an
        /// <see cref="Frame.Navigate(Type, Object)"/> übergeben wurde, als diese Seite ursprünglich angefordert wurde.
        /// </param>
        /// <param name="pageState">Ein Wörterbuch des Zustands, der von dieser Seite während einer früheren Sitzung
        /// beibehalten wurde. Beim ersten Aufrufen einer Seite ist dieser Wert NULL.</param>
        protected override async void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            // Zulassen, dass das anfänglich anzuzeigende Element vom gespeicherten Seitenzustand überschrieben wird
            if (pageState != null && pageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = pageState["SelectedItem"];
            }

            ChampionsViewModel championsViewModel = (ChampionsViewModel)App.Current.Resources["championsViewModel"];
            if (championsViewModel != null)
            {
                if (!championsViewModel.Loaded) await championsViewModel.LoadDataAsync();
                this.DefaultViewModel["Items"] = championsViewModel.Champions.OrderBy(c => c.displayName).ToList();
                Champion champion = championsViewModel.Champions.First<Champion>(c => c.id == (int)navigationParameter);
                this.flipView.SelectedItem = champion;

                List<ChampionItemDetailPageView> views = new List<ChampionItemDetailPageView>();
                ChampionItemDetailPageView lore = new ChampionItemDetailPageView("Lore");
                ChampionItemDetailPageView overview = new ChampionItemDetailPageView("Overview");
                ChampionItemDetailPageView tips = new ChampionItemDetailPageView("Tips");

                views.Add(overview);
                views.Add(lore);
                views.Add(tips);

                this.DefaultViewModel["Views"] = views;
            }
        }
Пример #26
0
        /// <summary>
        /// Executes the specified workflow action.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="action">The action.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="errorMessages">The error messages.</param>
        /// <returns></returns>
        public override bool Execute( RockContext rockContext, WorkflowAction action, Object entity, out List<string> errorMessages )
        {
            errorMessages = new List<string>();

            Guid? personAliasGuid = GetAttributeValue( action, "Person" ).AsGuidOrNull();
            if ( personAliasGuid.HasValue )
            {
                var personAlias = new PersonAliasService( rockContext ).Queryable( "Person" )
                    .Where( a => a.Guid.Equals( personAliasGuid.Value ) )
                    .FirstOrDefault();

                if (personAlias != null)
                {
                    action.Activity.AssignedPersonAlias = personAlias;
                    action.Activity.AssignedPersonAliasId = personAlias.Id;
                    action.Activity.AssignedGroup = null;
                    action.Activity.AssignedGroupId = null;
                    action.AddLogEntry( string.Format( "Assigned activity to '{0}' ({1})",  personAlias.Person.FullName, personAlias.Person.Id ) );
                    return true;
                }

            }

            return false;
        }
Пример #27
0
 /// <summary>
 /// 将一个对象序列化为字节数组
 /// </summary>
 /// <param name="data">要序列化的对象</param>
 /// <returns>序列化好的字节数组</returns>
 public static byte[] ToBytes(Object data)
 {
     MemoryStream ms = new MemoryStream();
     BinaryFormatter bf = new BinaryFormatter();
     bf.Serialize(ms, data);
     return ms.ToArray();
 }
Пример #28
0
		/// <summary>
		/// Checks the type of the object, returning true if
		/// the object is a fixed point numeric type.
		/// </summary>
		/// <param name="obj">The object to check</param>
		/// <returns>true if the object is a fixed point numeric type</returns>
		public static bool IsFixedPointNumeric(Object obj)
		{
			if (null != obj)
			{
				if (obj is byte) return true;
				if (obj is sbyte) return true;
				if (obj is decimal) return true;
				if (obj is int) return true;
				if (obj is uint) return true;
				if (obj is long) return true;
				if (obj is short) return true;
				if (obj is ushort) return true;

				if (obj is System.Byte) return true;
				if (obj is System.SByte) return true;
				if (obj is System.Decimal) return true;
				if (obj is System.Int32) return true;
				if (obj is System.UInt32) return true;
				if (obj is System.Int64) return true;
				if (obj is System.UInt64) return true;
				if (obj is System.Int16) return true;
				if (obj is System.UInt16) return true;
			}
			return false;
		}
        protected void submitFacility(Object sender, EventArgs e)
        {
            //If null then this is creating a facility to add
            if (selected_facility == null)
            {
                selected_facility = new facility();
                selected_address = new address();
                selected_address.line_1 = Address1.Text;
                selected_address.line_2 = Address2.Text;
                selected_address.city = CityName.Text;
                selected_address.state = StateName.Text;
                selected_address.zip = ZipName.Text;
                db.addresses.InsertOnSubmit(selected_address);
                db.SubmitChanges();
                selected_facility.user_id = user_id;
                selected_facility.name = FacilityName.Text;
                selected_facility.address_id = selected_address.id;
                selected_facility.add_date = DateTime.Now;
                db.facilities.InsertOnSubmit(selected_facility);
                db.SubmitChanges();

            }
            //If not then we are editing an existing facility
            else
            {
                selected_facility.name = FacilityName.Text;
                selected_address.line_1 = Address1.Text;
                selected_address.line_2 = Address2.Text;
                selected_address.city = CityName.Text;
                selected_address.state = StateName.Text;
                selected_address.zip = ZipName.Text;
                db.SubmitChanges();
            }
            Response.Redirect("~/Pages/Inventory/Facilities.aspx");
        }
        //
        // Write the booleans that this object uses to a BooleanStream
        //
        public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
        {

            int rc = base.TightMarshal1(wireFormat, o, bs);

            return rc + 0;
        }