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

C# (CSharp) System.Int32 - 30 примеров найдено. Это лучшие примеры C# (CSharp) кода для класса System.Int32, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
System int implementation, exposed as ECMA Number.
Пример #1
0
        public void DajPonudu(DataTable ponuda, Int32 ponuda_ID)
        {
            SqlConnection _konekcijaSqlConnection = new SqlConnection();
            using (_konekcijaSqlConnection = Konekcija.DajKonekciju())
            {
                SqlDataAdapter _dajPonuduSQLDataAdapter = new SqlDataAdapter();
                SqlCommand _dajPoslednjuPonuduSqlCommand = new SqlCommand("SELECT  * FROM  vwPonudaZaglavlje where Ponuda_ID = " + ponuda_ID, _konekcijaSqlConnection);

                _dajPonuduSQLDataAdapter.SelectCommand = _dajPoslednjuPonuduSqlCommand;

                //isprazni tabelu
                ponuda.Clear();

                try
                {
                    //napuni tabelu 
                    _dajPonuduSQLDataAdapter.Fill(ponuda);
                }
                catch (Exception)
                {
                    throw;
                }
            }

        }
        //  private SQLiteConnection dbConnection;
        public MainWindow()
        {
            InitializeComponent();
            rectFaceMarker.Visibility = Visibility.Hidden;
            //chkShowFaceMarker.IsChecked = true;
            numFacesDetected = 0;
            userId = string.Empty;
            dbState = string.Empty;
            doRegister = false;
            doUnregister = false;

            // Start SenseManage and configure the face module
            ConfigureRealSense();
            // Start the worker thread
            btnRegisterMode.IsEnabled = false;
            btnGetLog.Visibility = System.Windows.Visibility.Hidden;
            processingThread = new Thread(new ThreadStart(ProcessingThread));
            processingThread.Start();
            _serialPort = new SerialPort();
            _serialPort.PortName = "COM3";
            _serialPort.BaudRate = 9600;
            _serialPort.ReadTimeout = 500;
            _serialPort.WriteTimeout = 500;
            _serialPort.Open();
        }
Пример #3
0
        /// <summary>
        /// ���� ɾ��
        /// </summary>
        /// <param name="id">Id ���</param>
        /// <returns>ִ�н��</returns>
        public int CategoryDelete(out string resultMsg, Int32 id, DbTransaction tran = null)
        {
            resultMsg = string.Empty;
            int res = 0;
            try
            {
                //�洢��������
                string sql = "usp_category_delete_by_id";

                //�������
                IList<DBParameter> parm = new List<DBParameter>();
                parm.Add(new DBParameter() { ParameterName = "ID", ParameterValue = id, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Int32 });
                //parm.Add(new DBParameter() { ParameterName = "resultMsg", ParameterInOut = BaseDict.ParmOut, ParameterType = DbType.String });

                //����ִ��
                res = DBHelper.ExecuteNonQuery(sql, true, parm, tran);
                //foreach (var item in parm)
                //{
                //    //��ȡ�������ֵ
                //    if (item.ParameterName == "resultMsg")
                //    {
                //        resultMsg = item.ParameterValue.ToString();
                //        break;
                //    }
                //}
            }
            catch (Exception ex)
            {
                if (tran != null)
                    tran.Rollback();
                resultMsg = string.Format("{0} {1}", BaseDict.ErrorPrefix, ex.ToString());
            }
            return res;
        }
Пример #4
0
        public PlayerViewModelBase(Player player)
        {
            //_player = player;

            if (player != null)
            {
                _playerId = player.PlayerId;
                _firstName = player.FirstName;
                _lastName = player.LastName;
                _tvName = player.TvName;
                _hometown = player.Hometown;
                _state = player.State;
                _position = player.Position;
                _positionFull = player.PositionFull;
                _height = player.Height;
                _weight = player.Weight;
                _class = player.Class;
                _headshot = player.Headshot;
                _kiperRank = player.KiperRank;
                _mcShayRank = player.McShayRank;
                _school = player.School;
                _pick = player.Pick;
                _tradeTidbit = player.TradeTidbit;

                _tidbits = player.Tidbits;

                loadTidbits();
            }
        }
