示例#1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int             selectedrowindex = bunifuCustomDataGrid1.SelectedCells[0].RowIndex;
            DataGridViewRow selectedRow      = bunifuCustomDataGrid1.Rows[selectedrowindex];
            String          id = Convert.ToString(selectedRow.Cells[0].Value);

            if (Validator.IsValidName(tbxRepairTypeName.Text))
            {
                if (Validator.IsValidCharges(tbxCharges.Text))
                {
                    Repair rp = new Repair();
                    rp.RepairTypeId      = id;
                    rp.RepairTypeName    = tbxRepairTypeName.Text;
                    rp.RepairTypeDesc    = tbxDesc.Text;
                    rp.RepairTypeCharges = tbxCharges.Text;

                    if (rc.updateRepairType(rp))
                    {
                        MyDialog.Show("Success...!", "Repair Type Updated");
                        BindGridView(null);
                        resetFields();
                    }
                    else
                    {
                        MyDialog.Show("Error...!", "Fail to update repair type");
                    }
                }
                else
                {
                    MyDialog.Show("Error...!", "Invalid charges");
                }
            }
            else
            {
                MyDialog.Show("Error...!", "Repair Type Name is invalid");
            }
        }