PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/Reports/Util.cs

http://github.com/khaneh/Orders
C# | 153 lines | 126 code | 3 blank | 24 comment | 0 complexity | 2d3a83a24086d3e3172197ed956aa7af MD5 | raw file
  1using System;
  2
  3namespace Reports
  4{
  5	/// <summary>
  6	/// Summary description for Util.
  7	/// </summary>
  8	public class Util
  9	{
 10/*		public Util()
 11		{
 12			//
 13			// TODO: Add constructor logic here
 14			//
 15		}
 16*/
 17		public static string choosePrinter(string IP)
 18		{
 19			//  Don't forget to Change 
 20			//		1- ReportManager.cs
 21			//		2- ReportMaker.cs
 22			//
 23			string PrinterName;
 24			switch(IP)
 25			{
 26				case "192.168.0.5":		// AHOKI	(Orders - Ehsan Jalali)
 27					PrinterName="\\\\AHOKI\\LQ300_O3";
 28					break;
 29				
 30				case "REM 192.168.0.52" :   // Bidaabaadi ( SALE )
 31					//case "192.168.0.111":	// Naseri	(Design4)
 32					//PrinterName="\\\\hasan\\Epson LQ-300 ESC/P 2";
 33					//PrinterName="\\\\192.168.0.6\\LQ300_O1";
 34					PrinterName="\\\\192.168.0.52\\LQ300_O1";
 35					break;
 36				case "192.168.0.8":		// MOHAMMAD	(Orders - Saman)
 37					PrinterName="\\\\mohammad\\LQ300_O2";
 38					break;
 39				case "192.168.0.10":	// Zamanie (Zamanie)
 40					PrinterName="\\\\192.168.0.10\\EpsonLQ-Zamani";
 41					//PrinterName="Oce 3165 Network Copier";
 42					break;
 43				case "192.168.0.22":		// Monfared ( old Naseri )
 44				case "192.168.0.21":		// Farahani ( old Tayefe - lito)
 45				
 46					PrinterName=@"\\offset\LQ300_P1";						
 47					break;
 48				case "192.168.0.117":		// Salimi
 49				case "192.168.0.18":	// Behnaz Ashraf
 50				case "192.168.0.55":	// Hossein Shahrabir
 51				case "192.168.0.6":		// Hasan	
 52				case "192.168.0.118":	// KOOFI	
 53					PrinterName=@"\\192.168.0.118\XEROX_3130";
 54					break;
 55				case "192.168.0.39":	// GOLABI	(Cashier - Golabi)
 56					//PrinterName="\\\\GOLABI\\LQ300_C";
 57					PrinterName=@"\\192.168.0.39\LQ300_C";
 58					break;
 59				//case "192.168.0.52":	// FARVARDIN	(Orders - Zargar)
 60				//	PrinterName="\\\\KHORDAD\\LQ300_O4";
 61				//	break;
 62				case "192.168.0.54":	// KHORDAD	(Orders - Saman)
 63					PrinterName="\\\\KHORDAD\\LQ300_O4";
 64					break;
 65				case "192.168.0.61":	// Shahami (Hesabdari)
 66					PrinterName="\\\\192.168.0.61\\LQ_Shahami";
 67					//					PrinterName="Oce 3165 Network Copier";
 68					break;
 69				case "192.168.0.64":		// Dehghan	(Dehghan - Hesabdari)
 70					PrinterName="\\\\192.168.0.64\\LQ300_A1";
 71					break;
 72				case "192.168.0.15":	// CopyShop
 73				case "192.168.0.51":
 74				case "192.168.0.52" :   // Bidaabaadi ( SALE )
 75				case "192.168.0.53":
 76				case "192.168.0.56":
 77				case "192.168.0.112":
 78				case "192.168.0.63":	// masoud babaee (Old Monafred)
 79				case "192.168.0.133":
 80				case "192.168.0.99":	// Server (Just For Testing)
 81				case "127.0.0.1":		// Server (Just For Testing)
 82					//PrinterName="\\\\192.168.0.112\\HP_1320";
 83					PrinterName=@"\\khordad\HP_1320";
 84					break;
 85				case "192.168.0.71":	// Beheshti	(Abbas Abad)
 86				case "192.168.0.72":
 87				case "192.168.0.73":
 88				case "192.168.0.74":
 89				case "192.168.0.75":
 90					PrinterName="\\\\"+IP+"\\Beheshti";
 91					break;
 92				case "192.168.0.94":	// Kid (For Testing)
 93					PrinterName="Oce 3165 Network Copier";
 94					break;
 95				case "192.168.0.89":	// Alix (For kiding)
 96				case "192.168.0.97":	// r (Laptop)
 97//				case "192.168.0.98":	// Mohaghegh (Laptop)
 98				case "192.168.0.62":		// Esterabi
 99					PrinterName="Oce 3165 Network Copier";
100					break;
101				case "192.168.0.206":	// Design6	(Tarrahi - Chalajour)
102					PrinterName="\\\\192.168.0.206\\Tarrahi";
103					break;
104				default:
105					PrinterName="none";
106					break;
107			}
108			return PrinterName;
109		}
110
111		public static string choosePrinter(string IP,string reportName)
112		{
113			string PrinterName;
114			switch(reportName)
115			{
116				case "Receipt.rpt":
117					switch (IP)
118					{
119						case "192.168.0.15":	// CopyShop
120						case "192.168.0.52" :   // Bidaabaadi ( SALE )
121						case "192.168.0.51":
122						case "192.168.0.53":
123						case "192.168.0.56":
124						case "192.168.0.112":
125						case "192.168.0.133":
126							//PrinterName="\\\\192.168.0.112\\XRX_O1";
127							PrinterName=@"\\khordad\HP_1320";
128							break;
129						case "192.168.0.63":		// Monfared	(Monfared - Cashier)
130							PrinterName=@"\\192.168.0.63\LQ300_C";
131
132						break;
133						default:
134							PrinterName=choosePrinter(IP);
135							break;
136					};
137					break;
138				case "InvoicePrintForm.rpt":
139					PrinterName=@"\\192.168.0.63\LQ300_C";
140				break;
141				default:
142					PrinterName=choosePrinter(IP);
143					break;
144			}
145			return PrinterName;
146		}
147
148		public static string sqlSafe(string inpStr)
149		{
150			return inpStr.Replace("'","''");
151		}
152	}
153}