public TaxTypeResponse UpdateTaxType(TaxTypeEntity taxType) { var response = new TaxTypeResponse { Acknowledge = AcknowledgeType.Success }; try { if (!taxType.Validate()) { foreach (string error in taxType.ValidationErrors) { response.Message += error + Environment.NewLine; } response.Acknowledge = AcknowledgeType.Failure; return(response); } response.Message = TaxTypeDao.UpdateTaxType(taxType); if (!string.IsNullOrEmpty(response.Message)) { response.Acknowledge = AcknowledgeType.Failure; return(response); } response.TaxTypeId = taxType.TaxTypeId; return(response); } catch (Exception ex) { response.Message = ex.Message; return(response); } }
/// <summary> /// Takes the specified tax type. /// </summary> /// <param name="taxType">Type of the tax.</param> /// <returns>System.Object[].</returns> private object[] Take(TaxTypeEntity taxType) { return(new object[] { "@TaxTypeID", taxType.TaxTypeId, "@TaxTypeCode", taxType.TaxTypeCode, "@TaxTypeName", taxType.TaxTypeName, "@IsActive", taxType.IsActive }); }
/// <summary> /// Updates the type of the tax. /// </summary> /// <param name="taxType">Type of the tax.</param> /// <returns>System.String.</returns> public string UpdateTaxType(TaxTypeEntity taxType) { const string sql = @"uspUpdate_TaxType"; return(Db.Update(sql, true, Take(taxType))); }
/// <summary> /// Inserts the type of the tax. /// </summary> /// <param name="taxType">Type of the tax.</param> /// <returns>System.String.</returns> public string InsertTaxType(TaxTypeEntity taxType) { const string sql = @"uspInsert_TaxType"; return(Db.Insert(sql, true, Take(taxType))); }