示例#1
0
        public ActionResult PrintServs(int?servsId)
        {
            Serv serv = _context.Servs
                        .Include(a => a.Auto)
                        .Include(d => d.Driver)
                        .FirstOrDefault(s => s.ServId == servsId);

            Word.Application app  = new Word.Application();
            Word.Document    oDoc = app.Documents.Open(Environment.CurrentDirectory + @"\Листок_учета.dotx");

            try
            {
                oDoc.SaveAs2(FileName: Environment.CurrentDirectory + "_For_print.rtf");
                oDoc.Bookmarks["AutoName"].Range.Text       = serv.Auto.AutoName;
                oDoc.Bookmarks["AutoNumber"].Range.Text     = serv.Auto.AutoNumber;
                oDoc.Bookmarks["ServNaim"].Range.Text       = serv.ServNaim;
                oDoc.Bookmarks["ServPokaz"].Range.Text      = serv.ServPokaz.ToString();
                oDoc.Bookmarks["ServDate"].Range.Text       = serv.ServDate.ToString("dd.MM.yyyy");
                oDoc.Bookmarks["DriverFullName"].Range.Text = serv.Driver.DriverFullName;
                oDoc.Close();
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                oDoc.Close();
                oDoc = null;
                return(NotFound("Возникла ошибка " + ex.Message + " Обратитесь к системному администатору!"));
            }
        }
示例#2
0
        internal override UInt32 InsertRecord(DataRow _row)
        {
            var cmd = new MySqlCommand
            {
                CommandText = "INSERT INTO vendProducts " +
                              "(vProd_Code,vProd_Description,vProd_Price,vProd_Quant,vProd_Units,VProd_VenId,vProd_CatNum,vProd_Inactive,vPRod_Timestamp)" +
                              "Values(?Code,?Desc,?Price,?Quant,?Units,?VenId,?VendCat,?Inactive,?Timestamp)"
            };

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Desc", _row.ItemArray[2].ToString());
            cmd.Parameters.AddWithValue("?Price", Convert.ToDecimal(_row.ItemArray[3]));
            cmd.Parameters.AddWithValue("?Quant", Convert.ToDecimal(_row.ItemArray[4]));
            cmd.Parameters.AddWithValue("?Units", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?VenId", Convert.ToUInt32(_row.ItemArray[6]));
            cmd.Parameters.AddWithValue("?VenCat", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[8]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));


            var    result  = Serv.ExecuteMySQLNonQuery(cmd);
            UInt32 mySqlId = Convert.ToUInt32(cmd.LastInsertedId);

            return(mySqlId);
        }
示例#3
0
文件: Main.cs 项目: Byrnn/U3DCap6
	public static void Main(string[] args)
	{
		Console.WriteLine("Hello World!");
		Serv serv = new Serv();
		serv.Start("127.0.0.1", 1234);


         
        



        while (true)
		{
			string str = Console.ReadLine();
			switch (str)
			{
			case "quit":
				return;
			}
		}






	}
示例#4
0
        internal override UInt32 InsertRecord(DataRow _row)
        {
            var cmd = new MySqlCommand
            {
                CommandText = "INSERT INTO locations " +
                              "(loc_Code,loc_Name,loc_Address,loc_Address2,loc_City,loc_State,loc_Zip,loc_Phone,loc_Email,loc_Inactive,loc_Timestamp)" +
                              "Values(?Code,?Name,?Add,?Add2,?City,?State,?Zip,?Phone,?Email,?Inactive,?Timestamp)"
            };

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Name", _row[2].ToString());
            cmd.Parameters.AddWithValue("?Add", _row.ItemArray[3].ToString());
            cmd.Parameters.AddWithValue("?Add2", _row.ItemArray[4].ToString());
            cmd.Parameters.AddWithValue("?City", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?State", _row.ItemArray[6].ToString());
            cmd.Parameters.AddWithValue("?Zip", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Phone", _row.ItemArray[8].ToString());
            cmd.Parameters.AddWithValue("?Email", _row.ItemArray[9].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[10]));
            var dt = DateTime.Now.AddSeconds(GV.ServTimeDiff);

            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var    result  = Serv.ExecuteMySQLNonQuery(cmd);
            UInt32 mySqlId = Convert.ToUInt32(cmd.LastInsertedId);

            return(mySqlId);

            //todo add insert record to change table
        }
示例#5
0
        internal override UInt32 InsertRecord(DataRow _row)
        {
            var cmd = new MySqlCommand();

            cmd.CommandText = "INSERT INTO vendors " +
                              "(ven_Code,ven_Name,ven_Address,ven_Address2,ven_City,ven_State,ven_Zip,ven_Phone,ven_Email,ven_Inactive,ven_Timestamp)" +
                              "Values(?Code,?Name,?Add,?Add2,?City,?State,?Zip,?Phone,?Email,?Inactive,?Timestamp)";

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Name", _row[2].ToString());
            cmd.Parameters.AddWithValue("?Add", _row.ItemArray[3].ToString());
            cmd.Parameters.AddWithValue("?Add2", _row.ItemArray[4].ToString());
            cmd.Parameters.AddWithValue("?City", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?State", _row.ItemArray[6].ToString());
            cmd.Parameters.AddWithValue("?Zip", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Phone", _row.ItemArray[8].ToString());
            cmd.Parameters.AddWithValue("?Email", _row.ItemArray[9].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[10]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var    result  = Serv.ExecuteMySQLNonQuery(cmd);
            UInt32 mySqlId = Convert.ToUInt32(cmd.LastInsertedId);

            return(mySqlId);
        }
示例#6
0
        internal override bool UpdateRecord(DataRow _row)
        {
            var cmd = new MySqlCommand
            {
                CommandText = "UPDATE vendProducts " +
                              "SET vProd_Code=?Code,vProd_Description=?Desc,vProd_Price=?Price,vProd_Quant=?Quant,vProd_Units=?Units," +
                              "vProd_Id=?VenId,vProd_VenCatNum=VendCat,vProd_Inactive=?Inactive,vProd_Timestamp=?Timestamp " +
                              "WHERE vProd_Id = ?Id"
            };

            cmd.Parameters.AddWithValue("?Id", Convert.ToUInt32(_row.ItemArray[0]));
            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Desc", _row.ItemArray[2].ToString());
            cmd.Parameters.AddWithValue("?Price", Convert.ToDecimal(_row.ItemArray[3]));
            cmd.Parameters.AddWithValue("?Quant", Convert.ToDecimal(_row.ItemArray[4]));
            cmd.Parameters.AddWithValue("?Units", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?VenId", Convert.ToUInt32(_row.ItemArray[6]));
            cmd.Parameters.AddWithValue("?VenCat", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[8]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var result = Serv.ExecuteMySQLNonQuery(cmd);

            return((Convert.ToInt32(result) > 0) ? true : false);
        }
示例#7
0
        internal override bool UpdateRecord(DataRow _row)
        {
            var cmd = new MySqlCommand();

            cmd.CommandText = "UPDATE vendors " +
                              "SET ven_Code=?Code,ven_Name=?Name,ven_Address=?Add,ven_Address2=?Add2,ven_City=?City," +
                              "ven_State=?State,ven_Zip=?Zip,ven_Phone=?Phone,ven_Email=?Email,ven_Inactive=?Inactive,ven_Timestamp=?Timestamp " +
                              "WHERE ven_Id = ?Id";

            if (!_row.ItemArray[0].Equals(System.DBNull.Value))
            {
                cmd.Parameters.AddWithValue("?Id", Convert.ToUInt32(_row.ItemArray[0]));
            }
            else
            {
                throw new Exception();
            }

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Name", _row[2].ToString());
            cmd.Parameters.AddWithValue("?Add", _row.ItemArray[3].ToString());
            cmd.Parameters.AddWithValue("?Add2", _row.ItemArray[4].ToString());
            cmd.Parameters.AddWithValue("?City", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?State", _row.ItemArray[6].ToString());
            cmd.Parameters.AddWithValue("?Zip", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Phone", _row.ItemArray[8].ToString());
            cmd.Parameters.AddWithValue("?Email", _row.ItemArray[9].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[10]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var result = Serv.ExecuteMySQLNonQuery(cmd);

            return((Convert.ToInt32(result) > 0) ? true : false);
        }
示例#8
0
        internal override bool UpdateRecord(DataRow _row)
        {
            var cmd = new MySqlCommand();

            cmd.CommandText = "UPDATE vendProducts " +
                              "SET vProd_Code=?Code,vProd_Name=?Name,vProd_VendCode==VendCode,vProd_Price=?Price,vProd_Quant=?Quant," +
                              "vProd_Units=?Units,vProd_Inactive=?Inactive,vProd_Timestamp=?Timestamp " +
                              "WHERE vProd_Id = ?Id";

            if (!_row.ItemArray[0].Equals(System.DBNull.Value))
            {
                cmd.Parameters.AddWithValue("?Id", Convert.ToUInt32(_row.ItemArray[0]));
            }
            else
            {
                throw new Exception();
            }

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Name", _row[2].ToString());
            cmd.Parameters.AddWithValue("?VendCode", _row.ItemArray[3].ToString());
            cmd.Parameters.AddWithValue("?Price", Convert.ToDecimal(_row.ItemArray[4]));
            cmd.Parameters.AddWithValue("?Quant", Convert.ToDecimal(_row.ItemArray[5]));
            cmd.Parameters.AddWithValue("?Units", _row.ItemArray[6].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[7]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var result = Serv.ExecuteMySQLNonQuery(cmd);

            return((Convert.ToInt32(result) > 0) ? true : false);
        }
示例#9
0
        public IActionResult DeleteConfirmed(int id)
        {
            Serv serv = _context.Servs.Find(id);

            _context.Servs.Remove(serv);
            _context.SaveChanges();
            return(RedirectToAction(nameof(Index)));
        }
示例#10
0
 static void CreateReserveOneByOne(Serv.Client client)
 {
     for (int i = 0; i < invokeCount; i++)
     {
         Reserve r = CreateTestReserve(i);
         client.create(r);
     }
 }
示例#11
0
        public void toTakePrice()
        {
            price = 0;
            foreach (serivce Serv in serivces)

            {
                price += Serv.getPrice();
            }
        }
示例#12
0
        protected override void BeginRun()
        {
            base.BeginRun();

            m_Background.BeginRun();
            Serv.BeginRun();
            m_P1Score.String    = "0";
            m_P1Score.TintColor = Color.Red;
        }
示例#13
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Serv.Initialize(m_GraphicsDM, this);

            // The number determines how good our anti-aliasing works.
            // Possible values are 2,4,8,16,32, but not all work on all computers.
            // 4 is safe, and 8 is too in almost all cases
            // Higher numbers mean lower frame-rates

            base.Initialize();
        }
示例#14
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     Serv.Initialize(m_GraphicsDM, this);
     base.Initialize();
     m_Player.BackgroundReference(m_Background);
     m_Enemy.BackgroundReference(m_Background);
     m_Enemy.PlayerReference(m_Player);
     Serv.AddUpdateableComponent(m_Background);
     Components.Add(m_Enemy);
     Serv.AddBeginable(m_Background);
     Serv.AddBeginable(m_Enemy);
 }
示例#15
0
        public static bool IsServ(this string Value, Serv serv)
        {
            foreach (var func in Enum.GetNames(typeof(Serv)))
            {
                if (func == Value && Value == serv.ToString())
                {
                    return(true);
                }
            }

            return(false);
        }
示例#16
0
        internal override bool CodeHasBeenUsed(Model mod, string code)
        {
            var cmd = new MySqlCommand();

            cmd.CommandText = "SELECT EXISTS(SELECT * FROM vendProducts" +
                              " WHERE vProd_Code = ?Code)";

            cmd.Parameters.AddWithValue("?Code", code);
            var result = Serv.ExecuteMySqlScaler(cmd);

            return((Convert.ToInt32(result) > 0) ? true : false);
        }
示例#17
0
        public async Task <IActionResult> CreateServs([Bind("ServId,ServDate,ServNaim,ServPokaz,AutoId,DriverId")] Serv serv)
        {
            if (ModelState.IsValid)
            {
                _context.Add(serv);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AutoId"]   = new SelectList(_context.Autos, "AutoId", "AutoNumber", serv.AutoId);
            ViewData["DriverId"] = new SelectList(_context.Drivers, "DriverId", "DriverFullName", serv.DriverId);
            return(View(serv));
        }
示例#18
0
        public async Task <IActionResult> EditServs(int id, [Bind("ServId,ServDate, ServNaim,ServPokaz,DriverId ,AutoId")] Serv serv)
        {
            if (id != serv.ServId)
            {
                return(NotFound());
            }

            ViewData["AutoId"]   = new SelectList(_context.Autos, "AutoId", "AutoNumber", serv.AutoId);
            ViewData["DriverId"] = new SelectList(_context.Drivers, "DriverId", "DriverFullName", serv.DriverId);
            _context.Update(serv);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
示例#19
0
    public static void Main(string[] arg)
    {
        Console.WriteLine("【SERVER】");
        Serv serv = new Serv();

        serv.Start("127.0.0.1", 1234);
        while (true)
        {
            string str = Console.ReadLine();
            switch (str)
            {
            case ("quit"): return;
            }
        }
    }
示例#20
0
        static void Main(string[] args)
        {
            Serv serv = new Serv();

            serv.Start("127.0.0.1", 2333);

            while (true)
            {
                string str = Console.ReadLine();
                if (str.Equals("quit"))
                {
                    return;
                }
            }
        }
示例#21
0
        void UFOController()
        {
            if (m_UFO.Done || m_UFO.Hit)
            {
                ResetUFO();
            }

            if (m_UFOTimer.Expired && !m_UFO.Active)
            {
                m_UFOTimer.Amount = Serv.RandomMinMax(m_UFOTimerSeedAmount * 0.5f,
                                                      m_UFOTimerSeedAmount + (m_UFOTimerSeedAmount - m_Wave));
                m_UFO.Spawn(m_UFOCount, m_Wave);
                m_UFOCount++;
            }
        }
        protected void Pro_TextChanged(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(GetConnectionString());                     //Parametros de conexion
            string        sql  = "select * from Servicio where idUnidad=" + Pro.SelectedValue; //Query
            //Se sacan los datos y se meten en los select
            SqlDataAdapter sda = new SqlDataAdapter(sql, conn);

            conn.Open();
            DataTable dt = new DataTable();

            sda.Fill(dt);
            Serv.DataSource     = dt;
            Serv.DataTextField  = "nombre";
            Serv.DataValueField = "idServicio";
            Serv.DataBind();
            conn.Close();
        }
示例#23
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello!");
            Serv serv = new Serv();

            serv.Start(GetLocalIP(), 88);

            while (true)
            {
                string str = Console.ReadLine();
                switch (str)
                {
                case "quit":
                    return;
                }
            }
        }
示例#24
0
        static void CreateReserveBatch(Serv.Client client)
        {
            for (int i = 0; i < invokeCount; i++)
            {
                List<Reserve> list = new List<Reserve>();
                for (int j = 0; j < packageCount; j++)
                {
                    Reserve r = CreateTestReserve(j);
                    list.Add(r);
                }

                Stopwatch watch = new Stopwatch();
                watch.Start();
                client.createBatch(list);
                watch.Stop();
                packageLog.Add(watch.Elapsed.TotalMilliseconds);
            }
        }
示例#25
0
        private void update()
        {
            label10.Text = information.countOfMachine.ToString();
            int i = 0;
            int j = 0;
            int z = 0;

            dataGridView1.Rows.Clear();
            dataGridView2.Rows.Clear();
            dataGridView3.Rows.Clear();
            foreach (order Order in information.orders)
            {
                if (!Order.isReady && !Order.isTake)
                {
                    dataGridView1.Rows.Add();
                    dataGridView1.Rows[i].Cells[0].Value = Order.id;
                    string value = " ";
                    foreach (serivce Serv in Order.serivces)
                    {
                        value += Serv.getName() + " ";
                    }
                    dataGridView1.Rows[i].Cells[1].Value = value;
                    dataGridView1.Rows[i].Cells[2].Value = Order.getPrice();
                    dataGridView1.Rows[i].Cells[3].Value = Order.getDateIn();
                    i++;
                }
                else if (Order.isReady && !Order.isTake)
                {
                    dataGridView2.Rows.Add();
                    dataGridView2.Rows[j].Cells[0].Value = Order.id;
                    j++;
                }
                else if (Order.isReady && Order.isTake)
                {
                    dataGridView3.Rows.Add();
                    dataGridView3.Rows[z].Cells[0].Value = Order.id;
                    dataGridView3.Rows[z].Cells[1].Value = Order.getPrice();
                    dataGridView3.Rows[z].Cells[2].Value = Order.getDateOut();
                    z++;
                }
            }
        }
示例#26
0
        internal override bool UpdateRecord(DataRow _row)
        {
            // if code has been changed it must cascade to all child records

            var cmd = new MySqlCommand
            {
                CommandText = "UPDATE locations " +
                              "SET loc_Code=?Code,loc_Name=?Name,loc_Address=?Add,loc_Address2=?Add2,loc_City=?City," +
                              "loc_State=?State,loc_Zip=?Zip,loc_Phone=?Phone,loc_Email=?Email,loc_Inactive=?Inactive,loc_Timestamp=?Timestamp " +
                              "WHERE loc_Id = ?Id"
            };

            if (!_row.ItemArray[0].Equals(System.DBNull.Value))
            {
                cmd.Parameters.AddWithValue("?Id", Convert.ToUInt32(_row.ItemArray[0]));
            }
            else
            {
                throw new Exception();
            }

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Name", _row[2].ToString());
            cmd.Parameters.AddWithValue("?Add", _row.ItemArray[3].ToString());
            cmd.Parameters.AddWithValue("?Add2", _row.ItemArray[4].ToString());
            cmd.Parameters.AddWithValue("?City", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?State", _row.ItemArray[6].ToString());
            cmd.Parameters.AddWithValue("?Zip", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Phone", _row.ItemArray[8].ToString());
            cmd.Parameters.AddWithValue("?Email", _row.ItemArray[9].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[10]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var result = Serv.ExecuteMySQLNonQuery(cmd);

            return((Convert.ToInt32(result) > 0) ? true : false);
            //todo add update record to change table
        }
示例#27
0
    public static void Main(string[] args)
    {
        Console.WriteLine("服务器启动中,请稍后......");
        string hostName = Dns.GetHostName();   //获取本机名

        Console.WriteLine("服务器主机名:" + hostName);
        IPHostEntry localhost = Dns.GetHostEntry(hostName);//Dns.GetHostByName(hostName);    //获取所有IPv4的地址

        for (int i = 0; i < localhost.AddressList.Length; i++)
        {
            IPAddress localaddr = localhost.AddressList[i];
            Console.WriteLine("服务器地址" + (i + 1) + ":" + localaddr);
        }
        Serv serv = new Serv();

        for (int i = 0; i < localhost.AddressList.Length; i++)
        {
            IPAddress localaddr = localhost.AddressList[i];
            if (localaddr.ToString().StartsWith("192.168"))
            {
                //选择一个在同一个局域网的ip地址做为服务器端地址,端口指定9001
                serv.Start(localaddr.ToString(), 9001);
            }
        }
        Console.WriteLine("服务器运行中,输入quit命令关闭服务器...");

        while (true)
        {
            string str = Console.ReadLine();
            switch (str)
            {
            case "quit":
                return;
            }
        }
    }
示例#28
0
        public static bool IsServ(this string Value, Serv serv)
        {
            foreach(var func in Enum.GetNames(typeof(Serv)))
            {
                if(func == Value && Value == serv.ToString())
                    return true;
            }

            return false;
        }
示例#29
0
 public void AddService(Servico sv)
 {
     Serv.Add(sv);
 }
示例#30
0
 public void RemoveService(Servico sv)
 {
     Serv.Remove(sv);
 }
示例#31
0
文件: Game.cs 项目: ethanrobison/Core
 private void Update() => Serv.Update();
示例#32
0
 public override void OnStartServer()
 {
     serv = FindObjectOfType <Serv>();
     serv.AddPlayer(this);
 }