private void populate() { Contacts.Service1 ser = new Contacts.Service1(); BindingSource bs = new BindingSource(); bs.DataSource = ser.GetData(myUtill.loginUser.Userid); gvGrp.DataSource = bs; }
private void MyContact_Load(object sender, EventArgs e) { Contacts.Service1 ser = new Contacts.Service1(); BindingSource bs = new BindingSource(); bs.DataSource = ser.GetData(myUtill.loginUser.Userid); cmbCon.ValueMember = "grpId"; cmbCon.DisplayMember = "grpName"; cmbCon.DataSource = bs; }
private void btnDel_Click(object sender, EventArgs e) { gvGrp.AutoGenerateColumns = false; txtId.Enabled = true; bool delGrp; bool delGrpRes; Contacts.Service1 ser = new Contacts.Service1(); ser.DeleteGroup(txtId.Text, out delGrp, out delGrpRes); BindingSource bs = new BindingSource(); bs.DataSource = ser.GetData(myUtill.loginUser.Userid); gvGrp.DataSource = bs; lblmsg.Text = "deleted successfully"; }
private void btnUpdate_Click(object sender, EventArgs e) { gvGrp.AutoGenerateColumns = false; txtId.Enabled = true; bool sgrp = false; bool rgrp = false; Contacts.Service1 ser = new Contacts.Service1(); string grp = ser.grpCreator(myUtill.loginUser.Userid); ser.UpdateGroup(txtId.Text, txtGrp.Text, grp, out sgrp, out rgrp); BindingSource bs = new BindingSource(); bs.DataSource = ser.GetData(myUtill.loginUser.Userid); gvGrp.DataSource = bs; lblmsg.Text = "Successfully Updated "; }
private void btnAdd_Click(object sender, EventArgs e) { gvGrp.AutoGenerateColumns = false; bool addResult; bool addGrp; string _CurUserId = myUtill.loginUser.Userid; Contacts.Service1 ser = new Contacts.Service1(); string grp = ser.grpCreator(myUtill.loginUser.Userid); ser.AddGroup(txtGrp.Text, ref _CurUserId, grp, out addResult, out addGrp); if (addResult == true) { lblmsg.Text = "Group Added"; } else { lblmsg.Text = "Adding Failed !"; } BindingSource bs = new BindingSource(); bs.DataSource = ser.GetData(myUtill.loginUser.Userid); gvGrp.DataSource = bs; //populate(); int _r = 0; foreach (DataGridViewRow gv in gvGrp.Rows) { _r++; string s = gv.Cells[2].Value.ToString(); Contacts.Service1 se = new Contacts.Service1(); string g = se.grpCreator(s); gv.Cells[2].Value = g; try { gvGrp.Rows[_r].Cells[2].Value = g; } catch (Exception ex) { } } }