コード例 #1
0
 private static void TGenerateObjFromReader <T>(SqlDataReader returnData, ref CUser user)
 {
     try
     {
         while (returnData.Read())
         {
             if (returnData["user_id"] != DBNull.Value)
             {
                 user.user_id = Convert.ToInt32(returnData["user_id"]);
             }
             if (returnData["user_name"] != DBNull.Value)
             {
                 user.user_name = returnData["user_name"].ToString();
             }
             if (returnData["user_email"] != DBNull.Value)
             {
                 user.user_email = returnData["user_email"].ToString();
             }
             if (returnData["user_first_name"] != DBNull.Value)
             {
                 user.user_first_name = returnData["user_first_name"].ToString();
             }
             if (returnData["user_last_name"] != DBNull.Value)
             {
                 user.user_last_name = returnData["user_last_name"].ToString();
             }
             if (returnData["user_last_login"] != DBNull.Value)
             {
                 user.user_last_login = Convert.ToDateTime(returnData["user_last_login"].ToString());
             }
             if (returnData["user_group_id"] != DBNull.Value)
             {
                 user.user_group_id = Convert.ToInt32(returnData["user_group_id"].ToString());
             }
             if (returnData["user_birth_place"] != DBNull.Value)
             {
                 user.user_birth_place = returnData["user_birth_place"].ToString();
             }
             if (returnData["user_birth_date"] != DBNull.Value)
             {
                 user.user_birth_date = Convert.ToDateTime(returnData["user_birth_date"].ToString());
             }
             if (returnData["user_address"] != DBNull.Value)
             {
                 user.user_address = returnData["user_address"].ToString();
             }
             if (returnData["user_social_number"] != DBNull.Value)
             {
                 user.user_social_number = returnData["user_social_number"].ToString();
             }
             if (returnData["user_phone_number"] != DBNull.Value)
             {
                 user.user_phone_number = returnData["user_phone_number"].ToString();
             }
             if (returnData["user_id_card_file"] != DBNull.Value)
             {
                 user.user_id_card_file = returnData["user_id_card_file"].ToString();
             }
             if (returnData["user_photo_file"] != DBNull.Value)
             {
                 user.user_photo_file = returnData["user_photo_file"].ToString();
             }
             if (returnData["user_gender"] != DBNull.Value)
             {
                 user.user_gender = returnData["user_gender"].ToString();
             }
             if (returnData["user_marital_status"] != DBNull.Value)
             {
                 user.user_marital_status = returnData["user_marital_status"].ToString();
             }
             if (returnData["created_by"] != DBNull.Value)
             {
                 user.created_by = returnData["created_by"].ToString();
             }
             if (returnData["created_date"] != DBNull.Value)
             {
                 user.created_date = Convert.ToDateTime(returnData["created_date"].ToString());
             }
             if (returnData["updated_by"] != DBNull.Value)
             {
                 user.updated_by = returnData["updated_by"].ToString();
             }
             if (returnData["updated_date"] != DBNull.Value)
             {
                 user.updated_date = Convert.ToDateTime(returnData["updated_date"].ToString());
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
コード例 #2
0
 private static void TGenerateObjFromReader <T>(SqlDataReader returnData, ref CUser user)
 {
     try
     {
         while (returnData.Read())
         {
             COrder oObj = new COrder();
             if (returnData["order_id"] != DBNull.Value)
             {
                 oObj.order_id = Convert.ToInt32(returnData["order_id"]);
             }
             if (returnData["full_name"] != DBNull.Value)
             {
                 oObj.full_name = returnData["full_name"].ToString();
             }
             if (returnData["address"] != DBNull.Value)
             {
                 oObj.address = returnData["address"].ToString();
             }
             if (returnData["zip_code"] != DBNull.Value)
             {
                 oObj.zip_code = returnData["zip_code"].ToString();
             }
             if (returnData["area"] != DBNull.Value)
             {
                 oObj.area = returnData["area"].ToString();
             }
             if (returnData["country"] != DBNull.Value)
             {
                 oObj.country = returnData["country"].ToString();
             }
             if (returnData["phone"] != DBNull.Value)
             {
                 oObj.phone = returnData["phone"].ToString();
             }
             if (returnData["mobile_phone"] != DBNull.Value)
             {
                 oObj.mobile_phone = returnData["mobile_phone"].ToString();
             }
             if (returnData["id_card_number"] != DBNull.Value)
             {
                 oObj.id_card_number = returnData["id_card_number"].ToString();
             }
             if (returnData["birth_date"] != DBNull.Value)
             {
                 oObj.birth_date = Convert.ToDateTime(returnData["birth_date"].ToString());
             }
             if (returnData["height"] != DBNull.Value)
             {
                 oObj.height = Convert.ToDecimal(returnData["height"].ToString());
             }
             if (returnData["weight"] != DBNull.Value)
             {
                 oObj.weight = Convert.ToDecimal(returnData["weight"].ToString());
             }
             if (returnData["gender"] != DBNull.Value)
             {
                 oObj.gender = returnData["gender"].ToString();
             }
             if (returnData["marriage_status"] != DBNull.Value)
             {
                 oObj.marriage_status = returnData["marriage_status"].ToString();
             }
             if (returnData["haji"] != DBNull.Value)
             {
                 oObj.haji = Convert.ToInt32(returnData["haji"].ToString());
             }
             if (returnData["pewaris_name"] != DBNull.Value)
             {
                 oObj.pewaris_name = returnData["pewaris_name"].ToString();
             }
             if (returnData["pewaris_id_card_number"] != DBNull.Value)
             {
                 oObj.pewaris_id_card_number = returnData["pewaris_id_card_number"].ToString();
             }
             if (returnData["pewaris_relation"] != DBNull.Value)
             {
                 oObj.pewaris_relation = returnData["pewaris_relation"].ToString();
             }
             if (returnData["pewaris_gender"] != DBNull.Value)
             {
                 oObj.pewaris_gender = returnData["pewaris_gender"].ToString();
             }
             if (returnData["pewaris_phone"] != DBNull.Value)
             {
                 oObj.pewaris_phone = returnData["pewaris_phone"].ToString();
             }
             if (returnData["pewaris_payment_for"] != DBNull.Value)
             {
                 oObj.pewaris_payment_for = returnData["pewaris_payment_for"].ToString();
             }
             if (returnData["order_money"] != DBNull.Value)
             {
                 oObj.money = Convert.ToDecimal(returnData["order_money"].ToString());
             }
             if (returnData["check_number"] != DBNull.Value)
             {
                 oObj.check_number = returnData["check_number"].ToString();
             }
             if (returnData["order_name"] != DBNull.Value)
             {
                 oObj.order_name = returnData["order_name"].ToString();
             }
             if (returnData["order_tarikh"] != DBNull.Value)
             {
                 oObj.order_tarikh = Convert.ToDateTime(returnData["order_tarikh"].ToString());
             }
             if (returnData["order_kp_number"] != DBNull.Value)
             {
                 oObj.order_kp_number = returnData["order_kp_number"].ToString();
             }
             if (returnData["wakil_name"] != DBNull.Value)
             {
                 oObj.wakil_name = returnData["wakil_name"].ToString();
             }
             if (returnData["wakil_tarikh"] != DBNull.Value)
             {
                 oObj.wakil_tarikh = Convert.ToDateTime(returnData["wakil_tarikh"].ToString());
             }
             if (returnData["wakil_code"] != DBNull.Value)
             {
                 oObj.wakil_code = returnData["wakil_code"].ToString();
             }
             if (returnData["created_by"] != DBNull.Value)
             {
                 user.created_by = returnData["created_by"].ToString();
             }
             if (returnData["created_date"] != DBNull.Value)
             {
                 user.created_date = Convert.ToDateTime(returnData["created_date"].ToString());
             }
             if (returnData["updated_by"] != DBNull.Value)
             {
                 user.updated_by = returnData["updated_by"].ToString();
             }
             if (returnData["updated_date"] != DBNull.Value)
             {
                 user.updated_date = Convert.ToDateTime(returnData["updated_date"].ToString());
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }