public int DeleteGroupName(ConfiguratorDB objDB, SqlTransaction objTrans) { int StatusID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { if (objDB.source == "Model") { objCmd.CommandText = "Usp_DeleteGroupName"; } if (objDB.source == "Culprit") { objCmd.CommandText = "Usp_DeletCulpritGroup"; } if (objDB.source == "Defect") { objCmd.CommandText = "Usp_DeleteDefectGroup"; } if (objDB.source == "Cvoice") { objCmd.CommandText = "Usp_DeleteCvoiceGroup"; } if (objDB.source == "Item") { objCmd.CommandText = "Usp_DeleteItemGroup"; } objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID); objCmd.Parameters.AddWithValue("@StatusID", SqlDbType.Int); objCmd.Parameters["@StatusID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); StatusID = Convert.ToInt32(objCmd.Parameters["@StatusID"].Value); return StatusID; } catch (Exception ex) { throw ex; } }
public int Save(ConfiguratorDB objDB, SqlTransaction objTrans) { int modelGroupID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_SaveProductGroupMapping"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@ModelGroupName", objDB.ModelGroupName); objCmd.Parameters.AddWithValue("@IsNew", objDB.IsNew); objCmd.Parameters.AddWithValue("@WarrantyPeriod", objDB.WarrantyPeriod); objCmd.Parameters.AddWithValue("@ProductGroupMappingID", SqlDbType.Int); objCmd.Parameters["@ProductGroupMappingID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); modelGroupID = Convert.ToInt32(objCmd.Parameters["@ProductGroupMappingID"].Value); return modelGroupID; } catch (Exception ex) { throw ex; } }
public int SaveProductGroupMapping(ConfiguratorDB objDB, SqlTransaction objTrans) { int modelGroupID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { if (objDB.source == "Configurator") { objCmd.CommandText = "usp_SaveProductCodeMapping"; } else { objCmd.CommandText = "usp_SaveModelException"; } objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@ProductCodeID", objDB.ID); objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID); objCmd.Parameters.AddWithValue("@ProductCodeMappingID", SqlDbType.Int); objCmd.Parameters["@ProductCodeMappingID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); modelGroupID = Convert.ToInt32(objCmd.Parameters["@ProductCodeMappingID"].Value); return modelGroupID; } catch (Exception ex) { throw ex; } }