Exemplo n.º 1
0
        //private void btnUpdate_Click(object sender, EventArgs e)
        //{
        //    //if (txtCusType.Text == string.Empty)
        //    //{
        //    //    MessageBox.Show("Please Enter An Customer Type For Update");
        //    //    return;
        //    //}
        //    if (MessageBox.Show("Are You Sure To Update Customer Type?", "Update Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
        //    {
        //        CusTypeBL obJCus = new CusTypeBL()
        //        {
        //            CusTypeID = Convert.ToInt32(txtCusTypeID.Text),
        //            CusType = txtCusType.Text
        //        };
        //        obJCus.Update();
        //        MessageBox.Show("Update Successful");
        //        LoadData();


        //    }
        //    else
        //    {
        //        MessageBox.Show("Customer Type Not Updated");
        //    }
        //    ClearGroup();
        //}

        //private void btnDelete_Click(object sender, EventArgs e)
        //{
        //     string message = "Are you sure to Delete Customer Type " + txtCusType.Text + "?";

        //     if (MessageBox.Show(message, "Delete Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
        //     {

        //         CusTypeBL objCus = new CusTypeBL()
        //         {
        //              CusTypeID=Convert.ToInt32(txtCusTypeID.Text)
        //         };
        //         objCus.Delete();
        //         MessageBox.Show("Record Deleted Successfull");


        //    }
        //    else
        //    {
        //        MessageBox.Show("Record Not Deleted ");
        //    }
        //    LoadData();
        //     }

        private void LoadData()
        {
            CusTypeBL objCus = new CusTypeBL();
            var       dt     = objCus.Select();

            dgvCusType.Columns.Clear();
            if (dt.Count > 0 && dt != null)
            {
                DataGridViewImageColumn edit = new DataGridViewImageColumn();
                edit.Image       = Properties.Resources.edit;
                edit.ImageLayout = DataGridViewImageCellLayout.Zoom;
                edit.HeaderText  = "Edit";

                DataGridViewImageColumn delete = new DataGridViewImageColumn();
                delete.Image       = Properties.Resources.delete;
                delete.ImageLayout = DataGridViewImageCellLayout.Zoom;
                delete.HeaderText  = "Delete";
                edit.Width         = delete.Width = 40;
                dgvCusType.Columns.Add(edit);
                dgvCusType.Columns.Add(delete);
                dgvCusType.DataSource          = dt;
                dgvCusType.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            }
            else
            {
                MessageBox.Show("No Record Found");
            }
        }
Exemplo n.º 2
0
        private void LoadCusType()
        {
            CusTypeBL objCus            = new CusTypeBL();
            List <tbl_CustomerTypes> dt = objCus.Select();

            txtCusType.DataSource         = dt;
            txtCusType.AutoCompleteMode   = AutoCompleteMode.Suggest;
            txtCusType.AutoCompleteSource = AutoCompleteSource.ListItems;
            txtCusType.DisplayMember      = "CusType";
            txtCusType.ValueMember        = "CusTypeID";
        }
Exemplo n.º 3
0
        private void btnAddnew_Click(object sender, EventArgs e)
        {
            CusTypeBL objCus = new CusTypeBL();
            var       dt     = objCus.Addnew();

            if (dt.Rows.Count > 0)
            {
                txtCusTypeID.Text = Convert.ToString(dt.Rows[0]["CusTypeID"]);

                FormEnable();
                txtCusType.Focus();
                btnAddnew.Enabled = false;
            }
        }
Exemplo n.º 4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         CusTypeBL objCus = new CusTypeBL()
         {
             CusType = txtCusType.Text
         };
         objCus.Save();
         MessageBox.Show("Record Saved Successful");
         LoadData();
         btnAddnew.Enabled = true;
         ClearGroup();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
 }
Exemplo n.º 5
0
 private void txtSearch_TextChanged(object sender, EventArgs e)
 {
     if (txtSearch.Text == string.Empty)
     {
         LoadData();
     }
     else
     {
         CusTypeBL objTest = new  CusTypeBL()
         {
             CusType = txtSearch.Text.ToLower()
         };
         var dt = objTest.SearchByName();
         AutoCompleteStringCollection coll = new AutoCompleteStringCollection();
         txtSearch.AutoCompleteMode         = AutoCompleteMode.Suggest;
         txtSearch.AutoCompleteSource       = AutoCompleteSource.CustomSource;
         txtSearch.AutoCompleteCustomSource = coll;
         if (dt.Count > 0)
         {
             dgvCusType.DataSource = dt;
         }
     }
 }
Exemplo n.º 6
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (txtSearch.Text == string.Empty)
            {
                MessageBox.Show("Please Enter An ID");
            }
            else if (!string.IsNullOrEmpty(txtSearch.Text))
            {
                CusTypeBL obJCus = new CusTypeBL()
                {
                    CusTypeID = Convert.ToInt32(txtSearch.Text)
                };
                var dt = obJCus.Search();
                if (dt != null)
                {
                    dgvCusType.DataSource = dt;
                }
            }

            else
            {
                MessageBox.Show("Record Not Found");
            }
        }