コード例 #1
0
 private void EMP_ISERT_CANCEL_Click(object sender, EventArgs e)
 {
     NameSet.Clear();
     AgeSet.Value     = 20;
     SalarySet.Value  = 5000;
     PremiumSet.Value = 0;
     PhoneSet.Clear();
     EmailSet.Clear();
     Dep_IdSET.Value = 0;
     label22.Visible = false;
 }
コード例 #2
0
        private async void EMP_INSERT_OK_Click(object sender, EventArgs e)
        {
            if (label22.Visible)
            {
                label22.Visible = false;
            }

            if (!string.IsNullOrEmpty(NameSet.Text) && !string.IsNullOrWhiteSpace(NameSet.Text) &&
                !string.IsNullOrEmpty(PhoneSet.Text) && !string.IsNullOrWhiteSpace(PhoneSet.Text) &&
                !string.IsNullOrEmpty(EmailSet.Text) && !string.IsNullOrWhiteSpace(EmailSet.Text) &&
                Dep_IdSET.Value != 0)
            {
                SqlCommand command = new SqlCommand("INSERT INTO [Employees](Name,Age,Salary,Premium,PhoneNumber,Email,Dep_Id)" +
                                                    "Values(@Name,@Age,@Salary,@Premium,@PhoneNumber,@Email,@Dep_Id)", sqlconnection);

                command.Parameters.AddWithValue("Name", NameSet.Text);
                command.Parameters.AddWithValue("Age", AgeSet.Value);
                command.Parameters.AddWithValue("Salary", SalarySet.Value);
                command.Parameters.AddWithValue("Premium", PremiumSet.Value);
                command.Parameters.AddWithValue("PhoneNumber", PhoneSet.Text);
                command.Parameters.AddWithValue("Email", EmailSet.Text);
                command.Parameters.AddWithValue("Dep_Id", Dep_IdSET.Value);

                await command.ExecuteNonQueryAsync();

                NameSet.Clear();
                AgeSet.Value     = 20;
                SalarySet.Value  = 5000;
                PremiumSet.Value = 0;
                PhoneSet.Clear();
                EmailSet.Clear();
                Dep_IdSET.Value = 0;
            }
            else
            {
                label22.Visible = true;
                label22.Text    = "поля введены не коректно";
            }
        }
コード例 #3
0
ファイル: Phone.cs プロジェクト: davelondon/dontstayin
		public static Phone GetFromUsrK(int UsrK)
		{
			PhoneSet ps = new PhoneSet(new Query(new Q(Phone.Columns.UsrK, UsrK)));
			if (ps.Count != 1)
				return null;

			return ps[0];
		}
コード例 #4
0
ファイル: Phone.cs プロジェクト: davelondon/dontstayin
		public static Phone GetFromExtention(string Extention)
		{
			PhoneSet ps = new PhoneSet(new Query(new Q(Phone.Columns.Extention, Extention)));
			if (ps.Count != 1)
				return null;

			return ps[0];
		}
コード例 #5
0
ファイル: Phone.cs プロジェクト: davelondon/dontstayin
		public static Phone GetFromMac(string Mac)
		{
			PhoneSet ps = new PhoneSet(new Query(new Q(Phone.Columns.Mac, Mac)));
			if (ps.Count != 1)
				return null;

			return ps[0];
		}