Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtAddress.Text))
            {
                MessageBox.Show("please enter your address");
            }

            else
            {
                if (string.IsNullOrEmpty(txtTXTPHONE.Text) && string.IsNullOrEmpty(txtMOBILE.Text))
                {
                    MessageBox.Show("please enter your phone no and mo no");
                }
                //else
                //{
                //    if (!this.txtEMAILADDRESS.Text.Contains('@') || !this.txtEMAILADDRESS.Text.Contains('.'))
                //    {
                //        MessageBox.Show("Please select your correct email address");
                //    }
                //    else
                //    {
                //        if (!this.txtWEBSITE.Text.Contains('@') || !this.txtWEBSITE.Text.Contains('.') || !this.txtWEBSITE.Text.Contains('/'))
                //        {
                //            MessageBox.Show("plese select your corect website");
                //        }
                else
                {
                    if (updateCounter == 0)
                    {
                        string saveCommand1 = "insert into CustomerDetails values ('" + txtCustCode.Text + "','" + txtName.Text + "','" + txtCompnyName.Text + "','" + txtAddress.Text + "','" + txtCity.Text + "','" + txtState.Text + "','" + txtZIP.Text + "','" + txtCustCountry.Text + "','" + txtEMAILADDRESS.Text + "','" + txtWEBSITE.Text + "','" + txtTXTPHONE.Text + "', '" + txtMOBILE.Text + "','" + txtFAX.Text + "','" + txtDESCRIPTION.Text + "','" + txtPanno.Text + "','" + txttanno.Text + "','" + txtothers.Text + "')";

                        string saveCommand2 = "insert into CustomerAccountDetails values ('" + txtCustCode.Text + "','" + txtCustCode.Text + "','" + txtOPENINGBALANCE.Text + "','" + txtCURRENTBALANCE.Text + "')";

                        int insertedRows = dbMainClass.saveDetails(saveCommand1, saveCommand2);
                        if (insertedRows > 0)
                        {
                            btnList.Enabled = true;
                            txtName.Focus();
                            MessageBox.Show("Details Saved Successfully");
                        }
                        else
                        {
                            MessageBox.Show("Details Not Saved Successfully");
                        }
                    }


                    else if (updateCounter == 1)
                    {
                        string updateCommand1 = "update  CustomerDetails  set Custid='" + txtCustCode.Text + "', CustAddress='" + txtAddress.Text + "',CustPhone='" + txtTXTPHONE.Text + "', CustMobile='" + txtMOBILE.Text + "',PanNO='" + txtPanno.Text + "',TanNo='" + txttanno.Text + "',Others='" + txtothers.Text + "', CustName='" + txtName.Text + "', CustCompName= '" + txtCompnyName.Text + "',CustCity='" + txtCity.Text + "',CustState='" + txtState.Text + "',CustZip='" + txtZIP.Text + "',CustCountry='" + txtCustCountry.Text + "',CustEmail='" + txtEMAILADDRESS.Text + "',CustWebAddress='" + txtWEBSITE.Text + "',CustFax='" + txtFAX.Text + "',CustDesc='" + txtDESCRIPTION.Text + "' where Custid='" + txtCustCode.Text + "'";
                        string updateCommand2 = "update   CustomerAccountDetails set  CustOpeningBalance='" + txtOPENINGBALANCE.Text + "',CustCurrentBalance='" + txtCURRENTBALANCE.Text + "' where Custid='" + txtCustCode.Text + "'";

                        int updatedRows = dbMainClass.updateDetails(updateCommand1, updateCommand2);
                        if (updatedRows > 0)
                        {
                            txtName.Focus();
                            MessageBox.Show("Details Updated Successfully");
                        }
                        else
                        {
                            MessageBox.Show("Details Can not updated");
                        }
                        updateCounter = 0;
                    }
                    makeblank();
                    blank1();
                    string Id = dbMainClass.getUniqueID("CUSTOMER");
                    txtCustCode.Text = Id;
                }
            }
        }
Пример #2
0
        /// <summary>
        ///   To Save Details
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnVenderSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtVenderName.Text))
            {
                MessageBox.Show("please Enter the name");
            }
            else
            {
                if (string.IsNullOrEmpty(txtCompanyName.Text))
                {
                    MessageBox.Show("please Enter the Company name");
                }
                else
                {
                    if (string.IsNullOrEmpty(txtVenderAddress.Text))
                    {
                        MessageBox.Show("please Enter the Address");
                    }
                    else
                    {
                        //if (string.IsNullOrEmpty(txtVenderPhone.Text) && string.IsNullOrEmpty(txtVenderMobile.Text))
                        //{
                        //    MessageBox.Show("please Enter the  Mobile No. ya Phone No.");
                        //}
                        //else
                        //{
                        //    if (!this.txtVenderEmailAddress.Text.Contains('@') || !this.txtVenderEmailAddress.Text.Contains('.'))
                        //    {
                        //        MessageBox.Show("Please Enter the Correct Email Address");
                        //    }
                        //    else
                        //    {
                        //if (!this.txtVenderWebSite.Text.Contains('@') || !this.txtVenderWebSite.Text.Contains('.') || !this.txtVenderWebSite.Text.Contains("http://"))
                        //{
                        //    MessageBox.Show("Please Enter the Correct Web Site Address");
                        ////}
                        //else
                        //{

                        if (updateCounter == 0)
                        {
                            string saveCommand1 = "insert into VendorDetails values ('" + txtVenderCode.Text + "','" + txtVenderName.Text + "','" + txtCompanyName.Text + "','" + txtVenderAddress.Text + "','" + txtVenderCity.Text + "','" + txtVenderState.Text + "','" + txtVenderZip.Text + "','" + txtVenderCountry.Text + "','" + txtVenderEmailAddress.Text + "','" + txtVenderWebSite.Text + "','" + txtVenderPhone.Text + "', '" + txtVenderMobile.Text + "','" + txtVenderFax.Text + "','" + txtVenderDesc.Text + "','" + txtPanNo.Text + "','" + txtTinNo.Text + "','" + txtOther.Text + "')";

                            string saveCommand2 = "insert into VendorAccountDetails values ('" + txtVenderCode.Text + "','" + txtVenderCode.Text + "','" + txtVenderOpeningBal.Text + "','" + txtVenderCurrentBal.Text + "')";

                            int insertedRows = dbMainClass.saveDetails(saveCommand1, saveCommand2);
                            if (insertedRows > 0)
                            {
                                btnVenderList.Enabled = true;
                                MessageBox.Show("Details Saved Successfully");
                                txtVenderName.Focus();
                            }
                            else
                            {
                                MessageBox.Show("Details Not Saved Successfully");
                            }
                        }

                        else if (updateCounter == 1)
                        {
                            string updateCommand1 = "update  VendorDetails  set  vName='" + txtVenderName.Text + "', vCompName= '" + txtCompanyName.Text + "',vAddress='" + txtVenderAddress.Text + "',vCity='" + txtVenderCity.Text + "',vState='" + txtVenderState.Text + "',vZip='" + txtVenderZip.Text + "',vCountry='" + txtVenderCountry.Text + "',vEmail='" + txtVenderEmailAddress.Text + "',vWebAddress='" + txtVenderWebSite.Text + "',vPhone='" + txtVenderPhone.Text + "', vMobile='" + txtVenderMobile.Text + "',vFax='" + txtVenderFax.Text + "',vPanNo='" + txtPanNo.Text + "',vTinNo='" + txtTinNo.Text + "',vDesc='" + txtVenderDesc.Text + "',vOther='" + txtOther.Text + "'  where venderid='" + txtVenderCode.Text + "'";
                            string updateCommand2 = "update   VendorAccountDetails set vOpeningBalance='" + txtVenderOpeningBal.Text + "',vCurrentBalance='" + txtVenderCurrentBal.Text + "' where venderId='" + txtVenderCode.Text + "'";

                            int updatedRows = dbMainClass.updateDetails(updateCommand1, updateCommand2);
                            if (updatedRows > 0)
                            {
                                txtVenderName.Focus();
                                MessageBox.Show("Details Updated Successfully");
                            }
                            else
                            {
                                MessageBox.Show("Details Can not updated");
                            }
                            updateCounter = 0;
                        }
                        makeBlank();
                        Enabled2();
                        string Id = dbMainClass.getUniqueID("VENDOR");
                        txtVenderCode.Text = Id;
                        //}
                        //}
                    }
                }
            }
        }