Пример #1
0
        public static int insertData(NGUOI_LX obj)
        {
            int rtn = 0;

            string queryString = "INSERT INTO [dbo].[NguoiLX] (MaDK, DonViNhanHSo, HoDemNLX, TenNLX, HoVaTen, MaQuocTich, NgaySinh, NoiTT, NoiTT_MaDVHC, NoiTT_MaDVQL, NoiCT, NoiCT_MaDVHC, NoiCT_MaDVQL, SoCMT, NgayCapCMT, NoiCapCMT, GhiChu, TrangThai, NguoiTao, NguoiSua, NgayTao, NgaySua, GioiTinh, HoVaTenIn, SO_CMND_CU) " +
                                 "VALUES (@MaDK, @DonViNhanHSo, @HoDemNLX, @TenNLX, @HoVaTen, @MaQuocTich, @NgaySinh, @NoiTT, @NoiTT_MaDVHC, @NoiTT_MaDVQL, @NoiCT, @NoiCT_MaDVHC, @NoiCT_MaDVQL, @SoCMT, @NgayCapCMT, @NoiCapCMT, @GhiChu, @TrangThai, @NguoiTao, @NguoiSua, @NgayTao, @NgaySua, @GioiTinh, @HoVaTenIn, @SO_CMND_CU)";
            SqlConnection connection = Ultils.GetDBConnectionImport();
            SqlCommand    command    = new SqlCommand(queryString, connection);

            command.Parameters.AddWithValue("@MaDK", obj.MADK);
            command.Parameters.AddWithValue("@DonViNhanHSo", obj.DV_NHAN_HS);
            command.Parameters.AddWithValue("@HoDemNLX", obj.HO_DEM_NLX);
            command.Parameters.AddWithValue("@TenNLX", obj.TEN_NLX);
            command.Parameters.AddWithValue("@HoVaTen", obj.HO_VA_TEN);
            command.Parameters.AddWithValue("@MaQuocTich", obj.MA_QUOC_TICH);
            command.Parameters.AddWithValue("@NgaySinh", obj.NGAY_SINH);
            command.Parameters.AddWithValue("@NoiTT", obj.NOI_TT);
            command.Parameters.AddWithValue("@NoiTT_MaDVHC", obj.NOI_TT_MA_DVHC);
            command.Parameters.AddWithValue("@NoiTT_MaDVQL", obj.NOI_TT_MA_DVQL);
            command.Parameters.AddWithValue("@NoiCT", obj.NOI_CT);
            command.Parameters.AddWithValue("@NoiCT_MaDVHC", obj.NOI_CT_MA_DVHC);
            command.Parameters.AddWithValue("@NoiCT_MaDVQL", obj.NOI_CT_MA_DVQL);
            command.Parameters.AddWithValue("@SoCMT", obj.SO_CMT);
            command.Parameters.AddWithValue("@NgayCapCMT", obj.NGAY_CAP_CMT);
            command.Parameters.AddWithValue("@NoiCapCMT", obj.NOI_CAP_CMT);
            command.Parameters.AddWithValue("@GhiChu", obj.GHI_CHU);
            command.Parameters.AddWithValue("@TrangThai", obj.TRANG_THAI);
            command.Parameters.AddWithValue("@NguoiTao", obj.NGUOI_TAO);
            command.Parameters.AddWithValue("@NguoiSua", obj.NGUOI_SUA);
            command.Parameters.AddWithValue("@NgayTao", obj.NGAY_TAO);
            command.Parameters.AddWithValue("@NgaySua", obj.NGAY_SUA);
            command.Parameters.AddWithValue("@GioiTinh", obj.GIOI_TINH);
            command.Parameters.AddWithValue("@HoVaTenIn", obj.HO_VA_TEN_IN);
            command.Parameters.AddWithValue("@SO_CMND_CU", obj.SO_CMND_CU);
            connection.Open();
            int recordsAffected = command.ExecuteNonQuery();

            return(rtn);
        }