public KitTypeConfigurationBO deleteKitConfiguration(int TenantID, int KitID) { KitTypeConfigurationBO DeleteKitBO = new KitTypeConfigurationBO(); try { using (SqlConnection con = new SqlConnection(Constant.DBConnectionString)) { SqlCommand cmd = new SqlCommand("Delete from stblKitTenant where TenantID=@TenantID and KitID=@KitID", con); { cmd.Parameters.Add(new SqlParameter("@TenantID", TenantID)); cmd.Parameters.Add(new SqlParameter("@KitID", KitID)); cmd.CommandType = CommandType.Text; cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } } } catch (Exception ex) { _ErrMsg = ex.Message; throw; } return(DeleteKitBO); }
public KitTypeConfigurationBO UpdateKitConfiguration(int TenantID, int KitID, int KitTenantID) { KitTypeConfigurationBO UpdateKitBO = new KitTypeConfigurationBO(); try { using (SqlConnection sqlCon = new SqlConnection(Constant.DBConnectionString)) { SqlCommand sqlCmd = new SqlCommand("sspSaveKitTenant", sqlCon); { sqlCmd.Parameters.Add(new SqlParameter("@TenantID", TenantID)); sqlCmd.Parameters.Add(new SqlParameter("@KitID", KitID)); sqlCmd.Parameters.Add(new SqlParameter("@KitTenantID", KitTenantID)); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Connection = sqlCon; sqlCon.Open(); SqlDataReader reader = sqlCmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { UpdateKitBO.KitTenantID = (reader[0] == DBNull.Value ? 0 : Convert.ToInt32(reader[0])); } } reader.Close(); sqlCon.Close(); } } } catch (Exception ex) { _ErrMsg = ex.Message; throw; } return(UpdateKitBO); }
public KitTypeConfigurationBO DisplayKitConfiguration(int TenantID, int KitID) { KitTypeConfigurationBO displaykitBO = new KitTypeConfigurationBO(); try { using (SqlConnection sqlCon = new SqlConnection(Constant.DBConnectionString)) { SqlCommand sqlCmd = new SqlCommand("select * from stblKitTenant where TenantID=@TenantID and KitID=@KitID", sqlCon); { sqlCmd.Parameters.Add(new SqlParameter("@TenantID", TenantID)); sqlCmd.Parameters.Add(new SqlParameter("@KitID", KitID)); sqlCmd.CommandType = CommandType.Text; sqlCmd.Connection = sqlCon; sqlCon.Open(); SqlDataReader reader = sqlCmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { displaykitBO.KitID = reader["KitID"] == DBNull.Value ? 0 : Convert.ToInt32(reader["KitID"]); displaykitBO.KitTenantID = reader["KitTenantID"] == DBNull.Value ? 0 : Convert.ToInt32(reader["KitTenantID"]); displaykitBO.TenantID = reader["TenantID"] == DBNull.Value ? 0 : Convert.ToInt32(reader["TenantID"]); } } reader.Close(); sqlCon.Close(); } } } catch (Exception ex) { } return(displaykitBO); }