/// <summary> /// Handles sorting for the list box /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstReceivingUnit_ColumnClick(object sender, ColumnClickEventArgs e) { ReceivingUnits recUnit = new ReceivingUnits(); recUnit.LoadAll(); if (_sortIssueLoca == "ASC") { recUnit.Sort = "Name ASC"; _sortIssueLoca = "DESC"; } else { recUnit.Sort = "Name DESC"; _sortIssueLoca = "ASC"; } PopulateReceivingUnit(recUnit); }
/// <summary> /// Saves the receiving unit related information /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnIssueSave_Click(object sender, EventArgs e) { if(txtReceivingUnit.Text=="") { XtraMessageBox.Show("Please enter the name of the receiving unit", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ReceivingUnits recUnit = new ReceivingUnits(); if (_receivingUnitId != 0) { recUnit.LoadByPrimaryKey(_receivingUnitId); recUnit.Name = txtReceivingUnit.Text; recUnit.Phone = txtPhone.Text; recUnit.Description = memoEdit1.Text; recUnit.IsActive = chkIsDispensaryActive.Checked; recUnit.Min = Convert.ToDouble(cboDUMin.SelectedValue); recUnit.Max = Convert.ToDouble(cboDUMax.SelectedValue); recUnit.Woreda = txtWoreda.Text; recUnit.Region = txtRegion.Text; recUnit.Zone = txtZone.Text; recUnit.FacilityType = txtType.Text; recUnit.Save(); //recUnit.Save(); XtraMessageBox.Show("Issue Location Record Updated.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { recUnit.AddNew(); recUnit.Name = txtReceivingUnit.Text; recUnit.Phone = txtPhone.Text; recUnit.Description = memoEdit1.Text; recUnit.IsActive = chkIsDispensaryActive.Checked; recUnit.Min = Convert.ToDouble(cboDUMin.SelectedValue); recUnit.Max = Convert.ToDouble(cboDUMax.SelectedValue); recUnit.Woreda = txtWoreda.Text; recUnit.Region = txtRegion.Text; recUnit.Zone = txtZone.Text; recUnit.FacilityType = txtType.Text; recUnit.Save(); recUnit.LoadAll(); PopulateReceivingUnit(recUnit); ResetIssuesLocation(); XtraMessageBox.Show("Issue Location Record Saved.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Load the drop downs and tables /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void HospitalSettings_Load(object sender, EventArgs e) { Supplier sup = new Supplier(); sup.LoadAll(); PopulateSupplier(sup); Stores str = new Stores(); str.LoadAll(); PopulateStores(str); Shelf slf = new Shelf(); DataTable dtSlf = slf.GetShelves(); PopulateShelves(dtSlf.DefaultView); ReceivingUnits recUnit = new ReceivingUnits(); recUnit.LoadAll(); PopulateReceivingUnit(recUnit); DataTable dtdumin = new DataTable(); dtdumin.Columns.Add("Value"); dtdumin.Columns.Add("Month"); object[] objdumin01 = { 0.25, "1 Weeks" }; dtdumin.Rows.Add(objdumin01); object[] objdumin0 = { 0.5, "2 Weeks" }; dtdumin.Rows.Add(objdumin0); object[] objdumin1 = { 0.75, ("3 Weeks") }; dtdumin.Rows.Add(objdumin1); object[] objdumin2 = { 1, (1 + " Month") }; dtdumin.Rows.Add(objdumin2); object[] objdumin3 = { 2, (2 + " Month") }; dtdumin.Rows.Add(objdumin3); cboDUMin.DataSource = dtdumin; DataTable dtdumax = new DataTable(); dtdumax.Columns.Add("Value"); dtdumax.Columns.Add("Month"); object[] objdumax01 = { 0.25, "1 Weeks" }; dtdumax.Rows.Add(objdumax01); object[] objdumax010 = { 0.5, "2 Weeks" }; dtdumax.Rows.Add(objdumax010); object[] objdumax011 = { 0.75, ("3 Weeks") }; dtdumax.Rows.Add(objdumax011); object[] objdumax012 = { 1, (1 + " Month") }; dtdumax.Rows.Add(objdumax012); object[] objdumax013 = { 2, (2 + " Month") }; dtdumax.Rows.Add(objdumax013); cboDUMax.DataSource = dtdumax; }