示例#1
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            frm_volunteer v = new frm_volunteer();

            v.btnUpdate.Visible   = false;
            v.btnDel.Visible      = false;
            v.btnHistory.Visible  = false;
            v.btnDownload.Visible = false;
            v.ActiveControl       = v.txtRefNo;
            v.txtRefNo.Focus();
            v.ShowDialog();
        }
示例#2
0
        private void dgv_vol_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int    i  = dgv_vol.CurrentRow.Index;
            string id = dgv_vol.Rows[i].Cells["ID"].Value.ToString();

            vol = DBAccess.get_volunteer(id);
            frm_volunteer v = new frm_volunteer();

            if (vol != null)
            {
                try
                {
                    v.Id                    = vol.Vol_id;
                    v.txtRefNo.Text         = vol.Ref_no.ToString();
                    v.txtName.Text          = vol.Vol_name;
                    v.txtOrganization.Text  = vol.Vol_org;
                    v.cmbSex.Text           = vol.Sex;
                    v.dtBday.Value          = vol.Birthdate;
                    v.txtAddressNo.Text     = vol.Add_no;
                    v.txtAddressStreet.Text = vol.Add_st;
                    v.txtAddressCity.Text   = vol.Mun_city;
                    v.cmbRegion.Text        = vol.Region_id;
                    v.cmbProvince.Text      = vol.Prov_id;
                    v.txtEmail.Text         = vol.Email;
                    v.txtMobileNumber.Text  = vol.Mobile_number;

                    v.rtbRemarks.Text = vol.Remarks;

                    if (vol.Vol_picture != "")
                    {
                        try
                        {
                            v.pbVolunteer.Image = Image.FromFile("" + vol.Vol_picture);
                            v.dest = vol.Vol_picture;
                        }
                        catch (FileNotFoundException ex)
                        {
                            MessageBox.Show("Volunteer Picture not found, Upload a new one! ", "Warning!", MessageBoxButtons.OK,
                                            MessageBoxIcon.Warning);
                        }
                    }

                    v.txtArrival.Text   = vol.Date_arrival;
                    v.txtDeparture.Text = vol.Date_departure;
                    v.txtPassport.Text  = vol.Passport_exp;
                    v.txtVisa.Text      = vol.Visa_exp_date;

                    v.txtbday.Text     = vol.Birthdate.ToShortDateString().ToString();
                    v.txtReg.Text      = vol.Region_id;
                    v.txtProv.Text     = vol.Prov_id;
                    v.txtSex.Text      = vol.Sex;
                    v.btnSave.Visible  = false;
                    v.lblError.Visible = false;
                    //  v.txtRefNo.Enabled = false;

                    if (frm_login.UserLvl != 2)
                    {
                        v.btnDel.Enabled = false;
                    }
                    v.ShowDialog();
                }
                catch (IndexOutOfRangeException ex)
                {
                    MessageBox.Show(ex.Message, "Incomplete Data!", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Please click refresh!");
            }
        }