private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { try { if (lvwDCList.SelectedItems != null && lvwDCList.SelectedItems.Count != 0) { if (!IsList) { if (objUIRights.DeleteRight) { DialogResult dr = new DialogResult(); dr = MessageBox.Show("Do You Really Want to Delete Record ?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.Yes) { ReturnableDC objDC = new ReturnableDC(); objDC = ReturnableDCManager.GetItem(Convert.ToInt32(lvwDCList.SelectedItems[0].Name)); ReturnableDCManager.Delete(objDC); lvwDCList.Items.Remove(lvwDCList.SelectedItems[0]); } } else { throw new Exception("Not Authorised."); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void modifyToolStripMenuItem_Click(object sender, EventArgs e) { try { if (lvwDCList.SelectedItems != null && lvwDCList.SelectedItems.Count != 0) { if (IsList) { btnOk_Click(sender, e); } else { if (objUIRights.ModifyRight) { ReturnableDC objDC; frmReturnableDCProp objFrmProp; objDC = ReturnableDCManager.GetItem(Convert.ToInt32(lvwDCList.SelectedItems[0].Name), true); objFrmProp = new frmReturnableDCProp(objDC, currentUser); objFrmProp.MdiParent = this.MdiParent; objFrmProp.Entry_DataChanged += new frmReturnableDCProp.DCUpdateHandler(Entry_DataChanged); objFrmProp.Show(); } else { throw new Exception("Not Authorised."); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void FillcboVehicles() { string[] objList = ReturnableDCManager.GetVehicles(); if (objList != null) { foreach (string str in objList) { cboVehicle.Items.Add(str); } } }
private void FillcboParty() { string[] PartyList = ReturnableDCManager.GetPartys(); cboParty.Items.Clear(); if (PartyList != null) { foreach (string str in PartyList) { cboParty.Items.Add(str); } } }
private void btnSave_Click(object sender, EventArgs e) { bool flgApplyEdit; try { flgApplyEdit = ReturnableDCManager.Save(objDC, currentUser); if (flgApplyEdit == true) { // instance the event args and pass it value DCUpdateEventArgs args = new DCUpdateEventArgs(objDC.DBID, objDC.EntryNo, objDC.EntryDate, objDC.PartyName, objDC.EntryType, objDC.DCNo, objDC.DCDate, objDC.VOutDate, objDC.VInDate); // raise event wtth updated //EmployeeUpdated(this, args); if (Entry_DataChanged != null) { if (this.IsNew) { Entry_DataChanged(this, args, DataEventType.INSERT_EVENT); } else { Entry_DataChanged(this, args, DataEventType.UPDATE_EVENT); } } this.Close(); } else { MessageBox.Show("Record not Saved.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (ApplicationException ex) { MessageBox.Show(ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void FillList() { ReturnableDCList objList = new ReturnableDCList(); objList = ReturnableDCManager.GetList(cboEntryType.Text, dtpDate.Value, flgShowAll); lvwDCList.Items.Clear(); if (objList != null) { foreach (ReturnableDC objDC in objList) { ListViewItem objLvwItem = new ListViewItem(); objLvwItem.Name = Convert.ToString(objDC.DBID); objLvwItem.Text = Convert.ToString(objDC.EntryNo); objLvwItem.SubItems.Add(objDC.EntryDate.ToShortDateString()); objLvwItem.SubItems.Add(objDC.PartyName); objLvwItem.SubItems.Add(objDC.EntryType); objLvwItem.SubItems.Add(objDC.DCNo); objLvwItem.SubItems.Add(objDC.DCDate.ToShortDateString()); if (objDC.EntryType == "INWARD" & objDC.VOutDate != DateTime.MinValue) { objLvwItem.ForeColor = Color.Red; } //else // objLvwItem.ForeColor = Color.Blue; if (objDC.EntryType == "OUTWARD" & objDC.VInDate != DateTime.MinValue) { objLvwItem.ForeColor = Color.Red; } //else // objLvwItem.ForeColor = Color.Blue; lvwDCList.Items.Add(objLvwItem); } } }