Пример #5
0
        public static INode AddNode(this IGraph myIGraph, Int32 myInt32Id)
        {
            if (myIGraph == null)
                throw new ArgumentNullException("myIGraph must not be null!");

            return myIGraph.AddNode(myInt32Id.ToString());
        }
Пример #6
0
        // Check touch position on button
        public bool OnTouch(View v, MotionEvent e)
        {
            switch (e.Action)
            {
                // Get the x and y position for a touch (always before move)
                case MotionEventActions.Down:
                    old_x = e.GetX ();
                    old_y = e.GetY ();
                    Console.WriteLine ("x = " + old_x + " y = " + old_y);
                    break;
                // Get the x and y position difference continously
                case MotionEventActions.Move:
                    // Get the difference between current position and old position
                    new_x = e.GetX () - old_x;
                    new_y = e.GetY () - old_y;
                    // Convert to int, to remove decimal numbers (apparently can't be send through the tcp listener)
                    int_x = Convert.ToInt32 (new_x);
                    int_y = Convert.ToInt32 (new_y);
                    // Convert to string, so it can be send
                    send_x = Convert.ToString (int_x);
                    send_y = Convert.ToString (int_y);

                    // Send x and y position over two messages
                    Connect (ipAddress, send_x);
                    Connect (ipAddress, send_y);

                    // Set old position to current position
                    old_x = e.GetX ();
                    old_y = e.GetY ();
                    break;
            }
            return true;
        }
Пример #7
0
 public static bool IsHooked(Int32 processId)
 {
     lock (HookedProcesses)
     {
         return HookedProcesses.Contains(processId);
     }
 }
Пример #8
0
        public DbScriptControl(Event_dataset_script Data, Int32 ID, uint id)
        {
            InitializeComponent();

            this.Name = ID.ToString();
            eventid = ID;
            script_id = id;
            this.eventCheckbox.Text = "Event: " + ID.ToString();

            this.eventCheckbox.Checked = true;

            for (int n = 0; n < Info.ScriptCommands.GetLength(0); n++)
                this.comboBoxAction.Items.Add(Info.ScriptCommands[n, 0]);

            // set width
            comboBoxAction.DropDownWidth = DropDownWidth(comboBoxAction);
            comboBoxAction.DropDownStyle = ComboBoxStyle.DropDownList;

            this.comboBoxAction.SelectedIndex = Data.command;
            this.textBoxDelay.Text = Data.delay.ToString();

            this.textBox_datalong.Text = Data.datalong.ToString();
            this.textBox_datalong2.Text = Data.datalong2.ToString();

            this.textBox_buddy.Text = Data.buddy.ToString();
            this.textBox_radius.Text = Data.radius.ToString();
            this.textBox_flags.Text = Data.dataflags.ToString();

            this.textBox_dataint1.Text = Data.dataint.ToString();
            this.textBox_dataint2.Text = Data.dataint2.ToString();
            this.textBox_dataint3.Text = Data.dataint3.ToString();
            this.textBox_dataint4.Text = Data.dataint4.ToString();

            this.textBox_posX.Text = Data.position_x.ToString();
            this.textBox_posY.Text = Data.position_y.ToString();
            this.textBox_posZ.Text = Data.position_z.ToString();
            this.textBox_orientation.Text = Data.orientation.ToString();

            this.commentTextbox.Text = Data.comment;

            //switch (comboBoxAction.SelectedIndex)
            //{
            //    case 0:     // talk
            //        textBox_dataint1.ReadOnly = false;
            //        textBox_dataint2.ReadOnly = false;
            //        textBox_dataint3.ReadOnly = false;
            //        textBox_dataint4.ReadOnly = false;
            //        break;
            //    case 3:     // move
            //    case 6:     // teleport
            //    case 10:    // summon
            //        textBox_posX.ReadOnly = false;
            //        textBox_posY.ReadOnly = false;
            //        textBox_posZ.ReadOnly = false;
            //        textBox_orientation.ReadOnly = false;
            //        break;
            //}

            locked = false;
        }
