private void VRFForm_Load(object sender, EventArgs e) { var type = new BLL.Type(); var alltypes = type.GetAllCategory(); categorybindingSource.DataSource = alltypes.DefaultView; var program = new Programs(); var programs = program.GetSubPrograms(); cboProgram.Properties.DataSource = programs; cboProgram.Properties.DisplayMember = "Name"; cboProgram.Properties.ValueMember = "ID"; PopulateTheMonthCombos(cboFromMonth); PopulateTheMonthCombos(cboToMonth); PopulateTheYearCombo(cboFromYear); PopulateTheYearCombo(cboToYear); var stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; PopulateVRFs(); WindowVisibility(false); var prog = new Programs(); prog.GetSubPrograms(); cboProgram.Properties.DataSource = prog.DefaultView; cboProgram.EditValue = 1000; }
private void GeneralReport_Load(object sender, EventArgs e) { Stores stor = new Stores(); stor.GetActiveStores(); DataTable dtStor = stor.DefaultView.ToTable(); DataRow rowStore = dtStor.NewRow(); rowStore["ID"] = "0"; rowStore["StoreName"] = "All Stores"; dtStor.Rows.InsertAt(rowStore, 0); cboStores.Properties.DataSource = dtStor; if (stor.RowCount > 1) { cboStores.ItemIndex = 0; } var type = new BLL.Type(); DataTable alltypes = type.GetAllCategory(); DataRow row = alltypes.NewRow(); row["ID"] = "0"; row["Name"] = "All Categories"; alltypes.Rows.InsertAt(row, 0); lkCategory.Properties.DataSource = alltypes; lkCategory.Properties.DisplayMember = "Name"; lkCategory.Properties.ValueMember = "ID"; lkCategory.ItemIndex = 0; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; dtCurrent = ConvertDate.DateConverter(dtDate.Text); curMont = dtCurrent.Month; curYear = dtCurrent.Year; //cboYear.Properties.DataSource = Items.AllYears(); //cboYear.EditValue = dtCurrent.Year; DataView dv = Items.AllFiscalYears().DefaultView; dv.Sort = "year desc"; DataTable sortedDT = dv.ToTable(); cboYear.Properties.DataSource = sortedDT; cboYear.ItemIndex = 0; if (cboYear.Properties.Columns.Count > 0) { cboYear.Properties.Columns[0].Alignment = DevExpress.Utils.HorzAlignment.Near; } }
/// <summary> /// Load the dropdowns and the category tree /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ManageItems_Load(object sender, EventArgs e) { PopulateCatTree(_selectedType); var type = new BLL.Type(); var alltypes = type.GetAllCategory(); DataRow row = alltypes.NewRow(); row["ID"] = "0"; row["Name"] = "All"; alltypes.Rows.InsertAt(row, 0); lkCategory.Properties.DataSource = alltypes; lkCategory.Properties.DisplayMember = "Name"; lkCategory.Properties.ValueMember = "ID"; lkCategory.ItemIndex = 0; var stor = new Stores(); stor.GetActiveStores(); cboStores.DataSource = stor.DefaultView; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; _dtCur = ConvertDate.DateConverter(dtDate.Text); dtTo.Value = DateTime.Now; // int yearFrom = ((_dtCur.Month == 11 && _dtCur.Month == 12) ? _dtCur.Year : _dtCur.Year - 1 ); int currYear = (EthiopianDate.EthiopianDate.Now.Month < 11) ? EthiopianDate.EthiopianDate.Now.Year - 1 : EthiopianDate.EthiopianDate.Now.Year; dtFrom.Value = EthiopianDate.EthiopianDate.EthiopianToGregorian(String.Format("{0}/{1}/{2}", 1, 11, currYear)); dtFrom.CustomFormat = "MM/dd/yyyy"; DateTime dt1 = ConvertDate.DateConverter(dtFrom.Text); dtTo.CustomFormat = "MM/dd/yyyy"; DateTime dt2 = ConvertDate.DateConverter(dtTo.Text); //string dRange = "From " + dtFrom.Text + " to " + dtTo.Text; //layoutControlGroup3.Text = "Cost Report " + dRange; if (dt1 == dt2) { dt1 = ((dt1.Month == 11 || dt1.Month == 12) ? new DateTime(dt1.Year, 11, 1) : new DateTime(dt1.Year - 1, 11, 1)); //dRange = "For Year " + dt1.Year.ToString(); } this._isReady = true; txtFromDate.Text = dt1.ToShortDateString(); PopulateItemList(); }
/// <summary> /// Populates user related info /// </summary> private void PopulateUser() { User us = new User(); DataTable dtUser = us.GetUsers(); int count = 1; int col = 0; lstUsers.Items.Clear(); foreach (DataRow dv in dtUser.Rows) { string[] str = { count.ToString(), dv["FullName"].ToString(), dv["Mobile"].ToString(), dv["UserName"].ToString(), dv["Type"].ToString() }; ListViewItem lst = new ListViewItem(str) { Tag = dv["ID"] }; if (col != 0) { lst.BackColor = Color.FromArgb(233, 247, 248); col = 0; } else { col++; } lstUsers.Items.Add(lst); count++; } UserType uType = new UserType(); uType.LoadAll(); cboUserType.DataSource = uType.DefaultView; BLL.Type comUser = new BLL.Type(); comUser.LoadAll(); cbCommodity.Properties.DataSource = comUser.DefaultView; cbCommodity.Properties.DisplayMember = "Name"; cbCommodity.Properties.ValueMember = "ID"; Stores storeUser = new Stores(); storeUser.LoadAll(); cbStore.Properties.DataSource = storeUser.DefaultView; cbStore.Properties.DisplayMember = "StoreName"; cbStore.Properties.ValueMember = "ID"; }
/// <summary> /// Populates lookups and tables /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SystemSetting_Load(object sender, EventArgs e) { PopulatePrograms(); // TAb IIN BLL.INN innInfo = new INN(); innInfo.LoadAll(); innInfo.Sort = "IIN"; PopulateINN(innInfo); // TAb Category BLL.Type type = new BLL.Type(); type.LoadAll(); lkCategory.DataSource = type.DefaultView; PopulateCategoryTree(); //unit section BLL.Unit uni = new Unit(); uni.LoadAll(); lstUnits.DataSource = uni.DefaultView; // dosage form section DosageForm doForm = new DosageForm(); doForm.LoadAll(); doForm.Sort = "Form"; PopulateDosageForm(doForm); //receiving status section // PopulateManufacturer(); //disposal reasons DisposalReasons reason = new DisposalReasons(); reason.LoadAll(); reason.Sort = "Reason"; PopulateDisposalReason(reason); //location regions zones and woredas PopulateLocationTree(); PopulateSupplyCatTree(); PopulateBalance(); }
private void GeneralReport_Load(object sender, EventArgs e) { var type = new BLL.Type(); DataTable alltypes = type.GetAllCategory(); DataRow row = alltypes.NewRow(); row["ID"] = "0"; row["Name"] = "All"; alltypes.Rows.InsertAt(row, 0); lkCategory.Properties.DataSource = alltypes; lkCategory.Properties.DisplayMember = "Name"; lkCategory.Properties.ValueMember = "ID"; lkCategory.ItemIndex = 0; Stores stor = new Stores(); stor.GetActiveStores(); DataTable dtStor = stor.DefaultView.ToTable(); DataRow rowStore = dtStor.NewRow(); rowStore["ID"] = "0"; rowStore["StoreName"] = "All"; dtStor.Rows.InsertAt(rowStore, 0); cboStores.Properties.DataSource = dtStor; cboStores.ItemIndex = 0; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; dtCurrent = ConvertDate.DateConverter(dtDate.Text); curMont = dtCurrent.Month; curYear = dtCurrent.Year; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; _dtCur = ConvertDate.DateConverter(dtDate.Text); cboYear.Properties.DataSource = Items.AllYears(); cboYear.EditValue = curYear; }
private void WastageRate_Load(object sender, EventArgs e) { DataView dv = Items.AllFiscalYears().DefaultView; dv.Sort = "year desc"; DataTable sortedDT = dv.ToTable(); cboYear.Properties.DataSource = sortedDT; cboYearto.Properties.DataSource = sortedDT; cboYearto.ItemIndex = 0; var type = new BLL.Type(); DataTable alltypes = type.GetAllCategory(); DataRow row = alltypes.NewRow(); row["ID"] = "0"; row["Name"] = "All Categories"; alltypes.Rows.InsertAt(row, 0); lkCategory.Properties.DataSource = alltypes; lkCategory.Properties.DisplayMember = "Name"; lkCategory.Properties.ValueMember = "ID"; lkCategory.ItemIndex = 0; Stores stor = new Stores(); stor.GetActiveStores(); DataTable dtStor = stor.DefaultView.ToTable(); DataRow rowStore = dtStor.NewRow(); rowStore["ID"] = "0"; rowStore["StoreName"] = "All Stores"; dtStor.Rows.InsertAt(rowStore, 0); cboStores.Properties.DataSource = dtStor; cboStores.ItemIndex = 0; generateChart(); }
/// <summary> /// Update the form based on the selected user /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstUsers_SelectedIndexChanged(object sender, EventArgs e) { if (lstUsers.SelectedItems.Count > 0) { int selected = Convert.ToInt32(lstUsers.SelectedItems[0].Tag); User us = new User(); us.LoadByPrimaryKey(selected); txtFullName.Text = us.FullName; txtAddress.Text = us.Address; txtMobile.Text = us.Mobile; ckActive.Checked = us.Active; cboUserType.SelectedValue = us.UserType.ToString(); _userId = us.ID; grpLoginInfo.Enabled = false; BLL.Type ucType = new BLL.Type(); ucType.LoadAll(); UserCommodityType usc = new UserCommodityType(); DataTable comUser = usc.GetUserCommodityType(_userId); cbCommodity.Properties.DataSource = ucType.DefaultView.ToTable(); cbCommodity.Properties.DisplayMember = "Name"; cbCommodity.Properties.ValueMember = "ID"; string[] arr = new string[comUser.DefaultView.ToTable().Rows.Count]; int index = 0; foreach (DataRow dr in comUser.DefaultView.ToTable().Rows) { arr[index] = Convert.ToString(dr["ID"]); index++; } char separator = cbCommodity.Properties.SeparatorChar; string result = string.Empty; foreach (var element in arr) { result += element + separator; } cbCommodity.SetEditValue(result); UserStore ust = new UserStore(); DataTable storeUser = ust.GetUserStore(_userId); Stores stuser = new Stores(); stuser.LoadAll(); cbStore.Properties.DataSource = stuser.DefaultView; cbStore.Properties.DisplayMember = "StoreName"; cbStore.Properties.ValueMember = "ID"; string[] arrst = new string[storeUser.DefaultView.ToTable().Rows.Count]; int rowindex = 0; foreach (DataRow drs in storeUser.DefaultView.ToTable().Rows) { arrst[rowindex] = Convert.ToString(drs["ID"]); rowindex++; } char separatorst = cbStore.Properties.SeparatorChar; string resultst = string.Empty; foreach (var element in arrst) { resultst += element + separatorst; } cbStore.SetEditValue(resultst); } }
private void RRFForm_Load(object sender, EventArgs e) { btnAutoPushToPFSA.Enabled = false; btnSendEmergencyOrder.Enabled = false; var unitcolumn = ((GridView) gridItemsChoice.MainView).Columns[2]; var unitcolumn1 = ((GridView) gridItemsChoice.MainView).Columns[13]; layoutControlItem18.Visibility =LayoutVisibility.Never; switch (VisibilitySetting.HandleUnits) { case 3: unitcolumn.Visible = false; unitcolumn1.Visible = true; break; case 2: unitcolumn.Visible = false; unitcolumn1.Visible = true; break; default: unitcolumn.Visible = true; unitcolumn1.Visible = false; break; } var unit = new ItemUnit(); var units = unit.GetAllUnits(); unitsBindingSource.DataSource = units.DefaultView; var type = new BLL.Type(); var alltypes = type.GetAllCategory(); categorybindingSource.DataSource = alltypes.DefaultView; var program = new Programs(); var programs = program.GetSubPrograms(); cboProgram.Properties.DataSource = programs; cboProgram.Properties.DisplayMember = "Name"; cboProgram.Properties.ValueMember = "ID"; var orderstatus = new PharmInventory.HelperClasses.OrderStatus(); orderbindingSource.DataSource = orderstatus.GetRRFOrders(); lkorderstatus.Properties.DataSource = orderbindingSource; lkorderstatus.Properties.ValueMember = "RecordId"; lkorderstatus.Properties.DisplayMember = "Name"; PopulateTheMonthCombos(cboFromMonth); PopulateTheMonthCombos(cboToMonth); PopulateTheYearCombo(cboFromYear); PopulateTheYearCombo(cboToYear); var stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; PopulateRRFs(); WindowVisibility(false); EnableDisableStatusCheck(); var prog = new Programs(); prog.GetSubPrograms(); cboProgram.Properties.DataSource = prog.DefaultView; cboProgram.EditValue = 1000; }
/// <summary> /// Load the dropdowns and the category tree /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ManageItems_Load(object sender, EventArgs e) { PopulateCatTree(_selectedType); var type = new BLL.Type(); var alltypes = type.GetAllCategory(); lkCategory.Properties.DataSource = alltypes; lkCategory.Properties.DisplayMember = "Name"; lkCategory.Properties.ValueMember = "ID"; lkCategory.ItemIndex = 0; var stor = new Stores(); stor.GetActiveStores(); cboStores.DataSource = stor.DefaultView; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; _dtCur = ConvertDate.DateConverter(dtDate.Text); dtTo.Value = DateTime.Now; // int yearFrom = ((_dtCur.Month == 11 && _dtCur.Month == 12) ? _dtCur.Year : _dtCur.Year - 1 ); int currYear = (EthiopianDate.EthiopianDate.Now.Month < 11) ? EthiopianDate.EthiopianDate.Now.Year - 1 : EthiopianDate.EthiopianDate.Now.Year; dtFrom.Value = EthiopianDate.EthiopianDate.EthiopianToGregorian(String.Format("{0}/{1}/{2}", 1, 11, currYear)); dtFrom.CustomFormat = "MM/dd/yyyy"; DateTime dt1 = ConvertDate.DateConverter(dtFrom.Text); dtTo.CustomFormat = "MM/dd/yyyy"; DateTime dt2 = ConvertDate.DateConverter(dtTo.Text); //string dRange = "From " + dtFrom.Text + " to " + dtTo.Text; //layoutControlGroup3.Text = "Cost Report " + dRange; if (dt1 == dt2) { dt1 = ((dt1.Month == 11 || dt1.Month == 12) ? new DateTime(dt1.Year, 11, 1) : new DateTime(dt1.Year - 1, 11, 1)); //dRange = "For Year " + dt1.Year.ToString(); } this._isReady = true; txtFromDate.Text = dt1.ToShortDateString(); PopulateItemList(); }
private void GeneralReport_Load(object sender, EventArgs e) { //TabPage z = tabControl1.TabPages[2]; //tabControl1.TabPages.Remove(tabControl1.TabPages[2]); Stores stor = new Stores(); DataTable dtStor = stor.GetActiveStores(); DataRow rowStore = dtStor.NewRow(); rowStore["ID"] = "0"; rowStore["StoreName"] = "All"; dtStor.Rows.InsertAt(rowStore, 0); cboStores.DataSource = dtStor; var type = new BLL.Type(); DataTable alltypes = type.GetAllCategory(); DataRow row = alltypes.NewRow(); row["ID"] = "0"; row["Name"] = "All"; alltypes.Rows.InsertAt(row, 0); lkCategory.Properties.DataSource = alltypes; lkCategory.Properties.DisplayMember = "Name"; lkCategory.Properties.ValueMember = "ID"; lkCategory.ItemIndex = 0; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; dtCurrent = ConvertDate.DateConverter(dtDate.Text); curMont = dtCurrent.Month; // (dtCurrent.Month < 11) ? dtCurrent.Month + 2 : ((dtCurrent.Month == 11) ? 1 : 2); curYear = dtCurrent.Year;// (dtCurrent.Month < 11) ? dtCurrent.Year : dtCurrent.Year - 1; var dtyears = Items.AllYears(); cboYear.Properties.DataSource = dtyears; cboYear.EditValue = curYear; var bw = new BackgroundWorker(); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.RunWorkerAsync(); }