def createVariable(self): v = Variable() v.code = self.txtVarCode.GetValue( ) if self.txtVarCode.GetValue() <> u'' else None v.name = self.cbVarName.GetValue( ) if self.cbVarName.GetValue() <> u'' else None v.speciation = self.cbSpeciation.GetValue( ) if self.cbSpeciation.GetValue() <> u'' else None v.variable_unit = self.series_service.get_unit_by_name( self.cbVarUnits.GetValue()) v.variable_unit_id = v.variable_unit.id v.sample_medium = self.cbSampleMedium.GetValue( ) if self.cbSampleMedium.GetValue() <> u'' else None v.value_type = self.cbValueType.GetValue( ) if self.cbValueType.GetValue() <> u'' else None v.is_regular = self.cbIsRegular.GetValue( ) if self.cbIsRegular.GetValue() <> u'' else None v.time_support = self.txtTSValue.GetValue( ) if self.txtTSValue.GetValue() <> u'' else None v.time_unit = self.series_service.get_unit_by_name( self.cbTSUnits.GetValue()) v.time_unit_id = v.time_unit.id v.data_type = self.cbDataType.GetValue( ) if self.cbDataType.GetValue() <> u'' else None v.general_category = self.cbGenCat.GetValue( ) if self.cbGenCat.GetValue() <> u'' else None v.no_data_value = self.txtNoDV.GetValue( ) if self.txtNoDV.GetValue() <> u'' else None return v
def create_variable( self, code, name, speciation, variable_unit_id, sample_medium, value_type, is_regular, time_support, time_unit_id, data_type, general_category, no_data_value, ): """ :param code: :param name: :param speciation: :param variable_unit_id: :param sample_medium: :param value_type: :param is_regular: :param time_support: :param time_unit_id: :param data_type: :param general_category: :param no_data_value: :return: """ var = Variable() var.code = code var.name = name var.speciation = speciation var.variable_unit_id = variable_unit_id var.sample_medium = sample_medium var.value_type = value_type var.is_regular = is_regular var.time_support = time_support var.time_unit_id = time_unit_id var.data_type = data_type var.general_category = general_category var.no_data_value = no_data_value self._edit_session.add(var) self._edit_session.commit() return var
def createVariable(self): v = Variable() v.code = self.txtVarCode.GetValue() if self.txtVarCode.GetValue() <> u'' else None v.name = self.cbVarName.GetValue() if self.cbVarName.GetValue() <> u'' else None v.speciation = self.cbSpeciation.GetValue() if self.cbSpeciation.GetValue() <> u'' else None v.variable_unit = self.series_service.get_unit_by_name( self.cbVarUnits.GetValue()) v.variable_unit_id = v.variable_unit.id v.sample_medium = self.cbSampleMedium.GetValue() if self.cbSampleMedium.GetValue() <> u'' else None v.value_type = self.cbValueType.GetValue() if self.cbValueType.GetValue() <> u'' else None v.is_regular = self.cbIsRegular.GetValue() if self.cbIsRegular.GetValue() <> u'' else None v.time_support = self.txtTSValue.GetValue() if self.txtTSValue.GetValue() <> u'' else None v.time_unit = self.series_service.get_unit_by_name(self.cbTSUnits.GetValue()) v.time_unit_id = v.time_unit.id v.data_type = self.cbDataType.GetValue() if self.cbDataType.GetValue() <> u'' else None v.general_category = self.cbGenCat.GetValue() if self.cbGenCat.GetValue() <> u'' else None v.no_data_value = self.txtNoDV.GetValue() if self.txtNoDV.GetValue() <> u'' else None return v
def create_variable(self, code, name, speciation, variable_unit_id, sample_medium, value_type, is_regular, time_support, time_unit_id, data_type, general_category, no_data_value): """ :param code: :param name: :param speciation: :param variable_unit_id: :param sample_medium: :param value_type: :param is_regular: :param time_support: :param time_unit_id: :param data_type: :param general_category: :param no_data_value: :return: """ var = Variable() var.code = code var.name = name var.speciation = speciation var.variable_unit_id = variable_unit_id var.sample_medium = sample_medium var.value_type = value_type var.is_regular = is_regular var.time_support = time_support var.time_unit_id = time_unit_id var.data_type = data_type var.general_category = general_category var.no_data_value = no_data_value self._edit_session.add(var) self._edit_session.commit() return var