public OperationsStatus TreeViewUpdateAttributeSetLink(List <AttributeSetLink> TreeViewData, int ID) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { //Delete the link data usng AttributeSet ID operationsStatusObj = _attributeToSetLinksRepository.DeleteAttributeSetLink(ID); // foreach (AttributeSetLink i in TreeViewData) { if (i.AttributeSetID != 0) { i.AttributeSetID = ID; operationsStatusObj = _attributeToSetLinksRepository.InsertAttributeSetLink(i); } } } catch (Exception ex) { operationsStatusObj.StatusMessage = ex.Message; operationsStatusObj.StatusCode = 0; } return(operationsStatusObj); }
public OperationsStatus DeleteAttributeSet(int ID) { OperationsStatus operationsStatusObj = null; try { operationsStatusObj = _attributeSetLinkRepository.DeleteAttributeSetLink(ID); if (operationsStatusObj.StatusCode == 1 || operationsStatusObj.StatusCode == 0) { SqlParameter outparameter = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[DeleteAttributeSet]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.VarChar, 50).Value = ID; outparameter = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outparameter.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); operationsStatusObj = new OperationsStatus(); switch (outparameter.Value.ToString()) { case "0": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.DeleteFailure; break; case "1": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.DeleteSuccess; break; default: break; } } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }