示例#1
0
        public static BanHang_PhienBanHang getFromReader(IDataReader rd)
        {
            var Item = new BanHang_PhienBanHang();

            if (rd.FieldExists("PBH_ID"))
            {
                Item.ID = (Int64)(rd["PBH_ID"]);
            }
            if (rd.FieldExists("PBH_Username"))
            {
                Item.Username = (String)(rd["PBH_Username"]);
            }
            if (rd.FieldExists("PBH_CQ_ID"))
            {
                Item.CQ_ID = (Int32)(rd["PBH_CQ_ID"]);
            }
            if (rd.FieldExists("PBH_HH_ID"))
            {
                Item.HH_ID = (Guid)(rd["PBH_HH_ID"]);
            }
            if (rd.FieldExists("PBH_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["PBH_NgayTao"]);
            }
            if (rd.FieldExists("PBH_Checked"))
            {
                Item.Checked = (Boolean)(rd["PBH_Checked"]);
            }
            if (rd.FieldExists("PBH_PLV_ID"))
            {
                Item.PLV_ID = (Int64)(rd["PBH_PLV_ID"]);
            }
            return(Item);
        }
示例#2
0
        public static BanHang_PhienBanHang Insert(BanHang_PhienBanHang item)
        {
            var Item = new BanHang_PhienBanHang();
            var obj  = new SqlParameter[7];

            obj[0] = new SqlParameter("PBH_ID", item.ID);
            obj[1] = new SqlParameter("PBH_Username", item.Username);
            obj[2] = new SqlParameter("PBH_CQ_ID", item.CQ_ID);
            obj[3] = new SqlParameter("PBH_HH_ID", item.HH_ID);
            if (item.NgayTao > DateTime.MinValue)
            {
                obj[4] = new SqlParameter("PBH_NgayTao", item.NgayTao);
            }
            else
            {
                obj[4] = new SqlParameter("PBH_NgayTao", DBNull.Value);
            }
            obj[5] = new SqlParameter("PBH_Checked", item.Checked);
            obj[6] = new SqlParameter("PBH_PLV_ID", item.PLV_ID);

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblBanHang_PhienBanHang_Insert_InsertNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
示例#3
0
        public static BanHang_PhienBanHang SelectById(Int64 PBH_ID)
        {
            var Item = new BanHang_PhienBanHang();
            var obj  = new SqlParameter[1];

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