private void updateMaterial()
        {
            //Update data
            uMaterial.material_cat  = cmbCat.Text;
            uMaterial.material_code = txtItemCode.Text;
            uMaterial.material_name = txtItemName.Text;

            if (cbZeroCost.Checked)
            {
                uMaterial.material_zero_cost = 1;
            }
            else
            {
                uMaterial.material_zero_cost = 0;
            }

            bool success = dalMaterial.Update(uMaterial);

            if (success == true)
            {
                //data updated successfully
                //MessageBox.Show("Material successfully updated ");
                updateItem();
                this.Close();
            }
            else
            {
                //failed to update user
                MessageBox.Show("Failed to updated material");
            }
        }
        private bool updateMaterial(string category, string itemCode, string itemName)
        {
            materialBLL uMaterial   = new materialBLL();
            materialDAL dalMaterial = new materialDAL();

            //Update data
            uMaterial.material_cat  = category;
            uMaterial.material_code = itemCode;
            uMaterial.material_name = itemName;

            uMaterial.material_zero_cost = 0;

            bool success = false;

            if (tool.IfMaterialExists(itemCode))
            {
                success = dalMaterial.Update(uMaterial);
            }
            else
            {
                success = dalMaterial.Insert(uMaterial);
            }

            if (success == true)
            {
                //data updated successfully
                //MessageBox.Show("Material successfully updated ");
                updateItem(category, itemCode, itemName);
            }
            else
            {
                //failed to update user
                MessageBox.Show("Failed to updated material");
            }
            return(success);
        }