示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool bReturn = false;

            if (txtFirstName.Text != "")
            {
                bReturn = true;
            }
            else
            {
                MessageBox.Show("First Name sould not be empty");
            }

            if (bReturn == true)
            {
                DialogResult dialogResult =
                    MessageBox.Show("Your are trying to Insert record", "Insert", MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.Yes)
                {
                    bReturn = true;
                }
                else if (dialogResult == DialogResult.No)
                {
                    bReturn = false;
                }
            }
            if (bReturn == true)
            {
                //string strQuery =
                //                    "INSERT INTO "
                //                    + m_strTableName
                //                    + "("
                //                    + m_strFirstName + ","
                //                    + m_strMiddleName + ","
                //                    + m_strLastName + ","
                //                    + m_strAddress + ","
                //                    + m_strPhone
                //                    + ") VALUES("
                //                    + "'" + txtFirstName.Text + "', "
                //                    + "'" + txtMiddleName.Text + "', "
                //                    + "'" + txtLastName.Text + "', "
                //                    + "'" + txtAddress.Text + "', "
                //                    + "'" + txtPhoneNo.Text + "'"
                //                    + ")";

                string strQuery = SingletonSonar.Instance.CustomerInsertQuery(txtFirstName.Text, txtMiddleName.Text, txtLastName.Text,
                                                                              txtAddress.Text, txtPhoneNo.Text);

                bReturn = dbConnect.Insert(strQuery);
                if (bReturn == true)
                {
                    MessageBox.Show("Record Inserted");
                    ClearData();
                    DisplayData();
                }
            }
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool bReturn = false;

            if (txtFirstName.Text != "")
            {
                bReturn = true;
            }
            else
            {
                MessageBox.Show("First Name sould not be empty");
            }

            if (bReturn == true)
            {
                DialogResult dialogResult =
                    MessageBox.Show("Your are trying to Insert record", "Insert", MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.Yes)
                {
                    bReturn = true;
                }
                else if (dialogResult == DialogResult.No)
                {
                    bReturn = false;
                }
            }
            if (bReturn == true)
            {
                string strQuery = SingletonSonar.Instance.EmployeeInsertQuery(txtCode.Text, txtFirstName.Text, txtMiddleName.Text, txtLastName.Text,
                                                                              txtAddress.Text, txtPhoneNo.Text);

                bReturn = dbConnect.Insert(strQuery);
                if (bReturn == true)
                {
                    MessageBox.Show("Record Inserted");
                    ClearData();
                    DisplayData();
                }
            }
        }
示例#3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool bReturn = false;

            if (txtName.Text != "")
            {
                bReturn = true;
            }
            else
            {
                MessageBox.Show("Name sould not be empty");
            }

            if (bReturn == true)
            {
                DialogResult dialogResult =
                    MessageBox.Show("Your are trying to Insert record", "Insert", MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.Yes)
                {
                    bReturn = true;
                }
                else if (dialogResult == DialogResult.No)
                {
                    bReturn = false;
                }
            }
            if (bReturn == true)
            {
                //string strTableCategory = "category";

                //string strQueryID =
                //    " SELECT "
                //    + m_strID
                //    + " FROM  "
                //    + strTableCategory
                //    + " WHERE "
                //    + " 1 = 1 "
                //    + " AND " + strTableCategory + "." + m_strType + " like '%" + cmbCategory.Text + "%'"
                //    ;
                string strQueryID = SingletonSonar.Instance.ProductCategorySelectQuery(cmbCategory.Text);

                string strDataValue;
                strDataValue = dbConnect.GetDataValue(strQueryID, m_strID);
                int nID = Convert.ToInt32(strDataValue);

                //string strQuery =
                //    "INSERT INTO "
                //    + m_strTableName
                //    + "("
                //    + m_strName + ","
                //    + m_strDetails + ","
                //    + m_strCategoryID
                //    + ") VALUES("
                //    + "'" + txtName.Text + "', "
                //    + "'" + txtDetails.Text + "', "
                //    + nID
                //    + ")";

                string strQuery = SingletonSonar.Instance.ProductInsertQuery(txtName.Text,
                                                                             txtDetails.Text, nID);

                bReturn = dbConnect.Insert(strQuery);
                if (bReturn == true)
                {
                    MessageBox.Show("Record inserted");
                    ClearData();
                    DisplayData();
                }
            }
        }
示例#4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            bool bReturn = true;

            if (txtFirstName.Text == "")
            {
                bReturn = false;
                MessageBox.Show("First Name sould not be empty");
            }
            if ((m_nCustomerID == 0) || (m_nProductID == 0) || (m_nEmployeeID == 0))
            {
                bReturn = false;
                MessageBox.Show("Customer/Product/Employee is not selected");
            }

            if (bReturn == true)
            {
                DialogResult dialogResult =
                    MessageBox.Show("Your are trying to Insert record", "Insert", MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.No)
                {
                    bReturn = false;
                }
            }
            if (bReturn == true)
            {
                GenerateID();
                InsertOrUpdateInvoice();
                //string strInvoice_ID = "invoice_id";

                //string strQuery =
                //                    "INSERT INTO "
                //                    + m_strOrderTxn
                //                    + "("
                //                    + m_strCustomerID + ","
                //                    + m_strProductID + ","
                //                    + m_strQuantity + ","
                //                    + m_strAmount + ","
                //                    + m_strSGST + ","
                //                    + m_strCGST + ","
                //                    + m_strTotalPrice + ","
                //                    + strInvoice_ID + ","
                //                    + m_strModifiedOn
                //                    + ") VALUES("
                //                    + m_nCustomerID + ", "
                //                    + m_nProductID + ", "
                //                    + txtQuantity.Text + ", "
                //                    + txtCalAmount.Text + ", "
                //                    + txtCGST.Text + ", "
                //                    + txtSGST.Text + ", "
                //                    + txtAmount.Text + ", "
                //                    + m_nInvoiceID + ", "
                //                    + "'" + m_strModifiedOnValue + "'"
                //                    + ")";
                string strQuery = SingletonSonar.Instance.OrderInsertQuery(m_nCustomerID, m_nProductID, m_nEmployeeID, txtQuantity.Text, txtCalAmount.Text,
                                                                           txtCGST.Text, txtSGST.Text, txtAmount.Text, m_nInvoiceID);

                bReturn = dbConnect.Insert(strQuery);
                if (bReturn == true)
                {
                    MessageBox.Show("Record Inserted");
                    ClearData();
                    DisplayData();
                }
            }
        }
示例#5
0
 //Insert button clicked
 private void bInsert_Click(object sender, EventArgs e)
 {
     dbConnect.Insert();
 }