private void frmAddItemType_Load(object sender, EventArgs e) { try { DataSet ds = UoMDAL.GetUoMsDataSet(); cmbUoM.DataSource = ds.Tables[0]; cmbUoM.DisplayMember = "UoM_Name"; cmbUoM.ValueMember = "ID"; DataSet dsVendor = VendorDAL.getVendorsDs(); DataRow defaultRow = dsVendor.Tables[0].NewRow(); defaultRow["ID"] = "0"; defaultRow["Name"] = "------ Select Vendor ------"; dsVendor.Tables[0].Rows.InsertAt(defaultRow, 0); cmbVendor.DataSource = dsVendor.Tables[0]; cmbVendor.DisplayMember = "Name"; cmbVendor.ValueMember = "ID"; } catch (IndexOutOfRangeException ex) { MessageBox.Show(this, "Add atleast one item type to add purchase", "Error:Add new stock", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } catch (Exception ex) { MessageBox.Show(this, ex.Message.ToString(), "Error:Add New Stock", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void frmItemManagement_Load(object sender, EventArgs e) { try { ItemDAL dal = new ItemDAL(); _itemsDs = dal.getItemsPresentationDs(); DataView dv = _itemsDs.Tables[0].DefaultView; dv.RowFilter = "Is_Deleted = 0"; dgItem.DataSource = dv; DataSet uomDs = UoMDAL.GetUoMsDataSet(); DataRow defaultRowUnit = uomDs.Tables[0].NewRow(); defaultRowUnit["ID"] = "0"; defaultRowUnit["UoM_Name"] = "-------------- Select Unit ----------------"; uomDs.Tables[0].Rows.InsertAt(defaultRowUnit, 0); cmbUoM.DataSource = uomDs.Tables[0]; cmbUoM.DisplayMember = "UoM_Name"; cmbUoM.ValueMember = "ID"; DataSet venDs = VendorDAL.getVendorsDs(); DataRow defaultRow = venDs.Tables[0].NewRow(); defaultRow["ID"] = "0"; defaultRow["Name"] = "-------------- Select Vendor -------------------"; venDs.Tables[0].Rows.InsertAt(defaultRow, 0); cmbVendor.DataSource = venDs.Tables[0]; cmbVendor.DisplayMember = "Name"; cmbVendor.ValueMember = "ID"; btAddNewItem.Focus(); _itemAdapter = dal.getItemAdapter(); this.dgItem.SelectionChanged += new EventHandler(dgItems_SelectionChanged); isDirty = false; } catch (IndexOutOfRangeException ex) { MessageBox.Show(this, "Add atleast one item type to add purchase", "Error:Add new stock", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } catch (Exception ex) { MessageBox.Show(this, ex.StackTrace.ToString(), "Error:Add New Stock", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }