public ComboBox LoadComboFixedValue(ComboBox cb) { using (GeneralGlobal.GeneralStuff LU = new GeneralStuff()) { LU.ConnectionString = ConnectionString; ArrayList TmpData = new ArrayList(); if (cb.Name == "cbSendItemToPrinter") { TmpData.Add(new LookupValues("Bar", "B")); TmpData.Add(new LookupValues("Display", "D")); TmpData.Add(new LookupValues("Kitchen", "K")); TmpData.Add(new LookupValues("None", "N")); cb.DataSource = TmpData; cb.DisplayMember = "LongName"; cb.ValueMember = "ShortName"; } if (cb.Name == "cbPersonSex") { TmpData.Add(new LookupValues("Female", "F")); TmpData.Add(new LookupValues("Male", "M")); cb.DataSource = TmpData; cb.DisplayMember = "LongName"; cb.ValueMember = "ShortName"; } return(cb); } }
public ComboBox LoadCombo(ComboBox cb, string SQLString) { using (GeneralGlobal.GeneralStuff LU = new GeneralStuff()) { ArrayList TmpData = new ArrayList(); DataTable lu = LU.GetComboData(SQLString); foreach (DataRow row in lu.Rows) { TmpData.Add(new LookupValues(row[0].ToString(), row[1].ToString())); Application.DoEvents(); } if (lu.Rows.Count > 0) { cb.DataSource = TmpData; cb.DisplayMember = "LongName"; cb.ValueMember = "ShortName"; } return(cb); } }
public string GetLastKnownDate() { // Try to get the last known date from the system. // Return the current system date for confirmation if no known date was set previously. // If we find a known date on the system and it is greater than the current system date, // the current system date might have been set to a day in the past. // We need to get the correct date and time for transactions. string CurKey; int TmpYear; int TmpMonth; int TmpDay; //int CurYear; //int CurMonth; //int CurDay; //int KnownDay; //int ThisDay; string DtStr; //int v1; //int v3; //int v4; //int v5; //string vx; //int TmpYr; //int TmpMth; //string TmpKey; using (GeneralGlobal.GeneralStuff GS = new GeneralGlobal.GeneralStuff()) { CurKey = GS.GetKey("Public Key 4"); } if (CurKey.Trim() != "") { TmpDay = Convert.ToInt16(CurKey.Substring(3, 2)) - 51; TmpMonth = (Convert.ToInt16(CurKey.Substring(11, 2)) - 10) / 2; TmpYear = Convert.ToInt16(CurKey.Substring(7, 4)) - 33; switch (TmpMonth) { case 1: DtStr = TmpDay.ToString() + " Jan " + TmpYear.ToString(); break; case 2: DtStr = TmpDay.ToString() + " Feb " + TmpYear.ToString(); break; case 3: DtStr = TmpDay.ToString() + " Mar " + TmpYear.ToString(); break; case 4: DtStr = TmpDay.ToString() + " Apr " + TmpYear.ToString(); break; case 5: DtStr = TmpDay.ToString() + " May " + TmpYear.ToString(); break; case 6: DtStr = TmpDay.ToString() + " Jun " + TmpYear.ToString(); break; case 7: DtStr = TmpDay.ToString() + " Jul " + TmpYear.ToString(); break; case 8: DtStr = TmpDay.ToString() + " Aug " + TmpYear.ToString(); break; case 9: DtStr = TmpDay.ToString() + " Sep " + TmpYear.ToString(); break; case 10: DtStr = TmpDay.ToString() + " Oct " + TmpYear.ToString(); break; case 11: DtStr = TmpDay.ToString() + " Nov " + TmpYear.ToString(); break; case 12: DtStr = TmpDay.ToString() + " Dec " + TmpYear.ToString(); break; default: DtStr = DateTime.Now.ToString(); break; } return(DtStr); } else //Last known date not found { return(DateTime.Now.ToString()); } }