// Override of the ToString Method public string ToString() { // Serializing Object as CSV return(String.Join(",", ("\"" + Url + "\""), ("\"" + ReferenceDate.ToString("yyyy-MM-dd").Replace(",", "") + "\""), ("\"" + Name.Replace(",", "") + "\" "), ("\"" + Developer.Replace(",", "") + "\""), ("\"" + IsTopDeveloper + "\""), ("\"" + DeveloperURL.Replace(",", "") + "\""), ("\"" + PublicationDate.ToString("yyyy-MM-dd").Replace(",", "") + "\""), ("\"" + Category.Replace(",", "") + "\""), ("\"" + IsFree + "\""), ("\"" + Price + "\""), ("\"" + Reviewers + "\""), ("\"" + Score.Total + "\""), ("\"" + Score.Count + "\""), ("\"" + Score.FiveStars + "\""), ("\"" + Score.FourStars + "\""), ("\"" + Score.ThreeStars + "\""), ("\"" + Score.TwoStars + "\""), ("\"" + Score.OneStars + "\""), ("\"" + LastUpdateDate.ToString("yyyy-MM-dd") + "\""), //("\"" + AppSize + "\""), ("\"" + Instalations.Replace(",", ".") + "\""), ("\"" + CurrentVersion.Replace(",", "") + "\""), ("\"" + MinimumOSVersion.Replace(",", "") + "\""), ("\"" + ContentRating.Replace(",", "") + "\""), ("\"" + HaveInAppPurchases + "\""), ("\"" + DeveloperEmail.Replace(",", "") + "\""), ("\"" + DeveloperWebsite.Replace(",", "") + "\""), ("\"" + DeveloperPrivacyPolicy.Replace(",", "") + "\""), ("\"" + Description.Replace(",", "") + "\""))); }
public bool SubmitAccountRecord() { //Validation try { if (ProfileID < 1) { return(false); } Amount.ToString(); if (Name == "") { return(false); } if (LastUpdateDate < new DateTime(2000, 1, 1)) { return(false); } if (RecordBy == "") { return(false); } if (RecordDate < new DateTime(2000, 1, 1)) { return(false); } } catch (NullReferenceException) { return(false); } using (var conn = DataAccess.EstablishConnection()) { var cmd = conn.CreateCommand(); try { cmd.CommandText = "INSERT INTO tblAccounts (ProfileID, Acc_Name, Acc_Amount, Acc_LastUpdateDate, RecordBy, RecordDate) VALUES (@ProfileID, @Name, @Amount, @LastUpdateDate, @RecordBy, @RecordDate)"; cmd.Parameters.Add("@ProfileID", DbType.Int32).Value = ProfileID; cmd.Parameters.Add("@Name", DbType.String).Value = Name; cmd.Parameters.Add("@Amount", DbType.Double).Value = Amount; cmd.Parameters.Add("@LastUpdateDate", DbType.String).Value = LastUpdateDate.ToString("MM/dd/yyyy"); cmd.Parameters.Add("@RecordBy", DbType.String).Value = RecordBy; cmd.Parameters.Add("@RecordDate", DbType.String).Value = RecordDate.ToString("yyyy-MM-dd HH:mm"); if (conn.State == ConnectionState.Closed) { conn.Open(); } cmd.ExecuteNonQuery(); } finally { conn.Close(); cmd.Dispose(); } } return(true); }
public bool UpdateAccountBalance(double change, DateTime updateDate) { try { if (ID < 1) { return(false); } Amount.ToString(); } catch (NullReferenceException) { return(false); } var newAmount = Amount + change; if (updateDate > LastUpdateDate) { LastUpdateDate = updateDate; } using (var conn = DataAccess.EstablishConnection()) { var cmd = conn.CreateCommand(); try { cmd.CommandText = "UPDATE tblAccounts SET Acc_Amount = @Amount, Acc_LastUpdateDate = @LastUpdateDate, RecordBy = @RecordBy, RecordDate = @RecordDate WHERE AccountID = @AccountID"; cmd.Parameters.Add("@Amount", DbType.Double).Value = newAmount; cmd.Parameters.Add("@LastUpdateDate", DbType.String).Value = LastUpdateDate.ToString("MM/dd/yyyy"); cmd.Parameters.Add("@RecordBy", DbType.String).Value = RecordBy; cmd.Parameters.Add("@RecordDate", DbType.String).Value = RecordDate.ToString("yyyy-MM-dd HH:mm"); cmd.Parameters.Add("@AccountID", DbType.Int32).Value = ID; if (conn.State == ConnectionState.Closed) { conn.Open(); } cmd.ExecuteNonQuery(); } finally { conn.Close(); cmd.Dispose(); } } return(true); }
public override string ToString() { StringBuilder result = new StringBuilder(); if (IsSetAmazonOrderId()) { result.Append("Order ID: "); result.AppendLine(AmazonOrderId); } if (IsSetFulfillmentChannel()) { result.Append("FulfillmentChannel:"); result.AppendLine(FulfillmentChannel.ToString()); } if (IsSetNumberOfItemsShipped()) { result.Append("Number of Items Shipped: "); result.AppendLine(NumberOfItemsShipped.ToString()); } if (IsSetNumberOfItemsUnshipped()) { result.Append("Number of Items Not Shipped: "); result.AppendLine(NumberOfItemsShipped.ToString()); } if (IsSetLastUpdateDate()) { result.Append("Last Update Date: "); result.AppendLine(LastUpdateDate.ToString()); } if (IsSetOrderChannel()) { result.Append("Order Channel: "); result.AppendLine(OrderChannel); } if (IsSetOrderStatus()) { result.Append("Order Status: "); result.AppendLine(OrderStatus.ToString()); } if (IsSetOrderTotal()) { result.Append("Order Total: "); result.AppendLine(OrderTotal.ToString()); } if (IsSetPurchaseDate()) { result.Append("Purchase Date: "); result.AppendLine(PurchaseDate.ToString()); } if (IsSetSalesChannel()) { result.Append("Sales Channel: "); result.AppendLine(SalesChannel); } if (IsSetSellerOrderId()) { result.Append("Seller Order Id: "); result.AppendLine(SellerOrderId); } if (IsSetShipServiceLevel()) { result.Append("Ship Service Level: "); result.AppendLine(ShipServiceLevel); } if (IsSetPaymentExecutionDetail()) { result.Append("Payment Execution Detail: "); result.Append(PaymentExecutionDetail); } if (IsSetPaymentMethod()) { result.Append("Payment Method: "); result.Append(PaymentMethod); } if (IsSetMarketplaceId()) { result.Append("Marketplace Id: "); result.AppendLine(MarketplaceId); } if (IsSetBuyerEmail()) { result.Append("Buyer Email: "); result.AppendLine(BuyerEmail); } if (IsSetShipServiceLevel()) { result.Append("Buyer Name: "); result.AppendLine(BuyerName); } if (IsSetShipmentServiceLevelCategory()) { result.Append("Shipment Service Level Category: "); result.AppendLine(ShipmentServiceLevelCategory); } if (IsSetCbaDisplayableShippingLabel()) { result.Append("CbaDisplayableShippingLabel: "); result.AppendLine(this.CbaDisplayableShippingLabel); } if (IsSetOrderType()) { result.Append("OrderType: "); result.AppendLine(this.OrderType); } if (IsSetEarliestShipDate()) { result.Append("EarliestShipDate: "); result.AppendLine(this.EarliestShipDate.ToString()); } if (IsSetLatestShipDate()) { result.Append("LatestShipDate: "); result.AppendLine(this.LatestShipDate.ToString()); } return(result.ToString()); }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "InfoPageID") { ret = true; if (InfoPageID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoPageGUID") { ret = true; if (InfoPageGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserID") { ret = true; if (UserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserGUID") { ret = true; if (UserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedUserID") { ret = true; if (CreatedUserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedUserGUID") { ret = true; if (CreatedUserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoPageName") { ret = true; if (InfoPageName.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoPageDescription") { ret = true; if (InfoPageDescription.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoCategoryID") { ret = true; if (InfoCategoryID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoCategoryGUID") { ret = true; if (InfoCategoryGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "AccessGroupID") { ret = true; if (AccessGroupID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "AccessGroupGUID") { ret = true; if (AccessGroupGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "AsyncLoading") { ret = true; if (AsyncLoading.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Commentable") { ret = true; if (Commentable.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CommentorRoleList") { ret = true; if (CommentorRoleList.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CommentorGroupList") { ret = true; if (CommentorGroupList.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CommentorHideRoleList") { ret = true; if (CommentorHideRoleList.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CommentorHideGroupList") { ret = true; if (CommentorHideGroupList.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "ExpiryDate") { ret = true; if (ExpiryDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsCommon") { ret = true; if (IsCommon.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsPublic") { ret = true; if (IsPublic.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDeleted") { ret = true; if (IsDeleted.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "DataID") { ret = true; if (DataID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataGUID") { ret = true; if (DataGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserID") { ret = true; if (UserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserGUID") { ret = true; if (UserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "ParentDataID") { ret = true; if (ParentDataID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "ParentDataGUID") { ret = true; if (ParentDataGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataTypeID") { ret = true; if (DataTypeID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataTypeGUID") { ret = true; if (DataTypeGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataValue") { ret = true; if (DataValue.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefTypeID") { ret = true; if (DataRefTypeID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefTypeGUID") { ret = true; if (DataRefTypeGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefID") { ret = true; if (DataRefID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDeleted") { ret = true; if (IsDeleted.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "InfoDetailID") { ret = true; if (InfoDetailID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoDetailGUID") { ret = true; if (InfoDetailGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserID") { ret = true; if (UserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserGUID") { ret = true; if (UserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoPageID") { ret = true; if (InfoPageID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoPageGUID") { ret = true; if (InfoPageGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoSectionID") { ret = true; if (InfoSectionID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoSectionGUID") { ret = true; if (InfoSectionGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoDetailName") { ret = true; if (InfoDetailName.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoDetailDescription") { ret = true; if (InfoDetailDescription.ToString() == columnValue) { valueMatched = true; } } if (columnName == "HideDetailName") { ret = true; if (HideDetailName.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDeleted") { ret = true; if (IsDeleted.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "InfoCategoryID") { ret = true; if (InfoCategoryID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoCategoryGUID") { ret = true; if (InfoCategoryGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoCategoryName") { ret = true; if (InfoCategoryName.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserID") { ret = true; if (UserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserGUID") { ret = true; if (UserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDefault") { ret = true; if (IsDefault.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsSystem") { ret = true; if (IsSystem.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "SubscriberID") { ret = true; if (SubscriberID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "SubscriberGUID") { ret = true; if (SubscriberGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "SubscriberMessage") { ret = true; if (SubscriberMessage.ToString() == columnValue) { valueMatched = true; } } if (columnName == "SubscriberEmail") { ret = true; if (SubscriberEmail.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDeleted") { ret = true; if (IsDeleted.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }
public void SubmitDebt() { using (var conn = DataAccess.EstablishConnection()) { var cmd = conn.CreateCommand(); try { if (ID == -1) { cmd.CommandText = "INSERT INTO tblDebts (ProfileID, Dbt_Name, Dbt_Principal, Dbt_LastUpdateDate, Dbt_InterestType, Dbt_NumberOfTimesApplied, Dbt_AnnualPercentageRate, RecordBy, RecordDate) VALUES (@ProfileID, @Name, @Principal, @Date, @InterestType, @InterestFrequency, @APR, @RecordBy, @RecordDate)"; cmd.Parameters.Add("@ProfileID", DbType.Int32).Value = ProfileID; cmd.Parameters.Add("@Name", DbType.String).Value = Name; cmd.Parameters.Add("@Principal", DbType.Double).Value = Principal; cmd.Parameters.Add("@Date", DbType.String).Value = LastUpdateDate.ToString("MM/dd/yyyy"); cmd.Parameters.Add("@InterestType", DbType.Int32).Value = (int)InterestType; cmd.Parameters.Add("@InterestFrequency", DbType.Int32).Value = (int)TimesApplied; cmd.Parameters.Add("@APR", DbType.Double).Value = AnnualPercentageRate; cmd.Parameters.Add("@RecordBy", DbType.String).Value = RecordBy; cmd.Parameters.Add("@RecordDate", DbType.String).Value = RecordDate.ToString("yyyy-MM-dd HH:mm"); } else { cmd.CommandText = "UPDATE tblDebts SET Dbt_Name = @Name, Dbt_Principal = @Principal, Dbt_LastUpdateDate = @Date, Dbt_InterestType = @InterestType, Dbt_NumberOfTimesApplied = @InterestFrequency, Dbt_AnnualPercentageRate = @APR, RecordBy = @RecordBy, RecordDate = @RecordDate WHERE DebtID = @DebtID"; cmd.Parameters.Add("@DebtID", DbType.Int32).Value = ID; cmd.Parameters.Add("@Name", DbType.String).Value = Name; cmd.Parameters.Add("@Principal", DbType.Double).Value = Principal; cmd.Parameters.Add("@Date", DbType.String).Value = LastUpdateDate.ToString("MM/dd/yyyy"); cmd.Parameters.Add("@InterestType", DbType.Int32).Value = (int)InterestType; cmd.Parameters.Add("@InterestFrequency", DbType.Int32).Value = (int)TimesApplied; cmd.Parameters.Add("@APR", DbType.Double).Value = AnnualPercentageRate; cmd.Parameters.Add("@RecordBy", DbType.String).Value = RecordBy; cmd.Parameters.Add("@RecordDate", DbType.String).Value = RecordDate.ToString("yyyy-MM-dd HH:mm"); } if (conn.State == ConnectionState.Closed) { conn.Open(); } cmd.ExecuteNonQuery(); } finally { conn.Close(); cmd.Dispose(); } } }
public void SubmitAccount() { var valid = true; try { if (ProfileID < 1) { valid = false; } if (Name == "") { valid = false; } if (Amount < 0.00) { valid = false; } if (LastUpdateDate < DateTime.Parse("2000/01/01")) { valid = false; } if (RecordBy == "") { valid = false; } if (RecordDate < DateTime.Parse("2000/01/01")) { valid = false; } } catch (NullReferenceException) { valid = false; } if (!valid) { throw new DatabaseException("Invalid parameters provided"); } using (var conn = DataAccess.EstablishConnection()) { var checkCmd = conn.CreateCommand(); try { checkCmd.CommandText = "SELECT AccountID FROM tblAccounts WHERE Acc_Name = @Name AND ProfileID = @ProfileID"; checkCmd.Parameters.Add("@ProfileID", DbType.Int32).Value = ProfileID; checkCmd.Parameters.Add("@Name", DbType.String).Value = Name; if (conn.State == ConnectionState.Closed) { conn.Open(); } var read = checkCmd.ExecuteReader(); if (read.HasRows) { throw new DatabaseException("An account with this name already exists"); } read.Close(); } finally { conn.Close(); checkCmd.Dispose(); } var cmd = conn.CreateCommand(); try { cmd.CommandText = "INSERT INTO tblAccounts (ProfileID, Acc_Name, Acc_Amount, Acc_LastUpdateDate, RecordBy, RecordDate) VALUES (@ProfileID, @Name, @Amount, @LastUpdateDate, @RecordBy, @RecordDate)"; cmd.Parameters.Add("@ProfileID", DbType.Int32).Value = ProfileID; cmd.Parameters.Add("@Name", DbType.String).Value = Name; cmd.Parameters.Add("@Amount", DbType.Double).Value = Amount; cmd.Parameters.Add("@LastUpdateDate", DbType.String).Value = LastUpdateDate.ToString("MM/dd/yyyy"); cmd.Parameters.Add("@RecordBy", DbType.String).Value = RecordBy; cmd.Parameters.Add("@RecordDate", DbType.String).Value = RecordDate.ToString("MM/dd/yyyy HH:mm"); if (conn.State == ConnectionState.Closed) { conn.Open(); } cmd.ExecuteNonQuery(); } finally { conn.Close(); cmd.Dispose(); } } }