Exemple #1
0
        protected override void SaveToRow()
        {
            SummitDS.AccidentReportDataTable _thisTable = new SummitDS.AccidentReportDataTable();
            if (_rowToSave == null)
            {
                _rowToSave = _thisTable.NewAccidentReportRow();
            }
            SummitDS.AccidentReportRow _dataRow = _rowToSave as SummitDS.AccidentReportRow;

            if (_dataRow != null)
            {
                if (IsExisting())
                {
                    if (iUserId.HasValue)
                    {
                        _dataRow.user_id = iUserId.Value;
                    }
                    else
                    {
                        _dataRow.Setuser_idNull();
                    }

                    if (String.IsNullOrEmpty(m_strStreet))
                    {
                        if (!_dataRow.IsstreetNull())
                        {
                            _dataRow.SetstreetNull();
                        }
                    }
                    else if (_dataRow.IsstreetNull() ? true : _dataRow.street != m_strStreet)
                    {
                        _dataRow.street = m_strStreet;
                    }

                    if (String.IsNullOrEmpty(m_strCity))
                    {
                        if (!_dataRow.IscityNull())
                        {
                            _dataRow.SetcityNull();
                        }
                    }
                    else if (_dataRow.IscityNull() ? true : _dataRow.city != m_strCity)
                    {
                        _dataRow.city = m_strCity;
                    }

                    if (String.IsNullOrEmpty(m_strState))
                    {
                        if (!_dataRow.IsstateNull())
                        {
                            _dataRow.SetstateNull();
                        }
                    }
                    else if (_dataRow.IsstateNull() ? true : _dataRow.state != m_strState)
                    {
                        _dataRow.state = m_strState;
                    }

                    if (String.IsNullOrEmpty(m_strDescription))
                    {
                        if (!_dataRow.IsdescriptionNull())
                        {
                            _dataRow.SetdescriptionNull();
                        }
                    }
                    else if (_dataRow.IsdescriptionNull() ? true : _dataRow.description != m_strDescription)
                    {
                        _dataRow.description = m_strDescription;
                    }

                    if (String.IsNullOrEmpty(m_strDriverName))
                    {
                        if (!_dataRow.Isdriver_nameNull())
                        {
                            _dataRow.Setdriver_nameNull();
                        }
                    }
                    else if (_dataRow.Isdriver_nameNull() ? true : _dataRow.driver_name != m_strDriverName)
                    {
                        _dataRow.driver_name = m_strDriverName;
                    }

                    if (String.IsNullOrEmpty(m_strDriverPhone))
                    {
                        if (!_dataRow.Isdriver_phoneNull())
                        {
                            _dataRow.Setdriver_phoneNull();
                        }
                    }
                    else if (_dataRow.Isdriver_phoneNull() ? true : _dataRow.driver_phone != m_strDriverPhone)
                    {
                        _dataRow.driver_phone = m_strDriverPhone;
                    }

                    if (String.IsNullOrEmpty(m_strDriverLicenseStatePlate))
                    {
                        if (!_dataRow.Isdriver_license_state_plateNull())
                        {
                            _dataRow.Setdriver_license_state_plateNull();
                        }
                    }
                    else if (_dataRow.Isdriver_license_state_plateNull() ? true : _dataRow.driver_license_state_plate != m_strDriverLicenseStatePlate)
                    {
                        _dataRow.driver_license_state_plate = m_strDriverLicenseStatePlate;
                    }

                    if (String.IsNullOrEmpty(m_strDriverLicenseNo))
                    {
                        if (!_dataRow.Isdriver_license_noNull())
                        {
                            _dataRow.Setdriver_license_noNull();
                        }
                    }
                    else if (_dataRow.Isdriver_license_noNull() ? true : _dataRow.driver_license_no != m_strDriverLicenseNo)
                    {
                        _dataRow.driver_license_no = m_strDriverLicenseNo;
                    }

                    if (String.IsNullOrEmpty(m_strDriverVehicleType))
                    {
                        if (!_dataRow.Isdriver_vehicle_typeNull())
                        {
                            _dataRow.Setdriver_vehicle_typeNull();
                        }
                    }
                    else if (_dataRow.Isdriver_vehicle_typeNull() ? true : _dataRow.driver_vehicle_type != m_strDriverVehicleType)
                    {
                        _dataRow.driver_vehicle_type = m_strDriverVehicleType;
                    }

                    if (String.IsNullOrEmpty(m_strInsuranceCompanyName))
                    {
                        if (!_dataRow.Isinsurance_company_nameNull())
                        {
                            _dataRow.Setinsurance_company_nameNull();
                        }
                    }
                    else if (_dataRow.Isinsurance_company_nameNull() ? true : _dataRow.insurance_company_name != m_strInsuranceCompanyName)
                    {
                        _dataRow.insurance_company_name = m_strInsuranceCompanyName;
                    }

                    if (String.IsNullOrEmpty(m_strInsurancePolicyNo))
                    {
                        if (!_dataRow.Isinsurance_policy_noNull())
                        {
                            _dataRow.Setinsurance_policy_noNull();
                        }
                    }
                    else if (_dataRow.Isinsurance_policy_noNull() ? true : _dataRow.insurance_policy_no != m_strInsurancePolicyNo)
                    {
                        _dataRow.insurance_policy_no = m_strInsurancePolicyNo;
                    }

                    if (String.IsNullOrEmpty(m_strPoliceOffice))
                    {
                        if (!_dataRow.Ispolice_officeNull())
                        {
                            _dataRow.Setpolice_officeNull();
                        }
                    }
                    else if (_dataRow.Ispolice_officeNull() ? true : _dataRow.police_office != m_strPoliceOffice)
                    {
                        _dataRow.police_office = m_strPoliceOffice;
                    }

                    if (String.IsNullOrEmpty(m_strPoliceReportNo))
                    {
                        if (!_dataRow.Ispolice_report_noNull())
                        {
                            _dataRow.Setpolice_report_noNull();
                        }
                    }
                    else if (_dataRow.Ispolice_report_noNull() ? true : _dataRow.police_report_no != m_strPoliceReportNo)
                    {
                        _dataRow.police_report_no = m_strPoliceReportNo;
                    }

                    if (String.IsNullOrEmpty(m_strWitnesses))
                    {
                        if (!_dataRow.IswitnessesNull())
                        {
                            _dataRow.SetwitnessesNull();
                        }
                    }
                    else if (_dataRow.IswitnessesNull() ? true : _dataRow.witnesses != m_strWitnesses)
                    {
                        _dataRow.witnesses = m_strWitnesses;
                    }

                    if (String.IsNullOrEmpty(m_strWitnessComments))
                    {
                        if (!_dataRow.Iswitness_commentsNull())
                        {
                            _dataRow.Setwitness_commentsNull();
                        }
                    }
                    else if (_dataRow.Iswitness_commentsNull() ? true : _dataRow.witness_comments != m_strWitnessComments)
                    {
                        _dataRow.witness_comments = m_strWitnessComments;
                    }

                    if (String.IsNullOrEmpty(m_strMiscNotes))
                    {
                        if (!_dataRow.Ismisc_notesNull())
                        {
                            _dataRow.Setmisc_notesNull();
                        }
                    }
                    else if (_dataRow.Ismisc_notesNull() ? true : _dataRow.misc_notes != m_strMiscNotes)
                    {
                        _dataRow.misc_notes = m_strMiscNotes;
                    }

                    if (String.IsNullOrEmpty(m_strImageAttached))
                    {
                        if (!_dataRow.Isimage_nameNull())
                        {
                            _dataRow.Setimage_nameNull();
                        }
                    }
                    else if (_dataRow.Isimage_nameNull() ? true : _dataRow.image_name != m_strImageAttached)
                    {
                        _dataRow.image_name = m_strImageAttached;
                    }

                    if (iMessageId.HasValue)
                    {
                        _dataRow.message_id = iMessageId.Value;
                    }
                    else
                    {
                        _dataRow.Setmessage_idNull();
                    }
                }
                else
                {
                    if (iUserId.HasValue)
                    {
                        _dataRow.user_id = iUserId.Value;
                    }
                    else
                    {
                        _dataRow.Setuser_idNull();
                    }

                    if (String.IsNullOrEmpty(strStreet))
                    {
                        _dataRow.SetstreetNull();
                    }
                    else
                    {
                        _dataRow.street = strStreet;
                    }

                    if (String.IsNullOrEmpty(strCity))
                    {
                        _dataRow.SetcityNull();
                    }
                    else
                    {
                        _dataRow.city = strCity;
                    }

                    if (String.IsNullOrEmpty(strState))
                    {
                        _dataRow.SetstateNull();
                    }
                    else
                    {
                        _dataRow.state = strState;
                    }

                    if (String.IsNullOrEmpty(strDescription))
                    {
                        _dataRow.SetdescriptionNull();
                    }
                    else
                    {
                        _dataRow.description = strDescription;
                    }

                    if (String.IsNullOrEmpty(strDriverName))
                    {
                        _dataRow.Setdriver_nameNull();
                    }
                    else
                    {
                        _dataRow.driver_name = strDriverName;
                    }

                    if (String.IsNullOrEmpty(strDriverPhone))
                    {
                        _dataRow.Setdriver_phoneNull();
                    }
                    else
                    {
                        _dataRow.driver_phone = strDriverPhone;
                    }

                    if (String.IsNullOrEmpty(strDriverLicenseStatePlate))
                    {
                        _dataRow.Setdriver_license_state_plateNull();
                    }
                    else
                    {
                        _dataRow.driver_license_state_plate = strDriverLicenseStatePlate;
                    }

                    if (String.IsNullOrEmpty(strDriverLicenseNo))
                    {
                        _dataRow.Setdriver_license_noNull();
                    }
                    else
                    {
                        _dataRow.driver_license_no = strDriverLicenseNo;
                    }

                    if (String.IsNullOrEmpty(strDriverVehicleType))
                    {
                        _dataRow.Setdriver_vehicle_typeNull();
                    }
                    else
                    {
                        _dataRow.driver_vehicle_type = strDriverVehicleType;
                    }

                    if (String.IsNullOrEmpty(strInsuranceCompanyName))
                    {
                        _dataRow.Setinsurance_company_nameNull();
                    }
                    else
                    {
                        _dataRow.insurance_company_name = strInsuranceCompanyName;
                    }

                    if (String.IsNullOrEmpty(strInsurancePolicyNo))
                    {
                        _dataRow.Setinsurance_policy_noNull();
                    }
                    else
                    {
                        _dataRow.insurance_policy_no = strInsurancePolicyNo;
                    }

                    if (String.IsNullOrEmpty(strPoliceOffice))
                    {
                        _dataRow.Setpolice_officeNull();
                    }
                    else
                    {
                        _dataRow.police_office = strPoliceOffice;
                    }

                    if (String.IsNullOrEmpty(strPoliceReportNo))
                    {
                        _dataRow.Setpolice_report_noNull();
                    }
                    else
                    {
                        _dataRow.police_report_no = strPoliceReportNo;
                    }

                    if (String.IsNullOrEmpty(strWitnesses))
                    {
                        _dataRow.SetwitnessesNull();
                    }
                    else
                    {
                        _dataRow.witnesses = strWitnesses;
                    }

                    if (String.IsNullOrEmpty(strWitnessComments))
                    {
                        _dataRow.Setwitness_commentsNull();
                    }
                    else
                    {
                        _dataRow.witness_comments = strWitnessComments;
                    }

                    if (String.IsNullOrEmpty(strMiscNotes))
                    {
                        _dataRow.Setmisc_notesNull();
                    }
                    else
                    {
                        _dataRow.misc_notes = strMiscNotes;
                    }

                    if (String.IsNullOrEmpty(strImageAttached))
                    {
                        _dataRow.Setimage_nameNull();
                    }
                    else
                    {
                        _dataRow.image_name = strImageAttached;
                    }

                    if (iMessageId.HasValue)
                    {
                        _dataRow.message_id = iMessageId.Value;
                    }
                    else
                    {
                        _dataRow.Setmessage_idNull();
                    }

                    _thisTable.AddAccidentReportRow(_dataRow);
                }
            }
        }