Пример #9
0
        /// <summary>
        /// This method deletes a manager.
        /// </summary>
        /// <param name="id">Unique ID of the manager to delete</param>
        /// <returns>Success/Failure</returns>
        public Boolean deleteManager(Int32 id)
        {
            dLog.Info("Entering method deleteManager | ID:" + id);
            Boolean result = false;
            SqlConnection conn = null;
            SqlCommand stmt = null;

            try
            {
                String sqlStr = "DELETE FROM Employee WHERE id = @id";

                conn = new SqlConnection(connString);
                conn.Open();
                stmt = new SqlCommand(sqlStr, conn);
                stmt.Parameters.Add(new SqlParameter("@id", id));

                if (stmt.ExecuteNonQuery() > 0)
                    result = true;
            }
            catch (SqlException e1)
            {
                dLog.Error("SqlException in deleteManager: " + e1.Message);
            }
            catch (Exception e2)
            {
                dLog.Error("Exception in deleteManager: " + e2.Message);
            }
            finally
            {
                if (conn.State == System.Data.ConnectionState.Open)
                    conn.Close();
            }

            return result;
        }
        public Client(String host, Int32 port)
        {
            try
            {

                clientName = Dns.GetHostName();

            }
            catch (SocketException se)
            {

                MessageBox.Show("ERROR: Could not retrieve client's DNS hostname.  Please try again." + se.Message + ".", "Client Socket Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;

            }

            serverName = host;
            gamePort = port;
            client = new TcpClient(host, port);
            netStream = client.GetStream();
            reader = new StreamReader(netStream);
            writer = new StreamWriter(netStream);
            ssl = new SslStream(netStream, false, new RemoteCertificateValidationCallback(ValidateCert));
            cert = new X509Certificate2("server.crt");
            ssl.AuthenticateAsClient(serverName);
            writer.AutoFlush = true;
        }
Пример #11
0
        public NpgsqlParse(String prepareName, byte[] queryString, Int32[] parameterIDs)
        {
            _bPrepareName = BackendEncoding.UTF8Encoding.GetBytes(prepareName);
            _bQueryString = queryString;

            _parameterIDs = parameterIDs;
        }
Пример #12
0
 /// <summary>
 /// Gets the bytes of an Int32.
 /// </summary>
 public static unsafe void GetBytes(Int32 value, byte[] buffer, int startIndex)
 {
     fixed(byte* numRef = buffer)
     {
         *((int*)(numRef+startIndex)) = value;
     }
 }
Пример #13
0
        /// <summary>
        /// Récupère une Genre à partir d'un identifiant de client
        /// </summary>
        /// <param name="Identifiant">Identifant de Genre</param>
        /// <returns>Un Genre </returns>
        public static Genre Get(Int32 identifiant)
        {
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = @"SELECT Identifiant, Libelle FROM Genre
                                WHERE Identifiant = @Identifiant ;";
            SqlCommand commande = new SqlCommand(requete, connection);

            //Paramètres
            commande.Parameters.AddWithValue("Identifiant", identifiant);

            //Execution
            connection.Open();
            SqlDataReader dataReader = commande.ExecuteReader();

            dataReader.Read();

            //1 - Création du Genre
            Genre genre = new Genre();

            genre.Identifiant = dataReader.GetInt32(0);
            genre.libelle = dataReader.GetString(1);
            dataReader.Close();
            connection.Close();
            return genre;
        }
Пример #14
0
        public void ObrisiPonudu(Int32 ponuda_ID)
        {
            SqlConnection _konekcijaSqlConnection = new SqlConnection();
            using (_konekcijaSqlConnection = Konekcija.DajKonekciju())
            {
                SqlCommand _obrisiRobuSQLCommand = new SqlCommand("uspObrisiPonudu", _konekcijaSqlConnection);

                _obrisiRobuSQLCommand.CommandType = CommandType.StoredProcedure;

                #region Definisi parametre

                _obrisiRobuSQLCommand.Parameters.Add("@Ponuda_ID", SqlDbType.Int).Value = ponuda_ID;

                #endregion

                try
                {
                    _konekcijaSqlConnection.Open();

                    _obrisiRobuSQLCommand.ExecuteNonQuery();

                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    _konekcijaSqlConnection.Close();
                }
            }
        }
Пример #15
0
 public float getStayPrice(Int32 id_booking) {
     SqlResults results = new SqlStoredProcedure("[BOBBY_TABLES].SP_GET_STAY_PRICE")
                         .WithParam("@IdBooking").As(SqlDbType.Int).Value(id_booking)
                         .WithParam("@Price").As(SqlDbType.Float).AsOutput()
                         .Execute();
     return (float)results["@Price"];
 }
Пример #16
0
 public void UpdateFromInput(EditStageViewModel editStageViewModel)
 {
     World = Int32.Parse(editStageViewModel.InputWorld);
     Stage = Int32.Parse(editStageViewModel.InputStage);
     StageName = editStageViewModel.InputStageName;
     StageDescription = editStageViewModel.InputStageDescription;
 }
Пример #17
0
 public Int32 getExtraNights(Int32 id_booking) {
     SqlResults results = new SqlStoredProcedure("[BOBBY_TABLES].SP_GET_EXTRA_NIGHTS")
                         .WithParam("IdBooking").As(SqlDbType.Int).Value(id_booking)
                         .WithParam("@Extra").As(SqlDbType.Int).AsOutput()
                         .Execute();
     return (Int32)results["@Extra"];
 }
Пример #18
0
	// SendBytesToPrinter()
	// When the function is given a printer name and an unmanaged array
	// of bytes, the function sends those bytes to the print queue.
	// Returns true on success, false on failure.
	public static bool SendBytesToPrinter( string szPrinterName, IntPtr pBytes, Int32 dwCount)
	{
		Int32    dwError = 0, dwWritten = 0;
		IntPtr    hPrinter = new IntPtr(0);
		DOCINFOA    di = new DOCINFOA();
		bool    bSuccess = false; // Assume failure unless you specifically succeed.

		di.pDocName = "My C#.NET RAW Document";
		di.pDataType = "RAW";

		// Open the printer.
		if( OpenPrinter( szPrinterName, out hPrinter, 0 ) )
		{
			// Start a document.
			if( StartDocPrinter(hPrinter, 1, di) )
			{
				// Start a page.
				if( StartPagePrinter(hPrinter) )
				{
					// Write your bytes.
					bSuccess = WritePrinter(hPrinter, pBytes, dwCount, out dwWritten);
					EndPagePrinter(hPrinter);
				}
				EndDocPrinter(hPrinter);
			}
			ClosePrinter(hPrinter);
		}
		// If you did not succeed, GetLastError may give more information
		// about why not.
		if( bSuccess == false )
		{
			dwError = Marshal.GetLastWin32Error();
		}
		return bSuccess;
	}
Пример #19
0
 public static void AddHookedProcess(Int32 processId)
 {
     lock (HookedProcesses)
     {
         HookedProcesses.Add(processId);
     }
 }
 public BufferManager(Int32 totalBytes, Int32 totalBufferBytesInEachSaeaObject)
 {
     totalBytesInBufferBlock = totalBytes;
     this.currentIndex = 0;
     this.bufferBytesAllocatedForEachSaea = totalBufferBytesInEachSaeaObject;
     this.freeIndexPool = new Stack<int>();
 }
Пример #21
0
        //public:
        public Bullet(Double x_, Double y_, Int32 width_, Int32 height_, Int32 damage_, BulletKind kind_)
        {
            PosX = x_;
            PosY = y_;
            Width = width_;
            Height = height_;
            switch (kind_)
            {
                case BulletKind.Laser:
                    {
                        _type = BulletType.Laser;
                        break;
                    }
                case BulletKind.Exploded:
                    {
                        _type = BulletType.Exploded;
                        break;
                    }
                case BulletKind.Rocket:
                    {
                        _type = BulletType.Rocket;
                        break;
                    }
            }
            Damage = damage_+_type._bonusdamage;
            _active = true;

            _vx = 1; _vy = 0;
            _speed = _type.speed;
        }
Пример #22
0
        public String CommonNames(Int32 cutOff)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendLine("Total number: " + NumberOfEntities.ToString());

            List<KeyValuePair<String, Int32>> sorted = new List<KeyValuePair<String, Int32>>();
            foreach ( var keyValuePair in _namesCount )
            {
                String name = keyValuePair.Key;
                sorted.Add(keyValuePair);
            }
            sorted.Sort(delegate(KeyValuePair<String, Int32> x, KeyValuePair<String, Int32> y)
            {
                return y.Value.CompareTo(x.Value);
            });
            Int32 count = 0;
            foreach ( var keyValuePair in sorted )
            {
                builder.AppendLine(keyValuePair.Key + " (" + keyValuePair.Value.ToString() + ") ");
                count++;
                if ( count > cutOff )
                {
                    break;
                }
            }

            String result = builder.ToString();
            return result;
        }
