示例#1
0
 public void Clear()
 {
     IDText.Clear();
     FullNameText.Clear();
     UserNameText.Clear();
     PasswordText.Clear();
 }
示例#2
0
    public void SetValue(int value)
    {
        this.value = value;
        IDText IdText = transform.GetComponentInChildren <IDText>();

        IdText.SetID(value);
    }
示例#3
0
文件: Bot.cs 项目: robsws/aoc
 // Use this for initialization
 void Awake()
 {
     manager   = Manager.instance;
     chips     = new List <GameObject>();
     leftClaw  = transform.Find("LeftClaw").gameObject;
     rightClaw = transform.Find("RightClaw").gameObject;
     // Set ID text on BotIDText
     botIdText = transform.GetComponentInChildren <IDText>();
     botIdText.SetID(botId);
 }
示例#4
0
        private void confirmBtn_Click(object sender, EventArgs e)
        {
            //创建sql对象
            String        conStr = "server=.;database=db_manager;Integrated security=SSPI";
            SqlConnection con    = new SqlConnection(conStr);

            con.Open();

            if (IDText.Text == "")
            {
                MessageBox.Show("学号为必填项!", "提示");
            }
            else
            {
                String        check = "select* from db_student where ID = '" + IDText.Text + "'";
                SqlCommand    cmd   = new SqlCommand(check, con);
                SqlDataReader sdr   = cmd.ExecuteReader();
                sdr.Read();
                if (sdr.HasRows)
                {
                    MessageBox.Show("该学生已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    IDText.Text = "";
                    IDText.Focus();
                }
                else
                {
                    sdr.Close();
                    String test      = "insert into db_student values('2123','larry','男',21,2014,'1300000','CS',2)";
                    String insertSQL = "insert into db_student values('" + IDText.Text + "','"
                                       + nameText.Text + "','"
                                       + sexComboBox.Text + "',"
                                       + ageText.Text + "," + entryText.Text + ",'"
                                       + contactText.Text + "','"
                                       + spText.Text + "'," + classText.Text
                                       + ")";

                    cmd = new SqlCommand(insertSQL, con);
                    int result = cmd.ExecuteNonQuery();
                    if (result == -1)
                    {
                        MessageBox.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        MessageBox.Show("添加成功,下次启动时刷新!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        this.Hide();
                    }
                }
                cmd.Dispose();
            }

            con.Dispose();
            con.Close();
        }
示例#5
0
        public void ReadingInTextFile()
        {
            const string textfile = "Savedlist.txt";

            using (StreamReader r = new StreamReader(textfile))
            {
                string line;
                string Password = "";
                string UserName = "";
                string FullName = "";
                string ID       = "";
                while ((line = r.ReadLine()) != null)
                {
                    string[] linearray = line.Split(',');
                    for (int i = 0; i < linearray.Length; i++)
                    {
                        switch (i)
                        {
                        case 0:
                            ID = linearray[i];
                            break;

                        case 1:
                            FullName = linearray[i];
                            break;

                        case 2:
                            UserName = linearray[i];
                            break;

                        case 3:
                            Password = linearray[i];
                            break;
                        }
                    }
                    List <EmployeeDetails> Listofemployees = new List <EmployeeDetails>();
                    Listofemployees.Add(new EmployeeDetails(int.Parse(ID), FullName, UserName, Password));
                    if (UserName == UserNameText.Text || ID == IDText.Text)
                    {
                        MessageBox.Show("Please enter a different username or ID as this has already been used");
                        if (UserName == UserNameText.Text)
                        {
                            UserNameText.Clear();
                        }
                        if (ID == IDText.Text)
                        {
                            IDText.Clear();
                        }
                        inuse = true;
                    }
                }
            }
        }
示例#6
0
        private void AddCustomerSubmit_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[7];
            Data[0] = IDText.GetLineText(0);
            Data[1] = NameText.GetLineText(0);
            Data[2] = PhoneText.GetLineText(0);
            Data[3] = AddressText.GetLineText(0);
            Data[4] = SexText.GetLineText(0);
            Data[5] = Data[0];
            Data[6] = TypeText.GetLineText(0);

            acc.createCustomer(Data).ShowDialog();

            this.Close();
        }
        private void AddEmployeeSubmit_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[5];
            Data[0] = IDText.GetLineText(0);
            Data[1] = NameText.GetLineText(0);
            Data[2] = PhoneText.GetLineText(0);
            Data[3] = AddressText.GetLineText(0);
            Data[4] = SexText.GetLineText(0);
            string EID       = Data[0];
            string Salary    = SalaryText.GetLineText(0);
            string StartDate = StartDateText.GetLineText(0);
            string ManagerID = ManagerText.GetLineText(0);

            MakePerson   P = new MakePerson(Data, cn);
            MakeEmployee E = new MakeEmployee(EID, Salary, StartDate, ManagerID, cn);

            try
            {
                P.CreatePerson();
            }
            catch (OleDbException ex)
            {
                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            try
            {
                E.CreateEmployee();
            }
            catch (OleDbException ex)
            {
                try
                {
                    P.DeletePerson();
                }
                catch (OleDbException ex2) { }

                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            this.Close();
        }
        private void AddEmployeeSubmit_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[9];
            Data[0] = IDText.GetLineText(0);
            Data[1] = NameText.GetLineText(0);
            Data[2] = PhoneText.GetLineText(0);
            Data[3] = AddressText.GetLineText(0);
            Data[4] = SexText.GetLineText(0);
            Data[5] = Data[0];
            Data[6] = SalaryText.GetLineText(0);
            Data[7] = StartDateText.GetLineText(0);
            Data[8] = ManagerText.GetLineText(0);

            aec.createEmployee(Data).ShowDialog();

            this.Close();
        }
        private void AddCustomerSubmit_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[5];
            Data[0] = IDText.GetLineText(0);
            Data[1] = NameText.GetLineText(0);
            Data[2] = PhoneText.GetLineText(0);
            Data[3] = AddressText.GetLineText(0);
            Data[4] = SexText.GetLineText(0);
            string EID  = Data[0];
            string Type = TypeText.GetLineText(0);

            MakePerson   P = new MakePerson(Data, cn);
            MakeCustomer E = new MakeCustomer(EID, Type, cn);

            try
            {
                P.CreatePerson();
            }
            catch (OleDbException ex)
            {
                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            try
            {
                E.CreateCustomer();
            }
            catch (OleDbException ex)
            {
                try
                {
                    P.DeletePerson();
                }
                catch (OleDbException ex2) { }

                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            this.Close();
        }
示例#10
0
        void ReleaseDesignerOutlets()
        {
            if (AddNewIdButton != null)
            {
                AddNewIdButton.Dispose();
                AddNewIdButton = null;
            }

            if (DeleteIdButton != null)
            {
                DeleteIdButton.Dispose();
                DeleteIdButton = null;
            }

            if (HeaderLabel != null)
            {
                HeaderLabel.Dispose();
                HeaderLabel = null;
            }

            if (IDText != null)
            {
                IDText.Dispose();
                IDText = null;
            }

            if (mainTableView != null)
            {
                mainTableView.Dispose();
                mainTableView = null;
            }

            if (ShowFeedButton != null)
            {
                ShowFeedButton.Dispose();
                ShowFeedButton = null;
            }

            if (TextLabel != null)
            {
                TextLabel.Dispose();
                TextLabel = null;
            }
        }
示例#11
0
        public List <IDText> GetMerchantSell(uint merchantID)
        {
            string where = string.Format("merchantid={0}", merchantID);
            List <ViewMerchantSell> list = db.SelectData <ViewMerchantSell>("view_merchantsell", where);

            if (list == null)
            {
                throw new UnfulfilException("/language/database/no_record");
            }

            List <IDText> sellList = new List <IDText>();

            foreach (ViewMerchantSell sell in list)
            {
                IDText it = new IDText();
                it.id   = (uint)sell.product_id;
                it.text = sell.product_name;
                sellList.Add(it);
            }
            return(sellList);
        }
示例#12
0
        private void RemoveButton_Click(object sender, RoutedEventArgs e)
        {
            int    KeyNum = 0;
            string Num    = IDText.GetLineText(0);

            try
            {
                KeyNum = int.Parse(Num);
            }
            catch (Exception ex)
            {
                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
            }

            if (Person)
            {
                D.DeletePart(KeyNum);
            }
            else if (Vehicle)
            {
                D.DeleteVehicle(KeyNum);
            }
            else if (Part)
            {
                D.DeletePart(KeyNum);
            }
            PersonCheck.IsChecked  = false;
            VehicleCheck.IsChecked = false;
            PartCheck.IsChecked    = false;
            Person  = false;
            Vehicle = false;
            Part    = false;
            PersonCheck.Visibility  = Visibility.Visible;
            VehicleCheck.Visibility = Visibility.Visible;
            PartCheck.Visibility    = Visibility.Visible;
            TextBoxLabel.Text       = "";
            IDText.Clear();
        }
示例#13
0
        private void Save_Click(object sender, EventArgs e)
        {
            if (IDText.Text == "" || FullNameText.Text == "" || UserNameText.Text == "" || PasswordText.Text == "")
            {
                MessageBox.Show("Please fill in all the boxes");
                IDText.Clear();
                FullNameText.Clear();
                UserNameText.Clear();
                PasswordText.Clear();
            }
            if (System.Text.RegularExpressions.Regex.IsMatch(IDText.Text, "[^0-9]"))
            {
                MessageBox.Show("Please enter only numbers");
                IDText.Clear();
            }
            else if (IDText.Text != "" && FullNameText.Text != "" && UserNameText.Text != "" && PasswordText.Text != "")
            {
                ReadingInTextFile();
                if (inuse == false)
                {
                    List <EmployeeDetails> Listofemployees = new List <EmployeeDetails>();
                    Listofemployees.Add(new EmployeeDetails(int.Parse(IDText.Text), FullNameText.Text, UserNameText.Text, PasswordText.Text));

                    MessageBox.Show("Employee has been added to the system");
                    using (StreamWriter tw = new StreamWriter("Savedlist.txt", true))
                    {
                        foreach (EmployeeDetails s in Listofemployees)
                        {
                            tw.WriteLine(s.ID + "," + s.FullName + "," + s.UserName + "," + s.Password);
                            tw.Close();
                        }
                    }
                    Clear();
                }
            }
            inuse = false;
        }
示例#14
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            mainTableView.RegisterClassForCellReuse(typeof(UITableViewCell), "cells");
            mainTableView.Source          = new TableViewSource(Ids);
            mainTableView.TableFooterView = new UIView(CoreGraphics.CGRect.Empty);
            mainTableView.ReloadData();

            DeleteIdButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                string curr_id = IDText.Text;
                if (!Ids.Contains(curr_id))
                {
                    var alert = UIAlertController.Create("Error", "This ID wasn't added", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                    PresentViewController(alert, true, null);
                    IDText.ResignFirstResponder();
                }
                else
                {
                    Ids.Remove(curr_id);
                    GamesNews.RemoveAll(x => x.appid == curr_id);
                    IDText.Text = "";
                    IDText.ResignFirstResponder();
                    string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ids.json");
                    var    js       = JsonConvert.SerializeObject(Ids);
                    File.WriteAllText(fileName, js);
                }
                mainTableView.Source = new TableViewSource(Ids);
                mainTableView.ReloadData();
            };

            AddNewIdButton.TouchUpInside += async(object sender, EventArgs e) =>
            {
                string curr_id = IDText.Text;
                if (Ids.Contains(curr_id))
                {
                    var alert = UIAlertController.Create("Error", "Already added", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                    PresentViewController(alert, true, null);
                    IDText.ResignFirstResponder();
                    return;
                }

                if (curr_id == "")
                {
                    var alert = UIAlertController.Create("Error", "ID couldn't be empty", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                    PresentViewController(alert, true, null);
                    IDText.ResignFirstResponder();
                    return;
                }

                int num;
                if (!int.TryParse(curr_id, out num))
                {
                    var alert = UIAlertController.Create("Error", "ID have to be an integer", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                    PresentViewController(alert, true, null);
                    IDText.ResignFirstResponder();
                    return;
                }

                var content = await FeedLoader.LoadData(IDText.Text);

                if (content == "internalError")
                {
                    var alert = UIAlertController.Create("Error", "Check your internet connection. ID wasn't added", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                    PresentViewController(alert, true, null);
                    return;
                }

                if (content == "{}")
                {
                    var alert = UIAlertController.Create("Error", "Game with this ID doesn't exist according to API", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                    PresentViewController(alert, true, null);
                }
                else
                {
                    Ids.Add(IDText.Text);
                    IDText.Text = "";
                    IDText.ResignFirstResponder();
                    GamesNews = await FeedLoader.LoadFeed(Ids);

                    string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ids.json");
                    var    js       = JsonConvert.SerializeObject(Ids);
                    File.WriteAllText(fileName, js);
                    mainTableView.Source = new TableViewSource(Ids);
                    mainTableView.ReloadData();
                }
            };
        }