private void btnDelete_Click(object sender, EventArgs e) { if (txtOId.Text != string.Empty) { if ((MessageBox.Show("Do u really want to delete this item. ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) == DialogResult.Yes) { CParty oParty = Getformdata(); CPartyBO oPartyBO = new CPartyBO(); CResult oresult = new CResult(); oresult = oPartyBO.Delete(oParty); if (oresult.IsSuccess == true) { if (oresult.Data.ToString() == "0") { MessageBox.Show("Deletion Not Possible", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadParty(); ClearControl(groupBox4); } else { MessageBox.Show("Deleted Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadParty(); ClearControl(groupBox4); } } else { MessageBox.Show("Error" + oresult.ErrMsg + ""); } } } }
private void LoadParty() { lvParty.Items.Clear(); CPartyBO oPartyBO = new CPartyBO(); CResult oresult = new CResult(); List <CParty> oPartyList = new List <CParty>(); oresult = oPartyBO.ReadAll(); if (oresult.IsSuccess) { if (oresult.Data != null) { int i = 0; foreach (CParty oParty in oresult.Data as ArrayList) { ListViewItem lvi = new ListViewItem(); lvi.Text = (i + 1).ToString("00"); lvi.SubItems.Add(oParty.Party_Name); lvi.SubItems.Add(oParty.Party_Mobile); lvi.SubItems.Add(oParty.Party_Country); lvi.Tag = oParty; lvParty.Items.Add(lvi); i++; } } } else { MessageBox.Show(oresult.ErrMsg); } }
private void BindPartyName() { CPartyBO oPartyBO = new CPartyBO(); CResult oResult = oPartyBO.ReadAll(); if (oResult.IsSuccess) { ArrayList oPartyList = oResult.Data as ArrayList; ddlPartyName.DataSource = oPartyList; ddlPartyName.DisplayMember = "Party_Name"; ddlPartyName.ValueMember = "Party_OID"; ddlPartyName.SelectedIndex = 0; } else { ddlPartyName.Text = "Error In Loading"; } }
private void btnUpdate_Click(object sender, EventArgs e) { CParty oParty = lvParty.FocusedItem.Tag as CParty; CPartyBO oPartyBO = new CPartyBO(); CResult oResult = new CResult(); if (validatedata()) { oResult = oPartyBO.Update(GetFormData(oParty)); if (oResult.IsSuccess) { MessageBox.Show("Update successfully"); } else { MessageBox.Show("Not Updated" + oResult.ErrMsg + ""); } ClearControl(groupBox4); LoadParty(); } }
private void btnSave_Click(object sender, EventArgs e) { CParty oParty = new CParty(); CPartyBO oPartyBO = new CPartyBO(); CResult oResult = new CResult(); if (validatedata()) { oResult = oPartyBO.Create(GetFormData(oParty)); if (oResult.IsSuccess) { MessageBox.Show("Saved successfully"); } else { //MessageBox.Show(oResult.ErrMsg); MessageBox.Show("Not Saved" + oResult.ErrMsg + ""); } ClearControl(groupBox4); LoadParty(); } }