Пример #23
0
 public GGuess()
 {
     _UserNum = (0);
     _AllJinbi = (0);
     _ResultUserNum = (0);
     _Status = (0);
 }
Пример #24
0
 /// <summary>
 /// Constructor with fileName, path and dayInterval. The file is created in the specified directory, if the directory
 /// does not exist, the file is created in the same directory than the program.
 /// An archivage is set with the specified number of days.
 /// </summary>
 /// <param name="fileName">Name of the log file</param>
 /// <param name="path">The path of the directory where the log file will be saved</param>
 /// <param name="dayInterval">Number of days etween each archivage</param>
 public LogManager(String fileName, String path, Int32 dayInterval)
 {
     this.FileName = fileName;
     setPath(path);
        // this.fileManager = new FileManager(this.fileName, this.path);
     setArchiveManager(dayInterval);
 }
Пример #25
0
 public ChatMessage(IDataReader idr, Int32 offsetHours)
 {
     SentBy = idr.GetValueByName<String>("SentByUserName").HTMLDecode();
     Message = idr.GetValueByName<String>("Message").HTMLDecode();
     SentDate = idr.GetValueByName<DateTime>("DateSent").AddHours(offsetHours);
     DateSent = SentDate.ToShortDateString() + " " + SentDate.ToLongTimeString();
 }
Пример #26
0
        public static void SetUp(TestContext context)
        {
            _unitOfWork = new UnitOfWork();
            var memberFactory = new MemberFactory();

            _email = Guid.NewGuid().ToString();

            _decorator = new MemberDecorator(memberFactory, _unitOfWork.MemberRepository);

            _oldCount = _unitOfWork.MemberRepository.Count();
            _member = memberFactory.CreateMember(_email);
            _sameMember = memberFactory.CreateMember(_email);

            _decorator.Add(_member);
            _unitOfWork.PersistAll();

            using (var uow = new UnitOfWork())
            {
                _newCount = uow.MemberRepository.Count();
                try
                {
                    _loadedMember = uow.MemberRepository.Get(_member.Id);
                }
                catch (Exception)
                {
                    _loadedMember = null;
                }
            }
        }
Пример #27
0
        /// <summary>
        /// ��ȡ���νṹ����
        /// </summary> 
        public IList<ModelCategory> CategoryAllThree(out string resultMsg, Int32 ParentCateg = 0)
        {
            resultMsg = string.Empty;
            IList<ModelCategory> list = new List<ModelCategory>();
            try
            {
                //�洢��������
                string sql = "usp_category_select_all_by_three";

                //�������
                IList<DBParameter> parm = new List<DBParameter>();
                parm.Add(new DBParameter() { ParameterName = "@ParentCateg", ParameterValue = ParentCateg, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Int32 });

                //��ѯִ��
                using (IDataReader dr = DBHelper.ExecuteReader(sql, true, parm))
                {
                    var listTemp = GetModelThree(dr);
                    list = GetCategoryAllThree(listTemp, ParentCateg);
                }
            }
            catch (Exception ex)
            {
                resultMsg = string.Format("{0} {1}", BaseDict.ErrorPrefix, ex.ToString());
            }
            return list;
        }
 public InsurancePrem GetById(Int32? id)
 {
     using (var session = GetSession())
     {
         return session.Get<InsurancePrem>(id);
     }
 }
 public TimesheetBillingCityRateJoinCollection FetchActiveByTimesheetId(Int32 timesheetId)
 {
     return new TimesheetBillingCityRateJoinCollection()
         .Where(TimesheetBillingCityRateJoin.Columns.TimesheetId, timesheetId)
         .Where(TimesheetBillingCityRateJoin.Columns.IsDeleted, false)
         .OrderByAsc(TimesheetBillingCityRateJoin.Columns.City).Load();
 }
Пример #30
0
	public override void Decode()
	{
		MemoryStream stream = new MemoryStream(Data);
		BinaryReader reader = new BinaryReader(stream);
		this.ShapeId = reader.ReadInt32();
		this.Flags = reader.ReadInt32();
	}