private void ManageItems_Load(object sender, EventArgs e) { lkCommodityTypes.Properties.DataSource = BLL.Type.GetAllTypes(); lkCommodityTypes.ItemIndex = 0; PopulateCatTree(); Stores stor = new Stores(); stor.GetActiveStores(); cboStores.DataSource = stor.DefaultView; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; dtCurrent = ConvertDate.DateConverter(dtDate.Text); Programs prog = new Programs(); DataTable dtProg = new DataTable(); dtProg = prog.GetSubPrograms(); object[] objProg = { 0, "All Programs", "", 0, "" }; dtProg.Rows.Add(objProg); cboSubProgram.DataSource = dtProg; cboSubProgram.SelectedIndex = -1; cboSubProgram.Text = "Select Program"; ReceivingUnits rec = new ReceivingUnits(); DataTable drRec = rec.GetAllApplicableDU(); cboIssuedTo.DataSource = drRec; cboIssuedTo.SelectedIndex = -1; cboIssuedTo.Text = "Select Issue Location"; int month = dtCurrent.Month; int year = ((dtCurrent.Month < 11) ? dtCurrent.Year : dtCurrent.Year + 1); DataTable dtyears = Items.AllYears(); foreach (DataRow drYears in dtyears.Rows) { int yr = Convert.ToInt32(drYears["year"]); cboYear.Items.Add(yr); } bool added = true; for (int x = 0; x < cboYear.Items.Count; x++)//to check if the current year is included or not { if (Convert.ToInt64(cboYear.Items[x]) == year) { added = false; break; } } if (added) { cboYear.Items.Add(year); } cboYear.SelectedItem = year; }
private void ManageItems_Load(object sender, EventArgs e) { PopulateCatTree(SelectedType); lkCommodityTypes.Properties.DataSource = BLL.Type.GetAllTypes(); lkCommodityTypes.ItemIndex = 0; var itemunit = new ItemUnit(); var allunits = itemunit.GetAllUnits(); unitBindingSource.DataSource = allunits.DefaultView; var stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; string[] arr = {"All", "Stock Out", "Below EOP", "Near EOP", "Normal", "Over Stocked"}; cboStatus.Properties.DataSource = arr; DataTable dtMonths = new DataTable(); dtMonths.Columns.Add("Value"); dtMonths.Columns.Add("Month"); dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; dtCur = ConvertDate.DateConverter(dtDate.Text); int currentMont = dtCur.Month; int year = ((currentMont < 11) ? dtCur.Year : dtCur.Year + 1); // this is just a try if (currentMont >= 11) { currentMont -= 11; } var dtyears = Items.AllYears(); cboYear.Properties.DataSource = dtyears; cboYear.EditValue = year; if (cboYear.Properties.Columns.Count > 0) cboYear.Properties.Columns[0].Alignment = DevExpress.Utils.HorzAlignment.Near; var prog = new Programs(); var dtProg = new DataTable(); dtProg = prog.GetSubPrograms(); object[] objProg = { 0, "All Programs", "", 0, "" }; dtProg.Rows.Add(objProg); cboSubProgram.Properties.DataSource = dtProg; cboSubProgram.ItemIndex = -1; cboSubProgram.Text = "Select Program"; var rec = new ReceivingUnits(); var drRec = rec.GetAllApplicableDU(); cboIssuedTo.Properties.DataSource = drRec; cboIssuedTo.ItemIndex = -1; cboIssuedTo.Text = "Select Issue Location"; IsReady = true; var unitcolumn = ((GridView)gridItemsChoice.MainView).Columns[15]; switch (VisibilitySetting.HandleUnits) { case 1: unitcolumn.Visible = false; break; case 2: unitcolumn.Visible = true; break; default: unitcolumn.Visible = true; break; } PopulateGrid(); }
private void ManageItems_Load(object sender, EventArgs e) { ReceivingUnits rec = new ReceivingUnits(); DataTable drRec = rec.GetAllApplicableDU(); cboIssuedTo.Properties.DataSource = drRec; cboIssuedTo.ItemIndex = -1;//.SelectedIndex = -1; cboIssuedTo.Text = @"Select Issue Location"; Stores stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; cboStores.ItemIndex = 0; }
/// <summary> /// Loads the form and loads the lookups and the grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ManageItems_Load(object sender, EventArgs e) { //CALENDAR: PopulateCatTree(_selectedType); lkCommodityTypes.Properties.DataSource = BLL.Type.GetAllTypes(); lkCommodityTypes.ItemIndex = 0; Stores stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; cboStores.EditValue = 0; string[] arr = new string[] {"All", "Stock Out", "Below EOP", "Near EOP", "Normal", "Over Stocked"}; cboIssuedTo.Properties.DataSource = arr; DataTable dtMonths = new DataTable(); dtMonths.Columns.Add("Value"); dtMonths.Columns.Add("Month"); dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; _dtCur = ConvertDate.DateConverter(dtDate.Text); int currentMont = _dtCur.Month; //int year = ((currentMont < 11) ? _dtCur.Year : _dtCur.Year + 1); int year = _dtCur.Year; // this is just a try //if (currentMont >= 11) //{ // currentMont -= 11; //} DataTable dtyears = Items.AllYears(); //if (year == _dtCur.Year + 1) //{ // object[] objYear = { year }; // dtyears.Rows.Add(objYear); //} cboYear.Properties.DataSource = dtyears; cboYear.EditValue = year; if(cboYear.Properties.Columns.Count > 0) cboYear.Properties.Columns[0].Alignment = DevExpress.Utils.HorzAlignment.Near; //Programs prog = new Programs(); //DataTable dtProg = prog.GetSubPrograms(); //object[] objProg = { 0, "All Programs", "", 0, "" }; //dtProg.Rows.Add(objProg); //cboSubProgram.Properties.DataSource = dtProg; //cboSubProgram.ItemIndex = -1; //cboSubProgram.Text = "Select Program"; ReceivingUnits rec = new ReceivingUnits(); DataTable drRec = rec.GetAllApplicableDU(); cboDUnits.Properties.DataSource = drRec; cboDUnits.Properties.DisplayMember = "Name"; cboDUnits.Properties.ValueMember = "ID"; cboDUnits.EditValue = 1; this._isReady = true; PopulateGrid(); }
/// <summary> /// Populate the lookups /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ManageItems_Load(object sender, EventArgs e) { var rec = new ReceivingUnits(); DataTable drRec = rec.GetAllApplicableDU(); cboIssuedTo.Properties.DataSource = drRec; cboIssuedTo.ItemIndex = -1;//.SelectedIndex = -1; cboIssuedTo.Text = @"Select Issue Location"; var itemunit = new ItemUnit(); var units = itemunit.GetAllUnits(); unitbindingSource.DataSource = units.DefaultView; // populate the receiving unit's lookup edit var rus = new ReceivingUnits(); rus.GetActiveDispensaries(); lkEditReceivingUnis.DataSource = rus.DefaultView; var stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; cboStores.ItemIndex = 0; var unitcolumn = ((GridView)gridIssues.MainView).Columns[12]; switch (VisibilitySetting.HandleUnits) { case 1: unitcolumn.Visible = false; break; case 2: unitcolumn.Visible = true; break; default: unitcolumn.Visible = true; break; } try { DataRowView dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.Nodes[0].FirstNode); if (dr == null) return; //lstTransactions.Items.Clear(); IssueDoc iss = new IssueDoc(); DataTable dtRec; if (dr["ParentID"] == DBNull.Value) { EthiopianDate.EthiopianDate ethiopianDate = new EthiopianDate.EthiopianDate(Convert.ToInt32(dr["ID"]), 1, 1); dtRec = iss.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), ethiopianDate.StartOfFiscalYear.ToGregorianDate(), ethiopianDate.EndOfFiscalYear.ToGregorianDate()); string dateString = dr["RefNo"].ToString(); lblIssDate.Text = dateString; } else { //dtRec = iss.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString()); dtRec = iss.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToDateTime(dr["Date"])); lblIssDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy"); } gridIssues.DataSource = dtRec; } catch (Exception ex) { // do nothing } }