コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string user;

            if (txtSupplierName.Text != "" && txtAddress.Text != "" && txtContact1.Text != "" && txtContact2.Text != "" &&
                txtContactPerson.Text != "")
            {
                db   = new db_MiletecDataContext();
                user = Form1.UserID.ToString();
                db.sp_SupplierDetails(user, txtSupplierID.Text, txtSupplierName.Text, txtAddress.Text,
                                      int.Parse(txtContact1.Text), int.Parse(txtContact2.Text), txtContactPerson.Text);
                db.SubmitChanges();
                MessageBox.Show("Successfully Save!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                dgvsupplierdetails.DataSource = clsrepository.displaysupdetails();
                if (dgvsupplierdetails.Rows.Count == 0)
                {
                    btnProceed.Enabled = false;
                }
                else
                {
                    btnProceed.Enabled = true;
                }
            }
            else
            {
                MessageBox.Show("Please fill up everything first!!");
            }
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string user;

            if (txtSupplierName.Text != "Supplier Name" && txtAddress.Text != "Address" && txtContact1.Text != "Contact No.1" && txtContact2.Text != "Contact No.2" &&
                txtContactPerson.Text != "Contact Person")
            {
                db   = new db_MiletecDataContext();
                user = Form1.UserID.ToString();
                db.sp_SupplierDetails(user, txtSupplierID.Text, txtSupplierName.Text, txtAddress.Text,
                                      int.Parse(txtContact1.Text), int.Parse(txtContact2.Text), txtContactPerson.Text);
                db.SubmitChanges();
                MessageBox.Show("Successfully Save!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                GenID(txtSupplierID);
                Display();
                txtSupplierName.Text  = "Supplier Name";
                txtAddress.Text       = "Address";
                txtContact1.Text      = "Contact No.1";
                txtContact2.Text      = "Contact No.2";
                txtContactPerson.Text = "Contact Person";
            }
            else
            {
                MessageBox.Show("Please fill up everything first.", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }