Esempio n. 1
0
        public static BanHang_PhienLamViec Insert(BanHang_PhienLamViec item)
        {
            var Item = new BanHang_PhienLamViec();
            var obj  = new SqlParameter[6];

            obj[0] = new SqlParameter("PLV_ID", item.ID);
            obj[1] = new SqlParameter("PLV_Username", item.Username);
            obj[2] = new SqlParameter("PLV_CQ_ID", item.CQ_ID);
            obj[3] = new SqlParameter("PLV_SoLuong", item.SoLuong);
            obj[4] = new SqlParameter("PLV_DoanhSo", item.DoanhSo);
            if (item.Ngay > DateTime.MinValue)
            {
                obj[5] = new SqlParameter("PLV_Ngay", item.Ngay);
            }
            else
            {
                obj[5] = new SqlParameter("PLV_Ngay", DBNull.Value);
            }

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblBanHang_PhienLamViec_Insert_InsertNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Esempio n. 2
0
        public static BanHang_PhienLamViec getFromReader(IDataReader rd)
        {
            var Item = new BanHang_PhienLamViec();

            if (rd.FieldExists("PLV_ID"))
            {
                Item.ID = (Int64)(rd["PLV_ID"]);
            }
            if (rd.FieldExists("PLV_Username"))
            {
                Item.Username = (String)(rd["PLV_Username"]);
            }
            if (rd.FieldExists("PLV_CQ_ID"))
            {
                Item.CQ_ID = (Int32)(rd["PLV_CQ_ID"]);
            }
            if (rd.FieldExists("PLV_SoLuong"))
            {
                Item.SoLuong = (Int32)(rd["PLV_SoLuong"]);
            }
            if (rd.FieldExists("PLV_DoanhSo"))
            {
                Item.DoanhSo = (Int32)(rd["PLV_DoanhSo"]);
            }
            if (rd.FieldExists("PLV_Ngay"))
            {
                Item.Ngay = (DateTime)(rd["PLV_Ngay"]);
            }
            if (rd.FieldExists("PLV_CQ_Ten"))
            {
                Item.CQ_Ten = (String)(rd["PLV_CQ_Ten"]);
            }
            return(Item);
        }
Esempio n. 3
0
        public static BanHang_PhienLamViec SelectByUsername(string Username)
        {
            var Item = new BanHang_PhienLamViec();
            var obj  = new SqlParameter[1];

            obj[0] = new SqlParameter("Username", Username);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblBanHang_PhienLamViec_Select_SelectByUsername_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }