/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(CCondition_variable businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_condition_variable_Update"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idcondition_variable", businessObject.Idcondition_variable); sqlCommand.Parameters["p_idcondition_variable"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_name_variable", businessObject.Name_variable); sqlCommand.Parameters["p_name_variable"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_operation", businessObject.Operation); sqlCommand.Parameters["p_operation"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_name_value1", businessObject.Name_value1); sqlCommand.Parameters["p_name_value1"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_name_value2", businessObject.Name_value2); sqlCommand.Parameters["p_name_value2"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_idvalue1", businessObject.Idvalue1); sqlCommand.Parameters["p_idvalue1"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idvalue2", businessObject.Idvalue2); sqlCommand.Parameters["p_idvalue2"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_message", businessObject.Message); sqlCommand.Parameters["p_message"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_idtemplate_method", businessObject.Idtemplate_method); sqlCommand.Parameters["p_idtemplate_method"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idtemplate_method_detail", businessObject.Idtemplate_method_detail); sqlCommand.Parameters["p_idtemplate_method_detail"].NpgsqlDbType = NpgsqlDbType.Bigint; MainConnection.Open(); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { return(true); } return(false); } catch (Exception ex) { throw new Exception("CCondition_variable::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(CSolution_titration businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_solution_titration_Update"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idsolution_titration", businessObject.Idsolution_titration); sqlCommand.Parameters["p_idsolution_titration"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idtitration_main", businessObject.Idtitration_main); sqlCommand.Parameters["p_idtitration_main"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idsolution", businessObject.Idsolution); sqlCommand.Parameters["p_idsolution"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_aliquot", businessObject.Aliquot); sqlCommand.Parameters["p_aliquot"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_theorical_reading", businessObject.Theorical_reading); sqlCommand.Parameters["p_theorical_reading"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_practice_reading", businessObject.Practice_reading); sqlCommand.Parameters["p_practice_reading"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_factor", businessObject.Factor); sqlCommand.Parameters["p_factor"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_prepared_by", businessObject.Prepared_by); sqlCommand.Parameters["p_prepared_by"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_date_prepared", businessObject.Date_prepared); sqlCommand.Parameters["p_date_prepared"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_status_titration", businessObject.Status_titration); sqlCommand.Parameters["p_status_titration"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_average", businessObject.Average); sqlCommand.Parameters["p_average"].NpgsqlDbType = NpgsqlDbType.Numeric; MainConnection.Open(); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { return(true); } return(false); } catch (Exception ex) { throw new Exception("CSolution_titration::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(CRecep_company_person businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_recep_company_person_Update"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idrecep_company_person", businessObject.Idrecep_company_person); sqlCommand.Parameters["p_idrecep_company_person"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_idcompany", businessObject.Idcompany); sqlCommand.Parameters["p_idcompany"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_idperson", businessObject.Idperson); sqlCommand.Parameters["p_idperson"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_idrecep_sample", businessObject.Idrecep_sample); sqlCommand.Parameters["p_idrecep_sample"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_person_type", businessObject.Person_type); sqlCommand.Parameters["p_person_type"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_enabled_show", businessObject.Enabled_show); sqlCommand.Parameters["p_enabled_show"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { return(true); } return(false); } catch (Exception ex) { throw new Exception("CRecep_company_person::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(CCorrelative businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_correlative_Update"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_cod_type_sample", businessObject.Cod_type_sample); sqlCommand.Parameters["p_cod_type_sample"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_cod_serie", businessObject.Cod_serie); sqlCommand.Parameters["p_cod_serie"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_prefix", businessObject.Prefix); sqlCommand.Parameters["p_prefix"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_correlative", businessObject.Correlative); sqlCommand.Parameters["p_correlative"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_mreach15", businessObject.Mreach15); sqlCommand.Parameters["p_mreach15"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_num_digits", businessObject.Num_digits); sqlCommand.Parameters["p_num_digits"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { return(true); } return(false); } catch (Exception ex) { throw new Exception("CCorrelative::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(CCells_reported businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_cells_reported_Update"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idcell_reported", businessObject.Idcell_reported); sqlCommand.Parameters["p_idcell_reported"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_idrecep_sample_detail_elem", businessObject.Idrecep_sample_detail_elem); sqlCommand.Parameters["p_idrecep_sample_detail_elem"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_idrecep_sample_report", businessObject.Idrecep_sample_report); sqlCommand.Parameters["p_idrecep_sample_report"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_idtemplate_method", businessObject.Idtemplate_method); sqlCommand.Parameters["p_idtemplate_method"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idrecep_sample_detail", businessObject.Idrecep_sample_detail); sqlCommand.Parameters["p_idrecep_sample_detail"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_flag_confirm_report", businessObject.Flag_confirm_report); sqlCommand.Parameters["p_flag_confirm_report"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { return(true); } return(false); } catch (Exception ex) { throw new Exception("CCells_reported::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CDestiny_samples businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_destiny_samples_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_iddestiny_samples", businessObject.Iddestiny_samples); sqlCommand.Parameters["p_iddestiny_samples"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters["p_iddestiny_samples"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_description", businessObject.Description); sqlCommand.Parameters["p_description"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_cost_counter_sample", businessObject.Cost_counter_sample); sqlCommand.Parameters["p_cost_counter_sample"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_cost_reject_sample", businessObject.Cost_reject_sample); sqlCommand.Parameters["p_cost_reject_sample"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_time_without_cost", businessObject.Time_without_cost); sqlCommand.Parameters["p_time_without_cost"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Iddestiny_samples = Convert.ToInt32(sqlCommand.Parameters["p_iddestiny_samples"].Value); return(true); } catch (Exception ex) { throw new Exception("CDestiny_samples::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CSet_calibs businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_set_calibs_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idset_calibs", businessObject.Idset_calibs); sqlCommand.Parameters["p_idset_calibs"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters["p_idset_calibs"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_calib_group_name", businessObject.Calib_group_name); sqlCommand.Parameters["p_calib_group_name"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_r", businessObject.R); sqlCommand.Parameters["p_r"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_a", businessObject.A); sqlCommand.Parameters["p_a"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_b", businessObject.B); sqlCommand.Parameters["p_b"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_idtemplate_method", businessObject.Idtemplate_method); sqlCommand.Parameters["p_idtemplate_method"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idsolution_interm", businessObject.Idsolution_interm); sqlCommand.Parameters["p_idsolution_interm"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_usersign", businessObject.Usersign); sqlCommand.Parameters["p_usersign"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datesign", businessObject.Datesign); sqlCommand.Parameters["p_datesign"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_last_calib", businessObject.Last_calib); sqlCommand.Parameters["p_last_calib"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Idset_calibs = Convert.ToInt32(sqlCommand.Parameters["p_idset_calibs"].Value); return(true); } catch (Exception ex) { throw new Exception("CSet_calibs::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CConfiguration_folder businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_configuration_folder_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idconfiguration_folder", businessObject.Idconfiguration_folder); sqlCommand.Parameters["p_idconfiguration_folder"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters["p_idconfiguration_folder"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_folder_name", businessObject.Folder_name); sqlCommand.Parameters["p_folder_name"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_description", businessObject.Description); sqlCommand.Parameters["p_description"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_path", businessObject.Path); sqlCommand.Parameters["p_path"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_folder_type", businessObject.Folder_type); sqlCommand.Parameters["p_folder_type"].NpgsqlDbType = NpgsqlDbType.Char; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Idconfiguration_folder = Convert.ToInt16(sqlCommand.Parameters["p_idconfiguration_folder"].Value); return(true); } catch (Exception ex) { throw new Exception("CConfiguration_folder::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public bool Insert(EmployeePro pro) { SqlCommand sqlCommand = new SqlCommand("dbo.[Employee_Insert]", MainConnection); sqlCommand.CommandType = CommandType.StoredProcedure; try { sqlCommand.Parameters.Add(new SqlParameter("@EmpID", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpID)); sqlCommand.Parameters.Add(new SqlParameter("@EmpType", SqlDbType.VarChar, 3, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpType)); sqlCommand.Parameters.Add(new SqlParameter("@EmpNameAr", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpNameAr)); sqlCommand.Parameters.Add(new SqlParameter("@EmpNameEn", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpNameEn)); sqlCommand.Parameters.Add(new SqlParameter("@NatID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.NatID)); sqlCommand.Parameters.Add(new SqlParameter("@EmpBirthDate", SqlDbType.VarChar, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, DateFun.SaveDB('S', pro.EmpBirthDate))); sqlCommand.Parameters.Add(new SqlParameter("@EmpJobTitleAr", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpJobTitleAr)); sqlCommand.Parameters.Add(new SqlParameter("@EmpJobTitleEn", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpJobTitleEn)); sqlCommand.Parameters.Add(new SqlParameter("@EmpNationalID", SqlDbType.VarChar, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpNationalID)); sqlCommand.Parameters.Add(new SqlParameter("@EmpBloodGroup", SqlDbType.VarChar, 3, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpBloodGroup)); sqlCommand.Parameters.Add(new SqlParameter("@CompID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.CompID)); sqlCommand.Parameters.Add(new SqlParameter("@SecID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.SecID)); if (!String.IsNullOrEmpty(pro.EmpHireDate)) { sqlCommand.Parameters.Add(new SqlParameter("@EmpHireDate", SqlDbType.VarChar, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, DateFun.SaveDB('S', pro.EmpHireDate))); } sqlCommand.Parameters.Add(new SqlParameter("@EmpGender", SqlDbType.Char, 1, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpGender)); sqlCommand.Parameters.Add(new SqlParameter("@EmpMobileNo", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpMobileNo)); sqlCommand.Parameters.Add(new SqlParameter("@EmpEmailID", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpEmailID)); if (pro.EmpImageLength > 0) { sqlCommand.Parameters.Add(new SqlParameter("@Image", SqlDbType.Image, 1000000, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpImage)); sqlCommand.Parameters.Add(new SqlParameter("@ImageContentType", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpImageContentType)); sqlCommand.Parameters.Add(new SqlParameter("@ImageLength", SqlDbType.BigInt, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.EmpImageLength.ToString())); } sqlCommand.Parameters.Add(new SqlParameter("@TransactionBy", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, pro.TransactionBy)); MainConnection.Open(); sqlCommand.ExecuteNonQuery(); return(true); } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(CTemplate_method_icp businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_template_method_icp_Update"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idtemplate_method", businessObject.Idtemplate_method); sqlCommand.Parameters["p_idtemplate_method"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_volumen", businessObject.Volumen); sqlCommand.Parameters["p_volumen"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_aliquot", businessObject.Aliquot); sqlCommand.Parameters["p_aliquot"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_dilution_flag", businessObject.Dilution_flag); sqlCommand.Parameters["p_dilution_flag"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_dilution_value", businessObject.Dilution_value); sqlCommand.Parameters["p_dilution_value"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { return(true); } return(false); } catch (Exception ex) { throw new Exception("CTemplate_method_icp::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(BENHNHAN businessObject) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "dbo.[BENHNHAN_Update]"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.Add(new SqlParameter("@ID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.ID)); sqlCommand.Parameters.Add(new SqlParameter("@HOTEN", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.HOTEN)); sqlCommand.Parameters.Add(new SqlParameter("@GIOITINH", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.GIOITINH)); sqlCommand.Parameters.Add(new SqlParameter("@SDT", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.SDT)); sqlCommand.Parameters.Add(new SqlParameter("@QUEQUAN", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.QUEQUAN)); sqlCommand.Parameters.Add(new SqlParameter("@NGAYSINH", SqlDbType.DateTime, 8, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.NGAYSINH)); sqlCommand.Parameters.Add(new SqlParameter("@MATHEBHYT", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.MATHEBHYT)); sqlCommand.Parameters.Add(new SqlParameter("@NAMNHAPNGU", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.NAMNHAPNGU)); sqlCommand.Parameters.Add(new SqlParameter("@TRINHDOVANHOA", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.TRINHDOVANHOA)); sqlCommand.Parameters.Add(new SqlParameter("@CAPBACID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.CAPBACID)); sqlCommand.Parameters.Add(new SqlParameter("@CHUCVUID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.CHUCVUID)); sqlCommand.Parameters.Add(new SqlParameter("@NGHENGHIEPTRUOCNN", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.NGHENGHIEPTRUOCNN)); sqlCommand.Parameters.Add(new SqlParameter("@NGHENGHIEPSAUNN", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.NGHENGHIEPSAUNN)); sqlCommand.Parameters.Add(new SqlParameter("@DOITUONGID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.DOITUONGID)); sqlCommand.Parameters.Add(new SqlParameter("@DONVIID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.DONVIID)); sqlCommand.Parameters.Add(new SqlParameter("@TIENSUBANTHAN", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.TIENSUBANTHAN)); sqlCommand.Parameters.Add(new SqlParameter("@TIENSUGIADINH", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.TIENSUGIADINH)); sqlCommand.Parameters.Add(new SqlParameter("@DANTOC", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.DANTOC)); sqlCommand.Parameters.Add(new SqlParameter("@DIACHI", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.DIACHI)); sqlCommand.Parameters.Add(new SqlParameter("@TINHTRANGCONGTAC", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.TINHTRANGCONGTAC)); sqlCommand.Parameters.Add(new SqlParameter("@NHOMMAU", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.NHOMMAU)); sqlCommand.Parameters.Add(new SqlParameter("@DIUNG", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.DIUNG)); sqlCommand.Parameters.Add(new SqlParameter("@GHICHU", SqlDbType.NVarChar, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.GHICHU)); MainConnection.Open(); sqlCommand.ExecuteNonQuery(); return(true); } catch //(Exception ex) { return(false); //throw new Exception("BENHNHAN::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CSerie businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_serie_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_cod_serie", businessObject.Cod_serie); sqlCommand.Parameters["p_cod_serie"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_nom_serie", businessObject.Nom_serie); sqlCommand.Parameters["p_nom_serie"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_num_digits", businessObject.Num_digits); sqlCommand.Parameters["p_num_digits"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_dateinit", businessObject.Dateinit); sqlCommand.Parameters["p_dateinit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_dateend", businessObject.Dateend); sqlCommand.Parameters["p_dateend"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status_serie", businessObject.Status_serie); sqlCommand.Parameters["p_status_serie"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); return(true); } catch (Exception ex) { throw new Exception("CSerie::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(clsSongs businessObject) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "dbo.[sp_Songs_Insert]"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.Add(new SqlParameter("@IdSong", SqlDbType.Int, 4, ParameterDirection.Output, false, 0, 0, "", DataRowVersion.Proposed, businessObject.IdSong)); sqlCommand.Parameters.Add(new SqlParameter("@GENRE", SqlDbType.NVarChar, 400, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.GENRE)); sqlCommand.Parameters.Add(new SqlParameter("@LANGUAGE", SqlDbType.NVarChar, 400, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.LANGUAGE)); sqlCommand.Parameters.Add(new SqlParameter("@TVSHOW", SqlDbType.NVarChar, 400, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.TVSHOW)); sqlCommand.Parameters.Add(new SqlParameter("@ARTIST", SqlDbType.NVarChar, 400, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.ARTIST)); sqlCommand.Parameters.Add(new SqlParameter("@TITLE", SqlDbType.NVarChar, 400, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.TITLE)); sqlCommand.Parameters.Add(new SqlParameter("@VERSION", SqlDbType.NVarChar, 400, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.VERSION)); sqlCommand.Parameters.Add(new SqlParameter("@LABEL", SqlDbType.NVarChar, 400, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.LABEL)); sqlCommand.Parameters.Add(new SqlParameter("@FILENAME", SqlDbType.NVarChar, 400, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.FILENAME)); sqlCommand.Parameters.Add(new SqlParameter("@Spotify", SqlDbType.NVarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.Spotify)); sqlCommand.Parameters.Add(new SqlParameter("@CompanyId", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.CompanyId)); sqlCommand.Parameters.Add(new SqlParameter("@LabelId", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.LabelId)); sqlCommand.Parameters.Add(new SqlParameter("@RadioDate", SqlDbType.DateTime, 8, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.RadioDate)); sqlCommand.Parameters.Add(new SqlParameter("@IncludeInFirstPlay", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.IncludeInFirstPlay)); sqlCommand.Parameters.Add(new SqlParameter("@IncludeInNewTalent", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.IncludeInNewTalent)); sqlCommand.Parameters.Add(new SqlParameter("@PromotionId", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.PromotionId)); sqlCommand.Parameters.Add(new SqlParameter("@SingRing", SqlDbType.BigInt, 8, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.SingRing)); sqlCommand.Parameters.Add(new SqlParameter("@FirstPlayDate", SqlDbType.DateTime, 8, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.FirstPlayDate)); sqlCommand.Parameters.Add(new SqlParameter("@ParentSongId", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.ParentSongId)); sqlCommand.Parameters.Add(new SqlParameter("@Lyric", SqlDbType.Text, 2147483647, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.Lyric)); MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.IdSong = (int)sqlCommand.Parameters["@IdSong"].Value; return(true); } catch (Exception ex) { throw new Exception("clsSongs::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(clsContacts businessObject) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "dbo.[sp_InsertContacts]"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.Add(new SqlParameter("@EMP_ID", SqlDbType.Int, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.EMP_ID)); sqlCommand.Parameters.Add(new SqlParameter("@LAST_NAME", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.LAST_NAME)); sqlCommand.Parameters.Add(new SqlParameter("@FIRST_NAME", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.FIRST_NAME)); sqlCommand.Parameters.Add(new SqlParameter("@MIDDLE_NAME", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.MIDDLE_NAME)); sqlCommand.Parameters.Add(new SqlParameter("@NICK_NAME", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.NICK_NAME)); sqlCommand.Parameters.Add(new SqlParameter("@ACTIVE", SqlDbType.SmallInt, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.ACTIVE)); sqlCommand.Parameters.Add(new SqlParameter("@BIRTHDATE", SqlDbType.DateTime, 8, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.BIRTHDATE)); sqlCommand.Parameters.Add(new SqlParameter("@DT_HIRED", SqlDbType.DateTime, 8, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.DT_HIRED)); sqlCommand.Parameters.Add(new SqlParameter("@IMAGE_PATH", SqlDbType.VarChar, 255, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.IMAGE_PATH)); sqlCommand.Parameters.Add(new SqlParameter("@SHIFT", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.SHIFT)); sqlCommand.Parameters.Add(new SqlParameter("@EMAIL_ADDRESS", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.EMAIL_ADDRESS)); sqlCommand.Parameters.Add(new SqlParameter("@EMAIL_ADDRESS2", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.EMAIL_ADDRESS2)); sqlCommand.Parameters.Add(new SqlParameter("@LOCATION", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.LOCATION)); sqlCommand.Parameters.Add(new SqlParameter("@CEL_NO", SqlDbType.NVarChar, 11, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.CEL_NO)); sqlCommand.Parameters.Add(new SqlParameter("@LOCAL", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.LOCAL)); sqlCommand.Parameters.Add(new SqlParameter("@HOMEPHONE", SqlDbType.NVarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.HOMEPHONE)); sqlCommand.Parameters.Add(new SqlParameter("@OTHERPHONE", SqlDbType.NVarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.OTHER_PHONE)); sqlCommand.Parameters.Add(new SqlParameter("@DT_REVIEWED", SqlDbType.DateTime, 8, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, System.DateTime.Now)); sqlCommand.Parameters.Add(new SqlParameter("@MARITAL_STATUS_ID", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.MARITAL_STATUS_ID)); sqlCommand.Parameters.Add(new SqlParameter("@POSITION_ID", SqlDbType.SmallInt, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.POSITION_ID)); sqlCommand.Parameters.Add(new SqlParameter("@PERMISSION_GROUP_ID", SqlDbType.SmallInt, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.PERMISSION_GROUP_ID)); sqlCommand.Parameters.Add(new SqlParameter("@OLD_EMP_ID", SqlDbType.Int, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.OLD_EMP_ID)); MainConnection.Open(); sqlCommand.ExecuteNonQuery(); return(true); } catch (Exception ex) { throw new Exception("clsContacts::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CDecree businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_decree_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_iddecree", businessObject.Iddecree); sqlCommand.Parameters["p_iddecree"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters["p_iddecree"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_cod_decree", businessObject.Cod_decree); sqlCommand.Parameters["p_cod_decree"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_name_decree", businessObject.Name_decree); sqlCommand.Parameters["p_name_decree"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_description", businessObject.Description); sqlCommand.Parameters["p_description"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_cumple", businessObject.Cumple); sqlCommand.Parameters["p_cumple"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_nocumple", businessObject.Nocumple); sqlCommand.Parameters["p_nocumple"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_cumple_onlytest", businessObject.Cumple_onlytest); sqlCommand.Parameters["p_cumple_onlytest"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_conclusion", businessObject.Conclusion); sqlCommand.Parameters["p_conclusion"].NpgsqlDbType = NpgsqlDbType.Varchar; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Iddecree = Convert.ToInt32(sqlCommand.Parameters["p_iddecree"].Value); return(true); } catch (Exception ex) { throw new Exception("CDecree::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CPrice businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_price_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idprice", businessObject.Idprice); sqlCommand.Parameters["p_idprice"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters["p_idprice"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_cod_price", businessObject.Cod_price); sqlCommand.Parameters["p_cod_price"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dispatch_person", businessObject.Dispatch_person); sqlCommand.Parameters["p_dispatch_person"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_dispatch_mail", businessObject.Dispatch_mail); sqlCommand.Parameters["p_dispatch_mail"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_dispatch_curier", businessObject.Dispatch_curier); sqlCommand.Parameters["p_dispatch_curier"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_dispatch_transport", businessObject.Dispatch_transport); sqlCommand.Parameters["p_dispatch_transport"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_dispatch_fax", businessObject.Dispatch_fax); sqlCommand.Parameters["p_dispatch_fax"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_dispatch_otro", businessObject.Dispatch_otro); sqlCommand.Parameters["p_dispatch_otro"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_request_reference", businessObject.Request_reference); sqlCommand.Parameters["p_request_reference"].NpgsqlDbType = NpgsqlDbType.Integer; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Idprice = Convert.ToInt32(sqlCommand.Parameters["p_idprice"].Value); return(true); } catch (Exception ex) { throw new Exception("CPrice::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CTemplate_method_detail businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_template_method_detail_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idtemplate_method_detail", businessObject.Idtemplate_method_detail); sqlCommand.Parameters["p_idtemplate_method_detail"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters["p_idtemplate_method_detail"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_name_variable", businessObject.Name_variable); sqlCommand.Parameters["p_name_variable"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_alias_variable", businessObject.Alias_variable); sqlCommand.Parameters["p_alias_variable"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_value_variable", businessObject.Value_variable); sqlCommand.Parameters["p_value_variable"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_type_variable", businessObject.Type_variable); sqlCommand.Parameters["p_type_variable"].NpgsqlDbType = NpgsqlDbType.Char; sqlCommand.Parameters.AddWithValue("p_group_variable", businessObject.Group_variable); sqlCommand.Parameters["p_group_variable"].NpgsqlDbType = NpgsqlDbType.Char; sqlCommand.Parameters.AddWithValue("p_visible", businessObject.Visible); sqlCommand.Parameters["p_visible"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_idtemplate_method", businessObject.Idtemplate_method); sqlCommand.Parameters["p_idtemplate_method"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Idtemplate_method_detail = Convert.ToInt32(sqlCommand.Parameters["p_idtemplate_method_detail"].Value); return(true); } catch (Exception ex) { throw new Exception("CTemplate_method_detail::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CMeasurement_unit businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_measurement_unit_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idunit", businessObject.Idunit); sqlCommand.Parameters["p_idunit"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters["p_idunit"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_name_unit", businessObject.Name_unit); sqlCommand.Parameters["p_name_unit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_description", businessObject.Description); sqlCommand.Parameters["p_description"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_concentration_unit", businessObject.Concentration_unit); sqlCommand.Parameters["p_concentration_unit"].NpgsqlDbType = NpgsqlDbType.Integer; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Idunit = Convert.ToInt16(sqlCommand.Parameters["p_idunit"].Value); return(true); } catch (Exception ex) { throw new Exception("CMeasurement_unit::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CFactor_estequiometrico businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_factor_estequiometrico_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idfactor_estequiometrico", businessObject.Idfactor_estequiometrico); sqlCommand.Parameters["p_idfactor_estequiometrico"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters["p_idfactor_estequiometrico"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_idcompound", businessObject.Idcompound); sqlCommand.Parameters["p_idcompound"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idelement", businessObject.Idelement); sqlCommand.Parameters["p_idelement"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_factor", businessObject.Factor); sqlCommand.Parameters["p_factor"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Idfactor_estequiometrico = Convert.ToInt32(sqlCommand.Parameters["p_idfactor_estequiometrico"].Value); return(true); } catch (Exception ex) { throw new Exception("CFactor_estequiometrico::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CCells_attach_file businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_cells_attach_file_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idcells_attach_file", businessObject.Idcells_attach_file); sqlCommand.Parameters["p_idcells_attach_file"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters["p_idcells_attach_file"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_idrecep_sample_attach", businessObject.Idrecep_sample_attach); sqlCommand.Parameters["p_idrecep_sample_attach"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_idrecep_sample_detail_elem", businessObject.Idrecep_sample_detail_elem); sqlCommand.Parameters["p_idrecep_sample_detail_elem"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_idtemplate_method", businessObject.Idtemplate_method); sqlCommand.Parameters["p_idtemplate_method"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Idcells_attach_file = Convert.ToInt64(sqlCommand.Parameters["p_idcells_attach_file"].Value); return(true); } catch (Exception ex) { throw new Exception("CCells_attach_file::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CType_solution businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_type_solution_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idtype_solution", businessObject.Idtype_solution); sqlCommand.Parameters["p_idtype_solution"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters["p_idtype_solution"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_name_type_solution", businessObject.Name_type_solution); sqlCommand.Parameters["p_name_type_solution"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_num_days_expiration", businessObject.Num_days_expiration); sqlCommand.Parameters["p_num_days_expiration"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_observation", businessObject.Observation); sqlCommand.Parameters["p_observation"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Idtype_solution = Convert.ToInt32(sqlCommand.Parameters["p_idtype_solution"].Value); return(true); } catch (Exception ex) { throw new Exception("CType_solution::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CDecree_detail businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_decree_detail_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_iddecree_detail", businessObject.Iddecree_detail); sqlCommand.Parameters["p_iddecree_detail"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters["p_iddecree_detail"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_iddecree", businessObject.Iddecree); sqlCommand.Parameters["p_iddecree"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idunit", businessObject.Idunit); sqlCommand.Parameters["p_idunit"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idtemplate_method", businessObject.Idtemplate_method); sqlCommand.Parameters["p_idtemplate_method"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_parameter", businessObject.Parameter); sqlCommand.Parameters["p_parameter"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_idcondition", businessObject.Idcondition); sqlCommand.Parameters["p_idcondition"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_valor1", businessObject.Valor1); sqlCommand.Parameters["p_valor1"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_valor2", businessObject.Valor2); sqlCommand.Parameters["p_valor2"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Iddecree_detail = Convert.ToInt32(sqlCommand.Parameters["p_iddecree_detail"].Value); return(true); } catch (Exception ex) { throw new Exception("CDecree_detail::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// Select all rescords /// </summary> /// <returns>list of CBatch_detail_aa</returns> public DataTable SelectAllTree(string p_cod_area, string p_cod_module, bool p_enabled_history, DateTime p_date_ini, DateTime p_date_end, long?p_cod_interno, long?p_idcompany) { DataTable dt = new DataTable(); NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_batch_detail_SelectTree"; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Connection = MainConnection; NpgsqlDataAdapter da = new NpgsqlDataAdapter(sqlCommand); try { sqlCommand.Parameters.AddWithValue("p_status_batch", p_cod_area); sqlCommand.Parameters["p_status_batch"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_date_ini", p_cod_module); sqlCommand.Parameters["p_date_ini"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_date_end", p_enabled_history); sqlCommand.Parameters["p_date_end"].NpgsqlDbType = NpgsqlDbType.Boolean; sqlCommand.Parameters.AddWithValue("p_enabled_date", p_date_ini); sqlCommand.Parameters["p_enabled_date"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_revised", p_date_end); sqlCommand.Parameters["p_revised"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_cod_interno", p_cod_interno); sqlCommand.Parameters["p_cod_interno"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_tray", p_idcompany); sqlCommand.Parameters["p_tray"].NpgsqlDbType = NpgsqlDbType.Bigint; MainConnection.Open(); da.Fill(dt); return(dt); } catch (Exception ex) { throw new Exception("CBatch_detail_aa::public.sp_batch_detail_SelectTree::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
public int ThemMoiTaiKhoan(int TaiKhoan_PhongBan_ID, int TaiKhoan_NhomQuyen_ID, string TaiKhoan_ViTri_ID, string taiKhoan_DangNhap, string taiKhoan_MatKhau, string taiKhoan_HoTen , string taiKhoan_Email, string taiKhoan_SoDienThoai, string taiKhoan_AnhDaiDien, int taiKhoan_NguoiTao, int taiKhoan_TrangThai, string taiKhoan_SoMayLe , int PhongBan_ID, int PhongBan_ViTri_ID) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "dbo.[SP_TBL_TAIKHOAN_THEMMOI]"; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("@TaiKhoan_PhongBan_ID", TaiKhoan_PhongBan_ID).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@TaiKhoan_NhomQuyen_ID", TaiKhoan_NhomQuyen_ID).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@TaiKhoan_ViTri_ID", TaiKhoan_ViTri_ID).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@TaiKhoan_DangNhap", taiKhoan_DangNhap).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@taiKhoan_MatKhau", taiKhoan_MatKhau).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@taiKhoan_HoTen", taiKhoan_HoTen).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@taiKhoan_Email", taiKhoan_Email).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@taiKhoan_SoDienThoai", taiKhoan_SoDienThoai).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@taiKhoan_AnhDaiDien", taiKhoan_AnhDaiDien).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@taiKhoan_NguoiTao", taiKhoan_NguoiTao).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@taiKhoan_TrangThai", taiKhoan_TrangThai).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@TaiKhoan_SoMayLe", taiKhoan_SoMayLe).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@PhongBan_ID", PhongBan_ID).Direction = ParameterDirection.Input; sqlCommand.Parameters.AddWithValue("@PhongBan_ViTri_ID", PhongBan_ViTri_ID).Direction = ParameterDirection.Input; SqlParameter out_Id = new SqlParameter("@TaiKhoan_ID", SqlDbType.Int); out_Id.Direction = ParameterDirection.InputOutput; out_Id.Value = 0; sqlCommand.Parameters.Add(out_Id); MainConnection.Open(); sqlCommand.ExecuteNonQuery(); MainConnection.Close(); return(int.Parse(out_Id.Value.ToString())); } catch (Exception ex) { return(0); throw new Exception("TBL_TAIKHOAN::THEMMOI::Error occured.", ex); } finally { if (MainConnection.State != ConnectionState.Closed) { MainConnection.Close(); } sqlCommand.Dispose(); } }
/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(CRecep_sample_attach businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_recep_sample_attach_Update"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idrecep_sample_attach", businessObject.Idrecep_sample_attach); sqlCommand.Parameters["p_idrecep_sample_attach"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_iddocument_recep", businessObject.Iddocument_recep); sqlCommand.Parameters["p_iddocument_recep"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idrecep_sample", businessObject.Idrecep_sample); sqlCommand.Parameters["p_idrecep_sample"].NpgsqlDbType = NpgsqlDbType.Bigint; sqlCommand.Parameters.AddWithValue("p_order_file", businessObject.Order_file); sqlCommand.Parameters["p_order_file"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { return(true); } return(false); } catch (Exception ex) { throw new Exception("CRecep_sample_attach::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public bool Insert(StickersPro Pro) { SqlCommand sqlCmd = new SqlCommand("dbo.[StickerMaster_Insert]", MainConnection); sqlCmd.CommandType = CommandType.StoredProcedure; try { sqlCmd.Parameters.Add(new SqlParameter("@StickerID", SqlDbType.Int, 10, ParameterDirection.Output, false, 0, 0, "", DataRowVersion.Proposed, Pro.StickerID)); sqlCmd.Parameters.Add(new SqlParameter("@RegVehicle", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.RegVehicle)); sqlCmd.Parameters.Add(new SqlParameter("@EmpID", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.EmpID)); if (!string.IsNullOrEmpty(Pro.StartDate)) { sqlCmd.Parameters.Add(new SqlParameter("@StartDate", SqlDbType.DateTime, 14, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, DateFun.SaveDB('S', Pro.StartDate))); } if (!string.IsNullOrEmpty(Pro.ExpiryDate)) { sqlCmd.Parameters.Add(new SqlParameter("@ExpiryDate", SqlDbType.DateTime, 14, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, DateFun.SaveDB('S', Pro.ExpiryDate))); } sqlCmd.Parameters.Add(new SqlParameter("@Owner", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.Owner)); sqlCmd.Parameters.Add(new SqlParameter("@CarType", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.CarType)); sqlCmd.Parameters.Add(new SqlParameter("@Model", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.Model)); sqlCmd.Parameters.Add(new SqlParameter("@Color", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.Color)); sqlCmd.Parameters.Add(new SqlParameter("@TemplateID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.TemplateID)); sqlCmd.Parameters.Add(new SqlParameter("@CompID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.CompID)); sqlCmd.Parameters.Add(new SqlParameter("@Printed", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.Printed)); sqlCmd.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.Status)); sqlCmd.Parameters.Add(new SqlParameter("@CreatedBy", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.TransactionBy)); sqlCmd.Parameters.Add(new SqlParameter("@CreatedDate", SqlDbType.DateTime, 14, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, Pro.TransactionDate)); MainConnection.Open(); sqlCmd.ExecuteNonQuery(); return(true); } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { MainConnection.Close(); sqlCmd.Dispose(); } }
/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(CUser_system businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_user_system_Update"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_iduser", businessObject.Iduser); sqlCommand.Parameters["p_iduser"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_cod_user", businessObject.Cod_user); sqlCommand.Parameters["p_cod_user"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_pwd", businessObject.Pwd); sqlCommand.Parameters["p_pwd"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_idperson", businessObject.Idperson); sqlCommand.Parameters["p_idperson"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { return(true); } return(false); } catch (Exception ex) { throw new Exception("CUser_system::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public bool Update(AppUsersPro pro) { SqlCommand sqlCommand = new SqlCommand("dbo.[AppUsers_Update]", MainConnection); sqlCommand.CommandType = CommandType.StoredProcedure; try { sqlCommand.Parameters.Add(new SqlParameter("@UsrLoginID", VchDB, 50, IN, false, 0, 0, "", DRV, pro.UsrLoginID)); sqlCommand.Parameters.Add(new SqlParameter("@UsrPassword", VchDB, 100, IN, false, 0, 0, "", DRV, pro.UsrPassword)); sqlCommand.Parameters.Add(new SqlParameter("@UsrFullName", VchDB, 200, IN, false, 0, 0, "", DRV, pro.UsrFullName)); if (!string.IsNullOrEmpty(pro.UsrStartDate)) { sqlCommand.Parameters.Add(new SqlParameter("@UsrStartDate", DtDB, 14, IN, false, 0, 0, "", DRV, DateFun.SaveDB(pro.UsrStartDateType, pro.UsrStartDate))); sqlCommand.Parameters.Add(new SqlParameter("@UsrStartDateType", ChrDB, 1, IN, false, 0, 0, "", DRV, pro.UsrStartDateType)); } if (!string.IsNullOrEmpty(pro.UsrExpiryDate)) { sqlCommand.Parameters.Add(new SqlParameter("@UsrExpiryDate", DtDB, 14, IN, false, 0, 0, "", DRV, DateFun.SaveDB(pro.UsrExpiryDateType, pro.UsrExpiryDate))); sqlCommand.Parameters.Add(new SqlParameter("@UsrExpiryDateType", ChrDB, 1, IN, false, 0, 0, "", DRV, pro.UsrExpiryDateType)); } sqlCommand.Parameters.Add(new SqlParameter("@UsrStatus", BitDB, 1, IN, false, 0, 0, "", DRV, pro.UsrStatus)); sqlCommand.Parameters.Add(new SqlParameter("@UsrPermission", VchDB, 8000, IN, false, 0, 0, "", DRV, pro.UsrPermission)); sqlCommand.Parameters.Add(new SqlParameter("@UsrLanguage", VchDB, 50, IN, false, 0, 0, "", DRV, pro.UsrLanguage)); sqlCommand.Parameters.Add(new SqlParameter("@UsrEmailID", VchDB, 200, IN, false, 0, 0, "", DRV, pro.UsrEmailID)); sqlCommand.Parameters.Add(new SqlParameter("@UsrEmpID", VchDB, 100, IN, false, 0, 0, "", DRV, pro.UsrEmpID)); sqlCommand.Parameters.Add(new SqlParameter("@UsrDescription", VchDB, 8000, IN, false, 0, 0, "", DRV, pro.UsrDescription)); sqlCommand.Parameters.Add(new SqlParameter("@TransactionBy", VchDB, 50, IN, false, 0, 0, "", DRV, pro.TransactionBy)); MainConnection.Open(); sqlCommand.ExecuteNonQuery(); return(true); } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CRecep_document_attach businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_recep_document_attach_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idrecep_document_attach", businessObject.Idrecep_document_attach); sqlCommand.Parameters["p_idrecep_document_attach"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters["p_idrecep_document_attach"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_name_file", businessObject.Name_file); sqlCommand.Parameters["p_name_file"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_order_file", businessObject.Order_file); sqlCommand.Parameters["p_order_file"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Timestamp; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Idrecep_document_attach = Convert.ToInt32(sqlCommand.Parameters["p_idrecep_document_attach"].Value); return(true); } catch (Exception ex) { throw new Exception("CRecep_document_attach::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool Insert(CPrice_version_detail businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_price_version_detail_Insert"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idprice_version_detail", businessObject.Idprice_version_detail); sqlCommand.Parameters["p_idprice_version_detail"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters["p_idprice_version_detail"].Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.AddWithValue("p_idprice_version", businessObject.Idprice_version); sqlCommand.Parameters["p_idprice_version"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_num_item", businessObject.Num_item); sqlCommand.Parameters["p_num_item"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_idtemplate_method", businessObject.Idtemplate_method); sqlCommand.Parameters["p_idtemplate_method"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_amount_item", businessObject.Amount_item); sqlCommand.Parameters["p_amount_item"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_rank", businessObject.Rank); sqlCommand.Parameters["p_rank"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_unit_price", businessObject.Unit_price); sqlCommand.Parameters["p_unit_price"].NpgsqlDbType = NpgsqlDbType.Numeric; sqlCommand.Parameters.AddWithValue("p_sale_price", businessObject.Sale_price); sqlCommand.Parameters["p_sale_price"].NpgsqlDbType = NpgsqlDbType.Numeric; MainConnection.Open(); sqlCommand.ExecuteNonQuery(); businessObject.Idprice_version_detail = Convert.ToInt32(sqlCommand.Parameters["p_idprice_version_detail"].Value); return(true); } catch (Exception ex) { throw new Exception("CPrice_version_detail::Insert::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }