Esempio n. 1
0
 private void Btn_Cancel_Click(object sender, RoutedEventArgs e)
 {
     getTableData();
     TBid.Clear();
     TBname.Clear();
     TBPass.Clear();
     Region.SelectedItem = new KeyValuePair <int, string>(0, "请选择仓库");
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var button = (Button)sender;

            if (TBname.Text != "" && TBtitle.Text != "" && TBpostText.Text != "" && LsentName1.Content == "")
            {
                DateTime currentDate = DateTime.Now;
                LsentName1.Content = TBname.Text;
                TBname.Clear();
                LsentTitle1.Content = TBtitle.Text;
                TBtitle.Clear();
                TblockSentPost1.Text = TBpostText.Text;
                TBpostText.Clear();
                Ldate1.Visibility = Visibility.Visible;
                Ldate1.Content    = currentDate;

                LnameWarning.Visibility  = Visibility.Hidden;
                LtitleWarning.Visibility = Visibility.Hidden;
                BdeletePost1.Visibility  = Visibility.Visible;
            }
            else if (TBname.Text != "" && TBtitle.Text != "" && TBpostText.Text != "" && LsentName1.Content != "")
            {
                if (LsentName2.Content != "")
                {
                    MessageBox.Show("This will overwrite the last post! Do you want to continue?");
                }
                DateTime currentDate = DateTime.Now;
                LsentName2.Content = TBname.Text;
                TBname.Clear();
                LsentTitle2.Content = TBtitle.Text;
                TBtitle.Clear();
                TblockSentPost2.Text = TBpostText.Text;
                TBpostText.Clear();
                Ldate2.Visibility = Visibility.Visible;
                Ldate2.Content    = currentDate;

                LnameWarning.Visibility  = Visibility.Hidden;
                LtitleWarning.Visibility = Visibility.Hidden;
                BdeletePost1.Visibility  = Visibility.Visible;
                BdeletePost2.Visibility  = Visibility.Visible;
            }

            else if (TBname.Text == "")
            {
                LnameWarning.Visibility = Visibility.Visible;
            }
            else if (TBtitle.Text == "")
            {
                LtitleWarning.Visibility = Visibility.Visible;
            }
        }
Esempio n. 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     peoples.Add(new Person(TBname.Text, TBsurname.Text, int.Parse(label4.Text), g, TBcity.Text, reasons));
     TBname.Clear();
     TBsurname.Clear();
     label4.Text = "0";
     TBcity.Clear();
     checkBox1.Checked    = false;
     checkBox2.Checked    = false;
     checkBox3.Checked    = false;
     radioButton1.Checked = false;
     radioButton2.Checked = false;
     listBox1.Items.Clear();
     foreach (var item in peoples)
     {
         listBox1.Items.Add(item.Name + " " + item.SurName);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 写入数据库
        /// </summary>
        public void inputDB()
        {
            try
            {
                string sql = "";
                string id_staff, name_staff, pass_staff, role_staff, Region_staff;

                DataSet ds = new DataSet();

                Region_staff = Region.SelectedValue.ToString();
                if (Region_staff.Equals("0"))
                {
                    MessageBox.Show("请选择所在网点");
                    return;
                }
                //Id = BaseClass.getInsertMaxId("T_Weight", "Id", "000001");

                if (TBid.Text != "")
                {
                    id_staff = TBid.Text;
                }
                else
                {
                    id_staff = "";
                    MessageBox.Show("请输入员工编号");
                    return;
                }

                if (TBname.Text != "")
                {
                    name_staff = TBname.Text;
                }
                else
                {
                    name_staff = "";
                    MessageBox.Show("请输入员工姓名");
                    return;
                }


                if (TBPass.Text != "")
                {
                    pass_staff = TBPass.Text;
                }
                else
                {
                    pass_staff = "";
                    MessageBox.Show("请输入密码");
                    return;
                }

                sql = "select * from t_staff as t1 where t1.id_staff = '" + id_staff + "'";
                ds  = DBClass.execQuery(sql);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    sql = "update T_Staff set name_staff = '{1}', pass_staff = '{2}', " +
                          "role_staff = '{3}', region_staff = '{4}' " +
                          "where id_staff = '{0}'";
                }
                else
                {
                    sql = "insert into T_Staff " +
                          "(id_staff, name_staff, pass_staff, role_staff, Region_staff) " +
                          "values ('{0}','{1}','{2}','{3}','{4}')";
                }

                role_staff = "1";

                sql = string.Format(sql, id_staff, name_staff, pass_staff, role_staff, Region_staff);
                int n = DBClass.execUpdate(sql);
                if (n > 0)
                {
                    MessageBox.Show("保存成功!");
                    TBid.Clear();
                    TBname.Clear();
                    TBPass.Clear();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("操作失败。请重试" + e.Message);
            }
        }
Esempio n. 5
0
        public void addMarker(int index, List <PointLatLng> points)
        {
            if (CBobjects.SelectedIndex < 0)
            {
                MessageBox.Show("choose a marker");
            }

            MapObjectBase mapObject = null;

            switch (index)
            {
            case 0:
            {
                if (points.Count < 3)
                {
                    MessageBox.Show("select three points");
                    return;
                }
                mapObject = new Area(TBname.Text, points);
                TBname.Clear();
                break;
            }

            case 1:
            {
                if (points.Count < 1)
                {
                    MessageBox.Show("select one point");
                    return;
                }
                mapObject = new Car(TBname.Text, points.Last());
                TBname.Clear();
                break;
            }

            case 2:
            {
                if (points.Count < 1)
                {
                    MessageBox.Show("select one point");
                    return;
                }
                mapObject = new Human(TBname.Text, points.Last());
                TBname.Clear();
                break;
            }

            case 3:
            {
                if (points.Count < 1)
                {
                    MessageBox.Show("select one point");
                    return;
                }
                mapObject = new Location(TBname.Text, points.Last());
                TBname.Clear();
                break;
            }

            case 4:
            {
                if (points.Count < 2)
                {
                    MessageBox.Show("select two points");
                    return;
                }
                mapObject = new Route(TBname.Text, points);
                TBname.Clear();
                break;
            }
            }
            if (mapObject != null)
            {
                mapObjects.Add(mapObject);
                Map.Markers.Add(mapObject.getMarker());
            }
        }