Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1233 lines
31 KiB

  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Web;
  7. using System.Web.SessionState;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12. namespace XReports
  13. {
  14. /// <summary>
  15. /// Summary description for language.
  16. /// </summary>
  17. public class language : System.Web.UI.Page
  18. {
  19. protected System.Web.UI.WebControls.Table tblUploads;
  20. protected System.Web.UI.WebControls.DropDownList ddlLanguages;
  21. protected System.Web.UI.WebControls.Calendar Calendar1;
  22. private void Page_Load(object sender, System.EventArgs e)
  23. {
  24. if(Page.IsPostBack == false)
  25. {
  26. SqlConnection cn = new SqlConnection("Persist Security Info=False;Pwd=ocarpts@2;User ID=ocarpts;Initial Catalog=SnapShot;Data Source=TimRagain06");
  27. SqlConnection cn2 = new SqlConnection("Persist Security Info=False;Pwd=ocarpts@2;User ID=ocarpts;Initial Catalog=SnapShot;Data Source=TimRagain06");
  28. SqlCommand cm = new SqlCommand();
  29. SqlCommand cm2 = new SqlCommand();
  30. SqlDataReader dr;
  31. SqlDataReader dr2;
  32. int rowCtr=0;
  33. int cellCtr=0;
  34. int cellCnt = 5;
  35. int x = 0;
  36. double dbDays = -7;
  37. DateTime dDate = DateTime.Now;
  38. ArrayList strLanguages = new ArrayList();
  39. cn.Open();
  40. cm.CommandType = CommandType.StoredProcedure;
  41. cm.CommandTimeout = 240;
  42. cm.CommandText = "GetOSLanguage";
  43. cm.Parameters.Add("@sDate", System.Data.SqlDbType.VarChar, 12);
  44. dDate = dDate.AddDays(dbDays);
  45. cm.Parameters[0].Value = dDate.ToShortDateString();
  46. cm.Connection = cn;
  47. dr = cm.ExecuteReader();
  48. cn2.Open();
  49. cm2.CommandType = CommandType.StoredProcedure;
  50. cm2.CommandTimeout = 240;
  51. cm2.CommandText = "GetOSLanguageHeaders";
  52. cm2.Parameters.Add("@sDate", System.Data.SqlDbType.VarChar, 12);
  53. cm2.Parameters[0].Value = dDate.ToShortDateString();
  54. cm2.Connection = cn2;
  55. dr2 = cm2.ExecuteReader();
  56. ddlLanguages.DataSource = dr2;
  57. ddlLanguages.Items.Add("ALL");
  58. dr2.Read();
  59. do
  60. {
  61. // ddlLanguages.Items.Add(dr2.GetString(0));
  62. try
  63. {
  64. strLanguages.Add(GetLanguage(System.Convert.ToInt16(dr2.GetString(0), 10)));
  65. }
  66. catch
  67. {
  68. strLanguages.Add("Unknown" + dr2.GetString(0));
  69. }
  70. }while(dr2.Read() == true);
  71. strLanguages.Sort();
  72. for(x = 0; x < strLanguages.Count; x++)
  73. {
  74. // ddlLanguages.Items.Add(dr2.GetString(0));
  75. try
  76. {
  77. ddlLanguages.Items.Add(strLanguages[x].ToString());
  78. }
  79. catch
  80. {
  81. ddlLanguages.Items.Add("Unknown" + strLanguages[x].ToString());
  82. }
  83. }
  84. Calendar1.SelectedDate = dDate;
  85. // dr.Read();
  86. do
  87. {
  88. TableRow tRow = new TableRow();
  89. tblUploads.Rows.Add(tRow);
  90. for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
  91. {
  92. TableCell tCell = new TableCell();
  93. if(rowCtr == 0)
  94. {
  95. switch(cellCtr)
  96. {
  97. case 1:
  98. tCell.Text = "OS Lang";
  99. break;
  100. case 2 :
  101. tCell.Text = "Total";
  102. break;
  103. case 3 :
  104. tCell.Text = "OS Version";
  105. break;
  106. case 4:
  107. tCell.Text = "OS Name";
  108. break;
  109. case 5:
  110. tCell.Text = "Date";
  111. break;
  112. default:
  113. tCell.Text = "";
  114. break;
  115. }
  116. tCell.Style["font-size"] = "small";
  117. tCell.Height = 20;
  118. }
  119. else
  120. {
  121. switch(cellCtr)
  122. {
  123. case 1 :
  124. // tCell.Text = dr.GetString(0).ToString();
  125. try
  126. {
  127. tCell.Text = GetLanguage(System.Convert.ToInt16(dr.GetString(0), 10));
  128. }
  129. catch
  130. {
  131. tCell.Text = "Unknown" + dr.GetString(0);
  132. }
  133. break;
  134. case 2 :
  135. tCell.Text = dr.GetInt32(1).ToString();
  136. break;
  137. case 3 :
  138. tCell.Text = dr.GetString(2).ToString();
  139. break;
  140. case 4 :
  141. tCell.Text = dr.GetString(3).ToString();
  142. break;
  143. case 5 :
  144. if(dr.IsDBNull(4))
  145. {
  146. tCell.Text = "";
  147. }
  148. else
  149. {
  150. tCell.Text = dr.GetDateTime(4).ToShortDateString();
  151. }
  152. break;
  153. default:
  154. tCell.Text = "0";
  155. break;
  156. }
  157. tCell.Style["background-color"] = "white";
  158. tCell.Style["font-size"] = "small-x";
  159. tCell.Style["color"] = "#6487dc";
  160. tCell.Style["font-weight"] = "Bold";
  161. tCell.Height = 20;
  162. }
  163. tCell.Style["font-family"] = "Tahoma";
  164. tRow.Cells.Add(tCell);
  165. }
  166. rowCtr++;
  167. }while(dr.Read() == true);
  168. }
  169. }
  170. #region Web Form Designer generated code
  171. override protected void OnInit(EventArgs e)
  172. {
  173. //
  174. // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  175. //
  176. InitializeComponent();
  177. base.OnInit(e);
  178. }
  179. /// <summary>
  180. /// Required method for Designer support - do not modify
  181. /// the contents of this method with the code editor.
  182. /// </summary>
  183. private void InitializeComponent()
  184. {
  185. this.Calendar1.VisibleMonthChanged += new System.Web.UI.WebControls.MonthChangedEventHandler(this.Calendar1_VisibleMonthChanged);
  186. this.Calendar1.SelectionChanged += new System.EventHandler(this.Calendar1_SelectionChanged);
  187. this.ddlLanguages.SelectedIndexChanged += new System.EventHandler(this.ddlLanguages_SelectedIndexChanged);
  188. this.Load += new System.EventHandler(this.Page_Load);
  189. }
  190. #endregion
  191. private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
  192. {
  193. SqlConnection cn = new SqlConnection("Persist Security Info=False;Pwd=ocarpts@2;User ID=ocarpts;Initial Catalog=SnapShot;Data Source=TimRagain06");
  194. SqlCommand cm = new SqlCommand();
  195. SqlDataReader dr;
  196. DateTime dDate = DateTime.Now;
  197. int rowCtr=0;
  198. int cellCtr=0;
  199. int cellCnt = 5;
  200. int iLang = 0;
  201. string sLang;
  202. TableRow tRow;
  203. TableCell tCell;
  204. cn.Open();
  205. cm.CommandType = CommandType.StoredProcedure;
  206. cm.CommandTimeout = 240;
  207. cm.CommandText = "GetOSLanguage";
  208. cm.Parameters.Add("@sDate", System.Data.SqlDbType.VarChar, 12);
  209. dDate = Calendar1.SelectedDate;
  210. cm.Parameters[0].Value = dDate.ToShortDateString();
  211. cm.Connection = cn;
  212. dr = cm.ExecuteReader();
  213. //dr.Read();
  214. do
  215. {
  216. if(rowCtr > 0)
  217. {
  218. sLang = dr.GetString(0);
  219. if(sLang == "")
  220. {
  221. iLang = 0;
  222. }
  223. else
  224. {
  225. iLang = System.Convert.ToInt16(dr.GetString(0), 10);
  226. }
  227. }
  228. if(rowCtr == 0 || ddlLanguages.SelectedItem.Value == "ALL" || GetLanguage(iLang) == ddlLanguages.SelectedItem.Value)
  229. {
  230. tRow = new TableRow();
  231. // }
  232. for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
  233. {
  234. tblUploads.Rows.Add(tRow);
  235. tCell = new TableCell();
  236. if(rowCtr == 0)
  237. {
  238. switch(cellCtr)
  239. {
  240. case 1:
  241. tCell.Text = "OS Lang";
  242. break;
  243. case 2 :
  244. tCell.Text = "Total";
  245. break;
  246. case 3 :
  247. tCell.Text = "OS Version";
  248. break;
  249. case 4:
  250. tCell.Text = "OS Name";
  251. break;
  252. case 5:
  253. tCell.Text = "Date";
  254. break;
  255. default:
  256. tCell.Text = "";
  257. break;
  258. }
  259. tCell.Style["font-size"] = "small";
  260. tCell.Height = 20;
  261. }
  262. else
  263. {
  264. switch(cellCtr)
  265. {
  266. case 1 :
  267. // tCell.Text = dr.GetString(0).ToString();
  268. try
  269. {
  270. tCell.Text = GetLanguage(System.Convert.ToInt16(dr.GetString(0), 10));
  271. }
  272. catch
  273. {
  274. tCell.Text = "Unknown" + dr.GetString(0);
  275. }
  276. break;
  277. case 2 :
  278. tCell.Text = dr.GetInt32(1).ToString();
  279. break;
  280. case 3 :
  281. tCell.Text = dr.GetString(2).ToString();
  282. break;
  283. case 4 :
  284. tCell.Text = dr.GetString(3).ToString();
  285. break;
  286. case 5 :
  287. if(dr.IsDBNull(4))
  288. {
  289. tCell.Text = "";
  290. }
  291. else
  292. {
  293. tCell.Text = dr.GetDateTime(4).ToShortDateString();
  294. }
  295. break;
  296. default:
  297. tCell.Text = "0";
  298. break;
  299. }
  300. tCell.Style["background-color"] = "white";
  301. tCell.Style["font-size"] = "small-x";
  302. tCell.Style["color"] = "#6487dc";
  303. tCell.Style["font-weight"] = "Bold";
  304. tCell.Height = 20;
  305. }
  306. tCell.Style["font-family"] = "Tahoma";
  307. tRow.Cells.Add(tCell);
  308. }//for
  309. }
  310. rowCtr++;
  311. }while(dr.Read() == true);
  312. }
  313. private void Calendar1_VisibleMonthChanged(object sender, System.Web.UI.WebControls.MonthChangedEventArgs e)
  314. {
  315. SqlConnection cn = new SqlConnection("Persist Security Info=False;Pwd=ocarpts@2;User ID=ocarpts;Initial Catalog=SnapShot;Data Source=TimRagain06");
  316. SqlCommand cm = new SqlCommand();
  317. SqlDataReader dr;
  318. DateTime dDate = DateTime.Now;
  319. int rowCtr=0;
  320. int cellCtr=0;
  321. int cellCnt = 5;
  322. int iLang = 0;
  323. string sLang;
  324. TableRow tRow;
  325. TableCell tCell;
  326. cn.Open();
  327. cm.CommandType = CommandType.StoredProcedure;
  328. cm.CommandTimeout = 240;
  329. cm.CommandText = "GetOSLanguage";
  330. cm.Parameters.Add("@sDate", System.Data.SqlDbType.VarChar, 12);
  331. dDate = Calendar1.SelectedDate;
  332. cm.Parameters[0].Value = dDate.ToShortDateString();
  333. cm.Connection = cn;
  334. dr = cm.ExecuteReader();
  335. //dr.Read();
  336. do
  337. {
  338. if(rowCtr > 0)
  339. {
  340. sLang = dr.GetString(0);
  341. if(sLang == "")
  342. {
  343. iLang = 0;
  344. }
  345. else
  346. {
  347. iLang = System.Convert.ToInt16(dr.GetString(0), 10);
  348. }
  349. }
  350. if(rowCtr == 0 || ddlLanguages.SelectedItem.Value == "ALL" || GetLanguage(iLang) == ddlLanguages.SelectedItem.Value)
  351. {
  352. tRow = new TableRow();
  353. // }
  354. for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
  355. {
  356. tblUploads.Rows.Add(tRow);
  357. tCell = new TableCell();
  358. if(rowCtr == 0)
  359. {
  360. switch(cellCtr)
  361. {
  362. case 1:
  363. tCell.Text = "OS Lang";
  364. break;
  365. case 2 :
  366. tCell.Text = "Total";
  367. break;
  368. case 3 :
  369. tCell.Text = "OS Version";
  370. break;
  371. case 4:
  372. tCell.Text = "OS Name";
  373. break;
  374. case 5:
  375. tCell.Text = "Date";
  376. break;
  377. default:
  378. tCell.Text = "";
  379. break;
  380. }
  381. tCell.Style["font-size"] = "small";
  382. tCell.Height = 20;
  383. }
  384. else
  385. {
  386. switch(cellCtr)
  387. {
  388. case 1 :
  389. // tCell.Text = dr.GetString(0).ToString();
  390. try
  391. {
  392. tCell.Text = GetLanguage(System.Convert.ToInt16(dr.GetString(0), 10));
  393. }
  394. catch
  395. {
  396. tCell.Text = "Unknown" + dr.GetString(0);
  397. }
  398. break;
  399. case 2 :
  400. tCell.Text = dr.GetInt32(1).ToString();
  401. break;
  402. case 3 :
  403. tCell.Text = dr.GetString(2).ToString();
  404. break;
  405. case 4 :
  406. tCell.Text = dr.GetString(3).ToString();
  407. break;
  408. case 5 :
  409. if(dr.IsDBNull(4))
  410. {
  411. tCell.Text = "";
  412. }
  413. else
  414. {
  415. tCell.Text = dr.GetDateTime(4).ToShortDateString();
  416. }
  417. break;
  418. default:
  419. tCell.Text = "0";
  420. break;
  421. }
  422. tCell.Style["background-color"] = "white";
  423. tCell.Style["font-size"] = "small-x";
  424. tCell.Style["color"] = "#6487dc";
  425. tCell.Style["font-weight"] = "Bold";
  426. tCell.Height = 20;
  427. }
  428. tCell.Style["font-family"] = "Tahoma";
  429. tRow.Cells.Add(tCell);
  430. }//for
  431. }
  432. rowCtr++;
  433. }while(dr.Read() == true);
  434. }
  435. private string GetLanguage(int iLang)
  436. {
  437. string strLang = "";
  438. switch(iLang)
  439. {
  440. case 0:
  441. strLang = "Unknown" + iLang.ToString();
  442. break;
  443. case 1078:
  444. // strLCID = 1078 ' Afrikaans
  445. strLang = "Afrikaans";
  446. break;
  447. case 1052:
  448. // strLCID = 1052 ' Albanian
  449. strLang = "Albanian";
  450. break;
  451. case 1025:
  452. // strLCID = 1025 ' Arabic(Saudi Arabia)
  453. strLang = "Arabic(Saudi Arabia)";
  454. break;
  455. case 2049:
  456. // strLCID = 2049 ' Arabic(Iraq)
  457. strLang = "Arabic(Iraq)";
  458. break;
  459. case 3073 :
  460. // strLCID = 3073 ' Arabic(Egypt)
  461. strLang = "Arabic(Egypt)";
  462. break;
  463. case 4097:
  464. // strLCID = 4097 ' Arabic(Libya)
  465. strLang = "Arabic(Libya)";
  466. break;
  467. case 5121:
  468. // strLCID = 5121 ' Arabic(Algeria)
  469. strLang = "Arabic(Algeria)";
  470. break;
  471. case 6145:
  472. // strLCID = 6145 ' Arabic(Morocco)
  473. strLang = "Arabic(Morocco)";
  474. break;
  475. case 7169:
  476. // strLCID = 7169 ' Arabic(Tunisia)
  477. strLang = "Arabic(Tunisia)";
  478. break;
  479. case 8193:
  480. // strLCID = 8193 ' Arabic(Oman)
  481. strLang = "Arabic(Oman)";
  482. break;
  483. case 9217:
  484. // strLCID = 9217 ' Arabic(Yemen)
  485. strLang = "Arabic(Yemen)";
  486. break;
  487. case 10241:
  488. // strLCID = 10241 ' Arabic(Syria)
  489. strLang = "Arabic(Syria)";
  490. break;
  491. case 11265:
  492. // strLCID = 11265 ' Arabic(Jordan)
  493. strLang = "Arabic(Jordan)";
  494. break;
  495. case 12289:
  496. // strLCID = 12289 ' Arabic(Lebanon)
  497. strLang = "Arabic(Lebanon)";
  498. break;
  499. case 13313:
  500. // strLCID = 13313 ' Arabic(Kuwait)
  501. strLang = "Arabic(Kuwait)";
  502. break;
  503. case 14337:
  504. // strLCID = 14337 ' Arabic(U.A.E.)
  505. strLang = "Arabic(U.A.E.)";
  506. break;
  507. case 15361:
  508. // strLCID = 15361 ' Arabic(Bahrain)
  509. strLang = "Arabic(Bahrain)";
  510. break;
  511. case 16385:
  512. // strLCID = 16385 ' Arabic(Qatar)
  513. strLang = "Arabic(Qatar)";
  514. break;
  515. case 1069:
  516. // strLCID = 1069 ' Basque
  517. strLang = "Basque";
  518. break;
  519. case 1026:
  520. // strLCID = 1026 ' Bulgarian
  521. strLang = "Bulgarian";
  522. break;
  523. case 1059:
  524. // strLCID = 1059 ' Belarusian
  525. strLang = "Belarusian";
  526. break;
  527. case 1027:
  528. // strLCID = 1027 ' Catalan
  529. strLang = "Catalan";
  530. break;
  531. case 1028:
  532. // strLCID = 1028 ' Chinese(Taiwan)
  533. strLang = "Chinese(Taiwan)";
  534. break;
  535. case 2052:
  536. // strLCID = 2052 ' Chinese(PRC)
  537. strLang = "Chinese(PRC)";
  538. break;
  539. case 3076:
  540. // strLCID = 3076 ' Chinese(Hong Kong)
  541. strLang = "Chinese(Hong Kong)";
  542. break;
  543. case 4100:
  544. // strLCID = 4100 ' Chinese(Singapore)
  545. strLang = "Chinese(Singapore)";
  546. break;
  547. case 1050:
  548. // strLCID = 1050 ' Croatian
  549. strLang = "Croatian";
  550. break;
  551. case 1029:
  552. // strLCID = 1029 ' Czech
  553. strLang = "Czech";
  554. break;
  555. case 1030:
  556. // strLCID = 1030 ' Danish
  557. strLang = "Danish";
  558. break;
  559. case 1043:
  560. // strLCID = 1043 ' Dutch(Standard)
  561. strLang = "Dutch(Standard)";
  562. break;
  563. case 2067:
  564. // strLCID = 2067 ' Dutch(Belgian)
  565. strLang = "Dutch(Belgian)";
  566. break;
  567. case 9:
  568. // strLCID = 9 ' English
  569. strLang = "English";
  570. break;
  571. case 1033:
  572. // strLCID = 1033 ' English(United States)
  573. strLang = "English(United States)";
  574. break;
  575. case 2057:
  576. // strLCID = 2057 ' English(British)
  577. strLang = "English(British)";
  578. break;
  579. case 3081:
  580. // strLCID = 3081 ' English(Australian)
  581. strLang = "English(Australian)";
  582. break;
  583. case 4105:
  584. // strLCID = 4105 ' English(Canadian)
  585. strLang = "English(Canadian)";
  586. break;
  587. case 5129:
  588. // strLCID = 5129 ' English(New Zealand)
  589. strLang = "English(New Zealand)";
  590. break;
  591. case 6153:
  592. // strLCID = 6153 ' English(Ireland)
  593. strLang = "English(Ireland)";
  594. break;
  595. case 7177:
  596. // strLCID = 7177 ' English(South Africa)
  597. strLang = "English(South Africa)";
  598. break;
  599. case 8201:
  600. // strLCID = 8201 ' English(Jamaica)
  601. strLang = "English(Jamaica)";
  602. break;
  603. case 9225:
  604. // strLCID = 9225 ' English(Caribbean)
  605. strLang = "English(Caribbean)";
  606. break;
  607. case 10249:
  608. // strLCID = 10249 ' English(Belize)
  609. strLang = "English(Belize)";
  610. break;
  611. case 11273:
  612. // strLCID = 11273 ' English(Trinidad)
  613. strLang = "English(Trinidad)";
  614. break;
  615. case 1061:
  616. // strLCID = 1061 ' Estonian
  617. strLang = "Estonian";
  618. break;
  619. case 1080:
  620. // strLCID = 1080 ' Faeroese
  621. strLang = "Faeroese";
  622. break;
  623. case 1065:
  624. // strLCID = 1065 ' Farsi
  625. strLang = "Farsi";
  626. break;
  627. case 1035:
  628. // strLCID = 1035 ' Finnish
  629. strLang = "Finnish";
  630. break;
  631. case 1036:
  632. // strLCID = 1036 ' French(Standard)
  633. strLang = "French(Standard)";
  634. break;
  635. case 2060:
  636. // strLCID = 2060 ' French(Belgian)
  637. strLang = "French(Belgian)";
  638. break;
  639. case 3084:
  640. // strLCID = 3084 ' French(Canadian)
  641. strLang = "French(Canadian)";
  642. break;
  643. case 4108:
  644. // strLCID = 4108 ' French(Swiss)
  645. strLang = "French(Swiss)";
  646. break;
  647. case 5132:
  648. // strLCID = 5132 ' French(Luxembourg)
  649. strLang = "French(Luxembourg)";
  650. break;
  651. case 1084:
  652. // strLCID = 1084 ' Gaelic(Scots)
  653. strLang = "Gaelic(Scots)";
  654. break;
  655. case 2108:
  656. // strLCID = 2108 ' Gaelic(Irish)
  657. strLang = "Gaelic(Irish)";
  658. break;
  659. case 1031:
  660. // strLCID = 1031 ' German(Standard)
  661. strLang = "German(Standard)";
  662. break;
  663. case 2055:
  664. // strLCID = 2055 ' German(Swiss)
  665. strLang = "German(Swiss)";
  666. break;
  667. case 3079:
  668. // strLCID = 3079 ' German(Austrian)
  669. strLang = "German(Austrian)";
  670. break;
  671. case 4103:
  672. // strLCID = 4103 ' German(Luxembourg)
  673. strLang = "German(Luxembourg)";
  674. break;
  675. case 5127:
  676. // strLCID = 5127 ' German(Liechtenstein)
  677. strLang = "German(Liechtenstein)";
  678. break;
  679. case 1032:
  680. // strLCID = 1032 ' Greek
  681. strLang = "Greek";
  682. break;
  683. case 1037:
  684. // strLCID = 1037 ' Hebrew
  685. strLang = "Hebrew";
  686. break;
  687. case 1081:
  688. // strLCID = 1081 ' Hindi
  689. strLang = "Hindi";
  690. break;
  691. case 1038:
  692. // strLCID = 1038 ' Hungarian
  693. strLang = "Hungarian";
  694. break;
  695. case 1039:
  696. // strLCID = 1039 ' Icelandic
  697. strLang = "Icelandic";
  698. break;
  699. case 1057:
  700. // strLCID = 1057 ' Indonesian
  701. strLang = "Indonesian";
  702. break;
  703. case 1040:
  704. // strLCID = 1040 ' Italian(Standard)
  705. strLang = "Italian(Standard)";
  706. break;
  707. case 2064:
  708. // strLCID = 2064 ' Italian(Swiss)
  709. strLang = "Italian(Swiss)";
  710. break;
  711. case 1041:
  712. // strLCID = 1041 ' Japanese
  713. strLang = "Japanese";
  714. break;
  715. case 1042:
  716. // strLCID = 1042 ' Korean
  717. strLang = "Korean";
  718. break;
  719. case 2066:
  720. // strLCID = 2066 ' Korean(Johab)
  721. strLang = "Korean(Johab)";
  722. break;
  723. case 1062:
  724. // strLCID = 1062 ' Latvian
  725. strLang = "Latvian";
  726. break;
  727. case 1063:
  728. // strLCID = 1063 ' Lithuanian
  729. strLang = "Lithuanian";
  730. break;
  731. case 1071:
  732. // strLCID = 1071 ' Macedonian
  733. strLang = "Macedonian";
  734. break;
  735. case 1086:
  736. // strLCID = 1086 ' Malaysian
  737. strLang = "Malaysian";
  738. break;
  739. case 1082:
  740. // strLCID = 1082 ' Maltese
  741. strLang = "Maltese";
  742. break;
  743. case 1044:
  744. // strLCID = 1044 ' Norwegian(Bokmal)
  745. strLang = "Norwegian(Bokmal)";
  746. break;
  747. case 2068:
  748. // strLCID = 2068 ' Norwegian(Nynorsk)
  749. strLang = "Norwegian(Nynorsk)";
  750. break;
  751. case 1045:
  752. // strLCID = 1045 ' Polish
  753. strLang = "Polish";
  754. break;
  755. case 1046:
  756. // strLCID = 1046 ' Portuguese(Brazilian)
  757. strLang = "Portuguese(Brazilian)";
  758. break;
  759. case 2070:
  760. // strLCID = 2070 ' Portuguese(Standard)
  761. strLang = "Portuguese(Standard)";
  762. break;
  763. case 1047:
  764. // strLCID = 1047 ' Rhaeto-Romanic
  765. strLang = "Rhaeto-Romanic";
  766. break;
  767. case 1048:
  768. // strLCID = 1048 ' Romanian
  769. strLang = "Romanian";
  770. break;
  771. case 2072:
  772. // strLCID = 2072 ' Romanian(Moldavia)
  773. strLang = "Romanian(Moldavia)";
  774. break;
  775. case 1049:
  776. // strLCID = 1049 ' Russian
  777. strLang = "Russian";
  778. break;
  779. case 2073:
  780. // strLCID = 2073 ' Russian(Moldavia)
  781. strLang = "Russian(Moldavia)";
  782. break;
  783. case 1083:
  784. // strLCID = 1083 ' Sami(Lappish)
  785. strLang = "Sami(Lappish)";
  786. break;
  787. case 3098:
  788. // strLCID = 3098 ' Serbian(Cyrillic)
  789. strLang = "Serbian(Cyrillic)";
  790. break;
  791. case 2074:
  792. // strLCID = 2074 ' Serbian(Latin)
  793. strLang = "Serbian(Latin)";
  794. break;
  795. case 1051:
  796. // strLCID = 1051 ' Slovak
  797. strLang = "Slovak";
  798. break;
  799. case 1060:
  800. // strLCID = 1060 ' Slovenian
  801. strLang = "Slovenian";
  802. break;
  803. case 1070:
  804. // strLCID = 1070 ' Sorbian
  805. strLang = "Sorbian";
  806. break;
  807. case 1034:
  808. // strLCID = 1034 ' Spanish(Spain - Traditional Sort)
  809. strLang = "Spanish(Spain - Traditional Sort)";
  810. break;
  811. case 2058:
  812. // strLCID = 2058 ' Spanish(Mexican)
  813. strLang = "Spanish(Mexican)";
  814. break;
  815. case 3082:
  816. // strLCID = 3082 ' Spanish(Spain - Modern Sort)
  817. strLang = "Spanish(Spain - Modern Sort)";
  818. break;
  819. case 4106:
  820. // strLCID = 4106 ' Spanish(Guatemala)
  821. strLang = "Spanish(Guatemala)";
  822. break;
  823. case 5130:
  824. // strLCID = 5130 ' Spanish(Costa Rica)
  825. strLang = "Spanish(Costa Rica)";
  826. break;
  827. case 6154:
  828. // strLCID = 6154 ' Spanish(Panama)
  829. strLang = "Spanish(Panama)";
  830. break;
  831. case 7178:
  832. // strLCID = 7178 ' Spanish(Dominican Republic)
  833. strLang = "Spanish(Dominican Republic)";
  834. break;
  835. case 8202:
  836. // strLCID = 8202 ' Spanish(Venezuela)
  837. strLang = "Spanish(Venezuela)";
  838. break;
  839. case 9226:
  840. // strLCID = 9226 ' Spanish(Colombia)
  841. strLang = "Spanish(Colombia)";
  842. break;
  843. case 10250:
  844. // strLCID = 10250 ' Spanish(Peru)
  845. strLang = "Spanish(Peru)";
  846. break;
  847. case 11274:
  848. // strLCID = 11274 ' Spanish(Argentina)
  849. strLang = "Spanish(Argentina)";
  850. break;
  851. case 12298:
  852. // strLCID = 12298 ' Spanish(Ecuador)
  853. strLang = "Spanish(Ecuador)";
  854. break;
  855. case 13322:
  856. // strLCID = 13322 ' Spanish(Chile)
  857. strLang = "Spanish(Chile)";
  858. break;
  859. case 14346:
  860. // strLCID = 14346 ' Spanish(Uruguay)
  861. strLang = "Spanish(Uruguay)";
  862. break;
  863. case 15370:
  864. // strLCID = 15370 ' Spanish(Paraguay)
  865. strLang = "Spanish(Paraguay)";
  866. break;
  867. case 16394:
  868. // strLCID = 16394 ' Spanish(Bolivia)
  869. strLang = "Spanish(Bolivia)";
  870. break;
  871. case 17418:
  872. // strLCID = 17418 ' Spanish(El Salvador)
  873. strLang = "Spanish(El Salvador)";
  874. break;
  875. case 18442:
  876. // strLCID = 18442 ' Spanish(Honduras)
  877. strLang = "Spanish(Honduras)";
  878. break;
  879. case 19466:
  880. // strLCID = 19466 ' Spanish(Nicaragua)
  881. strLang = "Spanish(Nicaragua)";
  882. break;
  883. case 20490:
  884. // strLCID = 20490 ' Spanish(Puerto Rico)
  885. strLang = "Spanish(Puerto Rico)";
  886. break;
  887. case 1072:
  888. // strLCID = 1072 ' Sutu
  889. strLang = "Sutu";
  890. break;
  891. case 1053:
  892. // strLCID = 1053 ' Swedish
  893. strLang = "Swedish";
  894. break;
  895. case 2077:
  896. // strLCID = 2077 ' Swedish(Finland)
  897. strLang = "Swedish(Finland)";
  898. break;
  899. case 1054:
  900. // strLCID = 1054 ' Thai
  901. strLang = "Thai";
  902. break;
  903. case 1073:
  904. // strLCID = 1073 ' Tsonga
  905. strLang = "Tsonga";
  906. break;
  907. case 1074:
  908. // strLCID = 1074 ' Tswana
  909. strLang = "Tswana";
  910. break;
  911. case 1055:
  912. // strLCID = 1055 ' Turkish
  913. strLang = "Turkish";
  914. break;
  915. case 1058:
  916. // strLCID = 1058 ' Ukrainian
  917. strLang = "Ukrainian";
  918. break;
  919. case 1056:
  920. // strLCID = 1056 ' Urdu
  921. strLang = "Urdu";
  922. break;
  923. case 1075:
  924. // strLCID = 1075 ' Venda
  925. strLang = "Venda";
  926. break;
  927. case 1066:
  928. // strLCID = 1066 ' Vietnamese
  929. strLang = "Vietnamese";
  930. break;
  931. case 1076:
  932. // strLCID = 1076 ' Xhosa
  933. strLang = "Xhosa";
  934. break;
  935. case 1085:
  936. // strLCID = 1085 ' Yiddish
  937. strLang = "Yiddish";
  938. break;
  939. case 1077:
  940. // strLCID = 1077 ' Zulu
  941. strLang = "Zulu";
  942. break;
  943. default:
  944. // strLCID = 2048 ' default
  945. strLang = "Unknown" + iLang.ToString();
  946. break;
  947. }
  948. return strLang;
  949. }
  950. private void ddlLanguages_SelectedIndexChanged(object sender, System.EventArgs e)
  951. {
  952. SqlConnection cn = new SqlConnection("Persist Security Info=False;Pwd=ocarpts@2;User ID=ocarpts;Initial Catalog=SnapShot;Data Source=TimRagain06");
  953. SqlCommand cm = new SqlCommand();
  954. SqlDataReader dr;
  955. DateTime dDate = DateTime.Now;
  956. int rowCtr=0;
  957. int cellCtr=0;
  958. int cellCnt = 5;
  959. int iLang = 0;
  960. string sLang;
  961. TableRow tRow;
  962. TableCell tCell;
  963. cn.Open();
  964. cm.CommandType = CommandType.StoredProcedure;
  965. cm.CommandTimeout = 240;
  966. cm.CommandText = "GetOSLanguage";
  967. cm.Parameters.Add("@sDate", System.Data.SqlDbType.VarChar, 12);
  968. dDate = Calendar1.SelectedDate;
  969. cm.Parameters[0].Value = dDate.ToShortDateString();
  970. cm.Connection = cn;
  971. dr = cm.ExecuteReader();
  972. //dr.Read();
  973. do
  974. {
  975. if(rowCtr > 0)
  976. {
  977. sLang = dr.GetString(0);
  978. if(sLang == "")
  979. {
  980. iLang = 0;
  981. }
  982. else
  983. {
  984. iLang = System.Convert.ToInt16(dr.GetString(0), 10);
  985. }
  986. }
  987. if(rowCtr == 0 || ddlLanguages.SelectedItem.Value == "ALL" || GetLanguage(iLang) == ddlLanguages.SelectedItem.Value)
  988. {
  989. tRow = new TableRow();
  990. // }
  991. for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
  992. {
  993. tblUploads.Rows.Add(tRow);
  994. tCell = new TableCell();
  995. if(rowCtr == 0)
  996. {
  997. switch(cellCtr)
  998. {
  999. case 1:
  1000. tCell.Text = "OS Lang";
  1001. break;
  1002. case 2 :
  1003. tCell.Text = "Total";
  1004. break;
  1005. case 3 :
  1006. tCell.Text = "OS Version";
  1007. break;
  1008. case 4:
  1009. tCell.Text = "OS Name";
  1010. break;
  1011. case 5:
  1012. tCell.Text = "Date";
  1013. break;
  1014. default:
  1015. tCell.Text = "";
  1016. break;
  1017. }
  1018. tCell.Style["font-size"] = "small";
  1019. tCell.Height = 20;
  1020. }
  1021. else
  1022. {
  1023. switch(cellCtr)
  1024. {
  1025. case 1 :
  1026. // tCell.Text = dr.GetString(0).ToString();
  1027. try
  1028. {
  1029. tCell.Text = GetLanguage(System.Convert.ToInt16(dr.GetString(0), 10));
  1030. }
  1031. catch
  1032. {
  1033. tCell.Text = "Unknown" + dr.GetString(0);
  1034. }
  1035. break;
  1036. case 2 :
  1037. tCell.Text = dr.GetInt32(1).ToString();
  1038. break;
  1039. case 3 :
  1040. tCell.Text = dr.GetString(2).ToString();
  1041. break;
  1042. case 4 :
  1043. tCell.Text = dr.GetString(3).ToString();
  1044. break;
  1045. case 5 :
  1046. if(dr.IsDBNull(4))
  1047. {
  1048. tCell.Text = "";
  1049. }
  1050. else
  1051. {
  1052. tCell.Text = dr.GetDateTime(4).ToShortDateString();
  1053. }
  1054. break;
  1055. default:
  1056. tCell.Text = "0";
  1057. break;
  1058. }
  1059. tCell.Style["background-color"] = "white";
  1060. tCell.Style["font-size"] = "small-x";
  1061. tCell.Style["color"] = "#6487dc";
  1062. tCell.Style["font-weight"] = "Bold";
  1063. tCell.Height = 20;
  1064. }
  1065. tCell.Style["font-family"] = "Tahoma";
  1066. tRow.Cells.Add(tCell);
  1067. }//for
  1068. }
  1069. rowCtr++;
  1070. }while(dr.Read() == true);
  1071. }
  1072. }
  1073. }
  1074. // SqlConnection cn = new SqlConnection("Persist Security Info=False;Pwd=ocarpts@2;User ID=ocarpts;Initial Catalog=SnapShot;Data Source=TimRagain06");
  1075. // SqlCommand cm = new SqlCommand();
  1076. // SqlDataReader dr;
  1077. // DateTime dDate = DateTime.Now;
  1078. // int rowCtr=0;
  1079. // int cellCtr=0;
  1080. // int cellCnt = 5;
  1081. //
  1082. // cn.Open();
  1083. // cm.CommandType = CommandType.StoredProcedure;
  1084. // cm.CommandTimeout = 240;
  1085. // cm.CommandText = "GetOSLanguage";
  1086. // cm.Parameters.Add("@sDate", System.Data.SqlDbType.VarChar, 12);
  1087. // dDate = Calendar1.SelectedDate;
  1088. // cm.Parameters[0].Value = dDate.ToShortDateString();
  1089. // cm.Connection = cn;
  1090. // dr = cm.ExecuteReader();
  1091. // //dr.Read();
  1092. //
  1093. // do
  1094. // {
  1095. // TableRow tRow = new TableRow();
  1096. // tblUploads.Rows.Add(tRow);
  1097. //
  1098. // for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
  1099. // {
  1100. // TableCell tCell = new TableCell();
  1101. //
  1102. // if(rowCtr == 0)
  1103. // {
  1104. // switch(cellCtr)
  1105. // {
  1106. // case 1:
  1107. // tCell.Text = "OS Lang";
  1108. // break;
  1109. // case 2 :
  1110. // tCell.Text = "Total";
  1111. // break;
  1112. // case 3 :
  1113. // tCell.Text = "OS Version";
  1114. // break;
  1115. // case 4:
  1116. // tCell.Text = "OS Name";
  1117. // break;
  1118. // case 5:
  1119. // tCell.Text = "Date";
  1120. // break;
  1121. // default:
  1122. // tCell.Text = "";
  1123. // break;
  1124. //
  1125. // }
  1126. // tCell.Style["font-size"] = "small";
  1127. // tCell.Height = 20;
  1128. //
  1129. // }
  1130. // else
  1131. // {
  1132. // switch(cellCtr)
  1133. // {
  1134. // case 1 :
  1135. //// tCell.Text = dr.GetString(0).ToString();
  1136. // try
  1137. // {
  1138. // tCell.Text = GetLanguage(System.Convert.ToInt16(dr.GetString(0), 10));
  1139. // }
  1140. // catch
  1141. // {
  1142. // tCell.Text = "Unknown" + dr.GetString(0);
  1143. // }
  1144. // break;
  1145. // case 2 :
  1146. // tCell.Text = dr.GetInt32(1).ToString();
  1147. // break;
  1148. // case 3 :
  1149. // tCell.Text = dr.GetString(2).ToString();
  1150. // break;
  1151. // case 4 :
  1152. // tCell.Text = dr.GetString(3).ToString();
  1153. // break;
  1154. // case 5 :
  1155. // if(dr.IsDBNull(4))
  1156. // {
  1157. // tCell.Text = "";
  1158. // }
  1159. // else
  1160. // {
  1161. // tCell.Text = dr.GetDateTime(4).ToShortDateString();
  1162. // }
  1163. // break;
  1164. //
  1165. // default:
  1166. // tCell.Text = "0";
  1167. // break;
  1168. //
  1169. // }
  1170. // tCell.Style["background-color"] = "white";
  1171. // tCell.Style["font-size"] = "small-x";
  1172. // tCell.Style["color"] = "#6487dc";
  1173. // tCell.Style["font-weight"] = "Bold";
  1174. // tCell.Height = 20;
  1175. //
  1176. // }
  1177. // tCell.Style["font-family"] = "Tahoma";
  1178. // tRow.Cells.Add(tCell);
  1179. // }
  1180. // rowCtr++;
  1181. // }while(dr.Read() == true);