public FrmBanHang() { InitializeComponent(); serviceGet = new ServiceGet(); getGui = new get_GUI(); //for (int i = 1; i < 8;i++ ) //{ // button tmp = (button)panel1.Controls["button" + i.ToString()]; // tmp.changeColor(Color.White,Color.Orange); //} //for (int i = 15; i < 43; i++) //{ // button tmp = (button)panel2.Controls["button" + i.ToString()]; // tmp.changeColor(Color.White, Color.Gray); //} button45.changeColor(Color.White,Color.OrangeRed); button46.changeColor(Color.White, Color.OrangeRed); button47.changeColor(Color.White,Color.Orange); button48.changeColor(Color.White, Color.Yellow); button49.changeColor(Color.White, Color.OrangeRed); button50.changeColor(Color.White, Color.Gray); button52.changeColor(Color.White, Color.Gray); button53.changeColor(Color.White, Color.Orange); button54.changeColor(Color.White, Color.Green); //listNhomHang = new ArrayList(); //for (int i = 1; i < 18; i++) //{ // listNhomHang.Add(i.ToString()); //} //for (int i = 1; i < 70; i++) //{ // listMatHang.Add(i.ToString()); //} listMatHang = new ArrayList(); listIdNhomHang = new ArrayList(); listNhomHang = new ArrayList(); listIdMatHang = new ArrayList(); DataTable tblnhomhang = serviceGet.GetDepartments("1001"); for (int i = 0; i < tblnhomhang.Rows.Count; i++) { listNhomHang.Add(tblnhomhang.Rows[i][2].ToString()); listIdNhomHang.Add(tblnhomhang.Rows[i][24].ToString()); } DataTable tblMathang = getGui.GetInventoryByDept("0", listIdNhomHang[0].ToString(), "1001"); for (int i = 0; i < tblMathang.Rows.Count; i++) { listMatHang.Add(tblMathang.Rows[i][3].ToString()); listIdMatHang.Add(tblMathang.Rows[i][7].ToString()); } if(listNhomHang.Count % 7 == 0) { numOfPageNhom = listNhomHang.Count/7; } else { numOfPageNhom = listNhomHang.Count / 7 + 1; } if (listMatHang.Count % 28 == 0) { numOfPageMatHang = listMatHang.Count / 28; } else { numOfPageMatHang = listMatHang.Count / 28 + 1; } pageIndexNhom = 1; selectIndexNhom = 1; pageIndexMatHang = 1; LoadNhomHang(); LoadMatHang(); }
//private Thread printReceiptThread; public FrmBanHang() { InitializeComponent(); serviceGet = new ServiceGet(); getGui = new get_GUI(); frmPay = new FrmPay(); //for (int i = 1; i < 8;i++ ) //{ // button tmp = (button)panel1.Controls["button" + i.ToString()]; // tmp.changeColor(Color.White,Color.Orange); //} //for (int i = 15; i < 43; i++) //{ // button tmp = (button)panel2.Controls["button" + i.ToString()]; // tmp.changeColor(Color.White, Color.Gray); //} //button45.changeColor(Color.White,Color.OrangeRed); //button46.changeColor(Color.White, Color.OrangeRed); //button47.changeColor(Color.White,Color.Orange); //button48.changeColor(Color.White, Color.Yellow); //button49.changeColor(Color.White, Color.OrangeRed); //button50.changeColor(Color.White, Color.Gray); //button52.changeColor(Color.White, Color.Gray); //button53.changeColor(Color.White, Color.Orange); //button54.changeColor(Color.White, Color.Green); //listNhomHang = new ArrayList(); //for (int i = 1; i < 18; i++) //{ // listNhomHang.Add(i.ToString()); //} //for (int i = 1; i < 70; i++) //{ // listMatHang.Add(i.ToString()); //} //listMatHang = new ArrayList(); //listIdNhomHang = new ArrayList(); //listNhomHang = new ArrayList(); //listIdMatHang = new ArrayList(); listTSButtonDept = new ArrayList(); listTSButtonInvent = new ArrayList(); DataTable tblnhomhang = serviceGet.GetDepartments("1001"); for (int i = 0; i < tblnhomhang.Rows.Count; i++) { //listNhomHang.Add(tblnhomhang.Rows[i][2].ToString()); //listIdNhomHang.Add(tblnhomhang.Rows[i][24].ToString()); TSButton tsButton = new TSButton("01", Convert.ToInt32(tblnhomhang.Rows[i]["Index"]), tblnhomhang.Rows[i]["Caption"].ToString(), tblnhomhang.Rows[i]["Picture"].ToString(), tblnhomhang.Rows[i]["Option1"].ToString(), Convert.ToInt32(tblnhomhang.Rows[i]["BackColor"]), Convert.ToInt32(tblnhomhang.Rows[i]["ForeColor"]), Convert.ToBoolean(tblnhomhang.Rows[i]["Visible"]), tblnhomhang.Rows[i]["Ident"].ToString()); listTSButtonDept.Add(tsButton); } if(tblnhomhang.Rows.Count > 0) { DataTable tblMathang = getGui.GetInventoryByDept("0", ((TSButton)listTSButtonDept[0]).Ident, "1001"); for (int i = 0; i < tblMathang.Rows.Count; i++) { //listMatHang.Add(tblMathang.Rows[i][3].ToString()); //listIdMatHang.Add(tblMathang.Rows[i][7].ToString()); TSButton tsButton = new TSButton("01", Convert.ToInt32(tblMathang.Rows[i]["Index"]), tblMathang.Rows[i]["Caption"].ToString(), tblMathang.Rows[i]["Picture"].ToString(), tblMathang.Rows[i]["Option1"].ToString(), Convert.ToInt32(tblMathang.Rows[i]["BackColor"]), Convert.ToInt32(tblMathang.Rows[i]["ForeColor"]), Convert.ToBoolean(tblMathang.Rows[i]["Visible"]), tblMathang.Rows[i]["Ident"].ToString()); listTSButtonInvent.Add(tsButton); } } else { button8.Visible = false; } if(listTSButtonDept.Count % 7 == 0) { numOfPageNhom = listTSButtonDept.Count / 7; } else { numOfPageNhom = listTSButtonDept.Count / 7 + 1; } if (listTSButtonInvent.Count % 28 == 0) { numOfPageMatHang = listTSButtonInvent.Count / 28; } else { numOfPageMatHang = listTSButtonInvent.Count / 28 + 1; } pageIndexNhom = 1; selectIndexNhom = 1; pageIndexMatHang = 1; LoadNhomHang(); LoadMatHang(); //////////////////////////////////////////////////////////////////////////// for (int i = 1; i < 8; i++) { string buttonName = "button" + i.ToString(); button tmp = (button)panel1.Controls[buttonName]; tmp.Click += new EventHandler(tmp_Click); //tmp.changeColor(Color.White, Color.Orange); } for (int i = 15; i < 43; i++) { button tmp1 = (button)panel2.Controls["button" + i.ToString()]; //tmp1.changeColor(Color.White, Color.Gray); tmp1.Click += new EventHandler(tmp1_Click); } //UpdateInfo(); }