public override string ToString() { string temp = FName.Replace("\"", ""); if (Quantity != 0) { temp = temp + " [" + Quantity + "g]"; } return(temp); }
public static void LoadContent(ContentManager Content) { Sprites = new Dictionary <string, Texture2D>(); foreach (var FName in Directory.GetFiles("Content/Sprites")) { if (FName.Contains(".xnb") || FName.Contains(".ase")) { continue; } var FixedFName = FName.Replace(".png", "").Replace(".jpg", "").Replace(".gif", ""); FixedFName = FixedFName.Replace("Content/", ""); Sprites.Add( FixedFName.Replace("Sprites\\", ""), Content.Load <Texture2D>(FixedFName)); } Font = Content.Load <SpriteFont>("Courier New"); }
public static void LoadContent(ContentManager Content) { Rand = new Random(); Sprites = new Dictionary <string, Texture2D>(); foreach (var FName in Directory.GetFiles("Content/Sprites")) { if (FName.Contains(".xnb") || FName.Contains(".ase")) { continue; } var FixedFName = FName.Replace(".png", "").Replace(".jpg", "").Replace(".gif", ""); FixedFName = FixedFName.Replace("Content/", ""); Sprites.Add( FixedFName.Replace("Sprites\\", "").Replace("Sprites/", ""), Content.Load <Texture2D>(FixedFName)); } Sounds = new Dictionary <string, SoundEffect>(); foreach (var FName in Directory.GetFiles("Content/Sounds")) { if (!FName.Contains(".xnb")) { continue; } var FixedFName = FName.Replace(".xnb", ""); FixedFName = FixedFName.Replace("Content/", ""); Sounds.Add( FixedFName.Replace("Sounds\\", "").Replace("Sounds/", ""), Content.Load <SoundEffect>(FixedFName)); } }
}// end of StandardPrintData private static void PekinPrintData() {// Pekin's data is not in the order it needs to print. // That's why it has it's own print method. string filler = " 000000000000000000000000000 00000000000000 0000000 H000000100 00000000000000 0000000 0000000000 "; int fillerlength = filler.Length; if (string.IsNullOrEmpty(TermDate)) { TermDate = " "; } object locker = new object(); //FldValue = FormatSpaces("", "R", 3);//Title FldValue += FormatSpaces("PRXPEK", "R", 9); //? FldValue += FormatSpaces("006", "R", 15); //? FldValue += FormatSpaces(GroupCode.Replace("?", ""), "R", 15); // GroupCode FldValue += FormatSpaces(UniqID.Replace("?", ""), "R", 18); //UniqID FldValue += FormatSpaces(SequenceNo + " ", "R", 3); //Sequence Number FldValue += FormatSpaces("1" + LName.Replace("?", ""), "R", 26); //LName FldValue += FormatSpaces(FName.Replace("?", ""), "R", 15); //FName FldValue += FormatSpaces(MidIni.Replace("?", ""), "R", 1); // Middle Initial FldValue += FormatSpaces(Gender.Replace("?", ""), "R", 1); //Gender FldValue += FormatSpaces(DOB + "0", "R", 9); //DOB FldValue += FormatSpaces(" 1Y A00032773", "R", 30); // No idea what any of this is. FldValue += FormatSpaces(Regex.Replace(Addr1, "[?]", ""), "R", 25); //Addr1 FldValue += FormatSpaces(Regex.Replace(Addr2, "[?]", ""), "R", 15); //Addr2 FldValue += FormatSpaces(Regex.Replace(City, "[?]", ""), "R", 20); //City FldValue += FormatSpaces(Regex.Replace(State, "[?]", ""), "R", 2); //State FldValue += FormatSpaces(Zip.Replace("?", ""), "R", 11); //Zip FldValue += FormatSpaces("USA ", "R", 4); //USA? FldValue += FormatSpaces("0000000000 ", "R", 11); //Supposed to be home phone. FldValue += FormatSpaces("0A00032773 ", "R", 19); //Don't know what this is. FldValue += FormatSpaces("00000000000000", "R", 14); //Don't know what this is. FldValue += FormatSpaces(EffDate, "R", 7); //EffDate FldValue += FormatSpaces(TermDate, "R", 7); //TermDate FldValue += FormatSpaces(filler, "R", 323); //TermDate // FldValue += FormatSpaces(SSN.Replace("?", ""), "R", 9);//SSN // FldValue += FormatHPSZip(Zip.Replace("?", ""), "R", 9);//Zip //else // FldValue += FormatSpaces(Zip.Replace("?", ""), "R", 5);//Zip //if (!HPS && !PEK) // FldValue += FormatSpaces(Zip4.Replace("?", ""), "R", 4);//Zip4 //FldValue += FormatSpaces(HomePhone, "R", 10);//Homephone //FldValue += FormatSpaces(" ", "R", 10);// worksphone //FldValue += FormatSpaces(" ", "R", 2);// Coverage //if (HPS) // FldValue += FormatSpaces(GroupCode.Replace("?", ""), "R", 12);// GroupCode //else //FldValue += FormatSpaces("HLTHSPRNG", "R", 12);// GroupCode //if (HPS) // FldValue += FormatSpaces(Relation.Replace("?", ""), "R", 1);//Relation //else // FldValue += FormatSpaces(" ", "R", 1);//Relation //FldValue += FormatSpaces(" ", "R", 1);//StudentStatus //if (HPS) // FldValue += FormatSpaces(PaidThruDT, "R", 8);// PaidThruDate for HPS //else // FldValue += FormatSpaces(" ", "R", 4);// Plan for Healthsprings try { if (File.Exists(OutputStream)) { using (StreamWriter sw = File.AppendText(OutputStream)) { if (FName != "" && LName != "") { sw.WriteLine(FldValue); } sw.Flush(); } } else { using (StreamWriter sw = File.CreateText(OutputStream)) { if (FName != "" && LName != "") { sw.WriteLine(FldValue); } sw.Flush(); } } }// end try catch (IOException ex) { MessageBox.Show(ex.Message); } FName = ""; LName = ""; MidIni = ""; UniqID = ""; SSN = ""; Addr1 = ""; Addr2 = ""; City = ""; State = ""; Zip = ""; Zip4 = ""; HomePhone = ""; GroupCode = ""; TermDate = ""; EffDate = ""; PaidThruDT = ""; DOB = ""; Relation = ""; Gender = ""; }// end of PekinPrintData
}// end of PekinFormatDate private static void StandardPrintData() {// This is the standard Careington File Layout //if (BOON) // GroupCode = "BOON-DN11"; if (String.IsNullOrEmpty(GroupCode)) { GroupCode = " "; } object locker = new object(); FldValue = FormatSpaces(" ", "R", 3); //Title FldValue += FormatSpaces(FName.Replace("?", ""), "R", 15); //FName FldValue += FormatSpaces(MidIni.Replace("?", ""), "R", 1); // Middle Initial FldValue += FormatSpaces(LName.Replace("?", ""), "R", 20); //LName FldValue += FormatSpaces(" ", "R", 4); //PostName FldValue += FormatSpaces(UniqID.Replace("?", ""), "R", 12); //UniqID FldValue += FormatSpaces(SequenceNo, "R", 2); //Sequence Number FldValue += FormatSpaces(SSN, "R", 9); //SSN FldValue += FormatSpaces(Regex.Replace(Addr1, "[?]", ""), "R", 33); //Addr1 FldValue += FormatSpaces(Regex.Replace(Addr2, "[?]", ""), "R", 33); //Addr2 FldValue += FormatSpaces(Regex.Replace(City, "[?]", ""), "R", 21); //City FldValue += FormatSpaces(Regex.Replace(State, "[?]", ""), "R", 2); //State FldValue += FormatSpaces(Zip.Replace("?", ""), "R", 9); //Zip FldValue += FormatSpaces(HomePhone, "R", 10); //HomePhone FldValue += FormatSpaces(" ", "R", 10); //WorkPhone FldValue += FormatSpaces(" ", "R", 2); //Coverage FldValue += FormatSpaces(GroupCode.Replace("?", ""), "R", 12); // GroupCode FldValue += FormatSpaces(TermDate, "R", 8); //TermDate FldValue += FormatSpaces(EffDate, "R", 8); //EffDate FldValue += FormatSpaces(DOB, "R", 8); //DOB FldValue += FormatSpaces(Relation, "R", 1); //Relation FldValue += FormatSpaces(" ", "R", 1); //StudentStatus FldValue += FormatSpaces(" ", "R", 4); //Plan FldValue += FormatSpaces(Gender.Replace("?", ""), "R", 1); //Gender try { if (File.Exists(OutputStream)) { using (StreamWriter sw = File.AppendText(OutputStream)) { if (FName != "" && LName != "") { sw.WriteLine(FldValue); } sw.Flush(); } } else { using (StreamWriter sw = File.CreateText(OutputStream)) { if (FName != "" && LName != "") { sw.WriteLine(FldValue); } sw.Flush(); } } }// end try catch (IOException ex) { MessageBox.Show(ex.Message); } FName = ""; LName = ""; MidIni = ""; UniqID = ""; SSN = ""; Addr1 = ""; Addr2 = ""; City = ""; State = ""; Zip = ""; Zip4 = ""; HomePhone = ""; GroupCode = ""; TermDate = ""; EffDate = ""; PaidThruDT = ""; DOB = ""; Relation = ""; Gender = ""; }// end of StandardPrintData
}// end of PekinPrintData private static void PrintData() { object locker = new object(); FldValue = FormatSpaces("", "R", 3); //Title FldValue += FormatSpaces(FName.Replace("?", ""), "R", 15); //FName FldValue += FormatSpaces(MidIni.Replace("?", ""), "R", 1); // Middle Initial FldValue += FormatSpaces(LName.Replace("?", ""), "R", 20); //LName FldValue += FormatSpaces("", "R", 4); // Post Name FldValue += FormatSpaces(UniqID.Replace("?", ""), "R", 12); //UniqID //FldValue += FormatSpaces(" ", "R", 2);//Sequence Number FldValue += FormatSpaces(SequenceNo.Replace("?", "00"), "R", 2); //Sequence Number Healthsprings doesn't have deps. FldValue += FormatSpaces(SSN.Replace("?", ""), "R", 9); //SSN FldValue += FormatSpaces(Regex.Replace(Addr1, "[?]", ""), "R", 33); //Addr1 I can add more special chars, no commas between. FldValue += FormatSpaces(Regex.Replace(Addr2, "[?]", ""), "R", 33); //Addr2 FldValue += FormatSpaces(Regex.Replace(City, "[?]", ""), "R", 21); //City FldValue += FormatSpaces(Regex.Replace(State, "[?]", ""), "R", 2); //State if (HPS) { FldValue += FormatHPSZip(Zip.Replace("?", ""), "R", 9);//Zip } else { FldValue += FormatSpaces(Zip.Replace("?", ""), "R", 5);//Zip } if (!HPS && !PEK) { FldValue += FormatSpaces(Zip4.Replace("?", ""), "R", 4); //Zip4 } FldValue += FormatSpaces(HomePhone, "R", 10); //Homephone FldValue += FormatSpaces(" ", "R", 10); // worksphone FldValue += FormatSpaces(" ", "R", 2); // Coverage if (HPS) { FldValue += FormatSpaces(GroupCode.Replace("?", ""), "R", 12);// GroupCode } else { FldValue += FormatSpaces("HLTHSPRNG", "R", 12); // GroupCode } FldValue += FormatSpaces(TermDate, "R", 8); //TermDate FldValue += FormatSpaces(EffDate, "R", 8); //EffDate FldValue += FormatSpaces(DOB, "R", 8); //DOB if (HPS) { FldValue += FormatSpaces(Relation.Replace("?", ""), "R", 1);//Relation } else { FldValue += FormatSpaces(" ", "R", 1); //Relation } FldValue += FormatSpaces(" ", "R", 1); //StudentStatus if (HPS) { FldValue += FormatSpaces(PaidThruDT, "R", 8);// PaidThruDate for HPS } else { FldValue += FormatSpaces(" ", "R", 4); // Plan for Healthsprings } FldValue += FormatSpaces(Gender.Replace("?", ""), "R", 1); //Gender try { if (File.Exists(OutputStream)) { using (StreamWriter sw = File.AppendText(OutputStream)) { if (LName != "") { sw.WriteLine(FldValue); } sw.Flush(); } } else { using (StreamWriter sw = File.CreateText(OutputStream)) { if (LName != "") { sw.WriteLine(FldValue); } sw.Flush(); } } }// end try catch (IOException ex) { MessageBox.Show(ex.Message); } FName = ""; LName = ""; MidIni = ""; UniqID = ""; SSN = ""; Addr1 = ""; Addr2 = ""; City = ""; State = ""; Zip = " "; Zip4 = " "; HomePhone = ""; GroupCode = ""; TermDate = ""; EffDate = ""; PaidThruDT = ""; DOB = ""; Relation = ""; Gender = ""; }// end of PrintData
public void _dropdownWorker_SelectedIndexChanged(object sender, EventArgs e) { string WorkerID = _dropdownWorker.SelectedValue.ToString(); String Conn = ConfigurationManager.ConnectionStrings["ConnString_WEB_ASSET_DB"].ConnectionString; SqlConnection Connect = new SqlConnection(Conn); Connect.Open(); SqlCommand Cmd = new SqlCommand("SELECT COUNT (*) FROM BADGE WHERE WORKERID=@WorkerID", Connect); Cmd.Parameters.AddWithValue("@WorkerID", WorkerID); Int32 Count = (Int32)Cmd.ExecuteScalar(); Connect.Close(); if (Count == 0) { Connect.Open(); Cmd = new SqlCommand("SELECT WORKERID, WORKERIMAGE, WORKERFNAME, WORKERLNAME, WORKERDOB FROM WORKER WHERE WORKERID=@WorkerID", Connect); Cmd.Parameters.AddWithValue("@WorkerID", WorkerID); SqlDataReader Reader = Cmd.ExecuteReader(); while (Reader.Read()) { _labelID.Text = Reader["WORKERID"].ToString(); _imageWorker.ImageUrl = Reader["WORKERIMAGE"].ToString(); //_txtValidFrom.Text = Reader["BADGEFROM"].ToString(); //_txtValidTo.Text = Reader["BADGETO"].ToString(); string FirstName = Reader["WORKERFNAME"].ToString(); string DateOfBirth = Reader["WORKERDOB"].ToString(); DateTime DOB = Convert.ToDateTime(DateOfBirth); string Birthdate = DOB.Date.ToString("MM/dd/yyyy"); string FName; if (FirstName.Length < 4) { FName = FirstName + "0"; FName = FName.Substring(0, 4); } else { FName = FirstName.Substring(0, 4); } int IdWork = Convert.ToInt32(_labelID.Text); string WorkID = IdWork.ToString("00000"); _txtBadgeCode.Text = WorkID + FName.Replace(" ", string.Empty) + Birthdate.Replace("/", string.Empty); _txtBadgeCode.Text = _txtBadgeCode.Text.ToUpper(); _txtValidFrom.Text = ""; _txtValidTo.Text = ""; _dropdownBadgeStat.ClearSelection(); } Connect.Close(); Cmd.Parameters.Clear(); } else { Connect.Open(); Cmd = new SqlCommand("SELECT BADGE.WORKERID, WORKERIMAGE, WORKERFNAME, WORKERLNAME, WORKERDOB, BADGE.BADGEFROM, BADGE.BADGETO,BADGE.BADGESTAT FROM WORKER JOIN BADGE ON BADGE.WORKERID=WORKER.WORKERID WHERE BADGE.WORKERID=@WorkerID", Connect); Cmd.Parameters.AddWithValue("@WorkerID", WorkerID); SqlDataReader Reader = Cmd.ExecuteReader(); while (Reader.Read()) { _labelID.Text = Reader["WORKERID"].ToString(); _imageWorker.ImageUrl = Reader["WORKERIMAGE"].ToString(); //_txtValidFrom.Text = Reader["BADGEFROM"].ToString(); //_txtValidTo.Text = Reader["BADGETO"].ToString(); DateTime From = Convert.ToDateTime(Reader["BADGEFROM"].ToString()); DateTime To = Convert.ToDateTime(Reader["BADGETO"].ToString()); _txtValidFrom.Text = From.ToString("MM/dd/yyyy"); _txtValidTo.Text = To.ToString("MM/dd/yyyy"); string FirstName = Reader["WORKERFNAME"].ToString(); string DateOfBirth = Reader["WORKERDOB"].ToString(); DateTime DOB = Convert.ToDateTime(DateOfBirth); string Birthdate = DOB.Date.ToString("MM/dd/yyyy"); string FName; if (FirstName.Length < 4) { FName = FirstName + "0"; FName = FName.Substring(0, 4); } else { FName = FirstName.Substring(0, 4); } int IdWork = Convert.ToInt32(_labelID.Text); string WorkID = IdWork.ToString("00000"); _txtBadgeCode.Text = WorkID + FName.Replace(" ", string.Empty) + Birthdate.Replace("/", string.Empty); _txtBadgeCode.Text = _txtBadgeCode.Text.ToUpper(); _dropdownBadgeStat.SelectedValue = Reader["BADGESTAT"].ToString(); } Connect.Close(); Cmd.Parameters.Clear(); } }