Beispiel #1
0
        public static List <LichSu> LoadLichSu()
        {
            string    query     = @"SELECT*FROM LICHSU";
            DataTable dataTable = new DataTable();//Can destroy.

            dataTable = DataProvider.QueryDataReader(query);
            LichSu lichSu;

            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                List <LichSu> lstLichSu = new List <LichSu>();
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    lichSu                    = new LichSu();
                    lichSu.MaLichSu           = dataTable.Rows[i]["MALICHSU"].ToString();
                    lichSu.DoCaoBanDau        = dataTable.Rows[i]["DOCAOBANDAU"].ToString();
                    lichSu.BanKinh            = dataTable.Rows[i]["BANKINH"].ToString();
                    lichSu.KhoiLuongRiengChat = dataTable.Rows[i]["KHOILUONGRIENGCHAT"].ToString();
                    lichSu.KhoiLuongRiengVat  = dataTable.Rows[i]["kHOILUONGRIENGVAT"].ToString();
                    lichSu.ThoiGianTongHop    = dataTable.Rows[i]["THOIGIANTONGHOP"].ToString();
                    lstLichSu.Add(lichSu);
                }
                return(lstLichSu);
            }
            return(null);
        }
        public static bool InsertLichSu(LichSu lichSu)
        {
            /*Call method insert city into THANHPHO_DAL layer*/
            bool result = LichSu_DAL.InsertLichSu(lichSu);

            return(result);
        }
Beispiel #3
0
        public static bool InsertLichSu(LichSu lichSu)
        {
            /*Set query.*/
            string query  = String.Format("INSERT INTO LICHSU (MALICHSU,DOCAOBANDAU,BANKINH,KHOILUONGRIENGCHAT,KHOILUONGRIENGVAT, THOIGIANTONGHOP) VALUES ('{0}','{1}','{2}','{3}','{4}', '{5}')", lichSu.MaLichSu, lichSu.DoCaoBanDau, lichSu.BanKinh, lichSu.KhoiLuongRiengChat, lichSu.KhoiLuongRiengVat, lichSu.ThoiGianTongHop);
            bool   result = DataProvider.QueryExecuteNonQuery(query);/*Execute query in layer dataprovider.*/

            return(result);
        }
Beispiel #4
0
 private void AddHistory()
 {
     try
     {
         maLichSu = int.Parse(LichSu_DAL.quantityElement().Substring(3)) + 1;
         LichSu newLichSu = new LichSu();
         newLichSu.MaLichSu           = IDLichSu + maLichSu;
         newLichSu.DoCaoBanDau        = docaobandau.ToString();
         newLichSu.BanKinh            = khoicau.R.ToString();
         newLichSu.KhoiLuongRiengChat = khoiluongriengchatlong.ToString();
         newLichSu.KhoiLuongRiengVat  = khoiluongriengvat.ToString();
         newLichSu.ThoiGianTongHop    = khoicau.time.ToString();
         bool result = LichSu_BUL.InsertLichSu(newLichSu);
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
         MessageBox.Show("Invalid dang an oshi!");
     }
 }