public void InsertOrder(OrderMaster orderMaster) { orderMaster.CreateDate = DateTime.Now; SpCall spCall = new SpCall("DAT.ORDER_MASTER_INSERT"); spCall.SetBigInt("@ID", orderMaster.Id); spCall.SetBigInt("@CUSTOMER_ID", orderMaster.Customer.Id); spCall.SetDateTime("@ORDER_DATE", orderMaster.OrderDate); spCall.SetDateTime("@DELIVERY_DATE", orderMaster.DeliveryDate); spCall.SetVarchar("@PAYMENT_TYPE", orderMaster.PaymentType); spCall.SetVarchar("@NOTES", orderMaster.Notes); spCall.SetVarchar("@ORDER_STATUS", orderMaster.OrderStatus); spCall.SetDateTime("@CREATE_DATE", orderMaster.CreateDate); spCall.SetVarchar("@CREATE_USER", orderMaster.CreatedUser); spCall.SetBigInt("@SHIP_ADDRESS", orderMaster.ShippingAddressId); orderMaster.UpdatedUser = orderMaster.CreatedUser; orderMaster.UpdateDate = orderMaster.CreateDate; db.ExecuteNonQuery(spCall); DataTable dt = PrepareOrderItemsTable(orderMaster.OrderItems); db.ExecuteBulkInsert(dt); }
protected override void Update() { MaestroUnit item = (MaestroUnit)request.TransactionEntityList[0]; Context.TransactionObject = item; SpCall call = new SpCall("DAT.UNIT_UPDATE"); call.SetBigInt("@ID", item.Id); call.SetBigInt("@UNIT_TYPE_ID", item.UnitType.Id); call.SetVarchar("@UNIT_NAME", item.Name); call.SetVarchar("@QB_UNIT", item.QuickBooksUnit); call.SetDateTime("@UPDATE_DATE", DateTime.Now); call.SetVarchar("@UPDATE_USER", Context.UserName); db.ExecuteNonQuery(call); }
public List <OrderMaster> List(DateTime begin, DateTime end, long customerId, string status, string dateField) { List <OrderMaster> result = new List <OrderMaster>(); SpCall spCall = new SpCall("DAT.ORDER_MASTER_LIST"); spCall.SetDateTime("@BEGIN_DATE", begin); spCall.SetDateTime("@END_DATE", end); spCall.SetBigInt("@CUSTOMER_ID", customerId); spCall.SetVarchar("@STATUS", status); spCall.SetVarchar("@DATE_FIELD", dateField); DataSet ds = db.ExecuteDataSet(spCall); if (ds.Tables[0].Rows.Count > 0) { ds.Tables[0].AsEnumerable().ToList().ForEach(omRow => { OrderMaster om = ReadOrderMaster(omRow); om.OrderItems = new List <OrderItem>(); ds.Tables[1].AsEnumerable().Where(itemRow => itemRow.Field <long>("ORDER_ID") == om.Id).ToList().ForEach(itemRow => om.OrderItems.Add(InitOrderItem(itemRow))); ds.Tables[2].AsEnumerable().Where(logRow => logRow.Field <long>("ORDER_ID") == om.Id).ToList().ForEach( logRow => om.InvoiceLog = qm.InitLog(logRow)); result.Add(om); }); } return(result); }
public void Erase(long id) { SpCall spCall = new SpCall("DAT.CUSTOMER_ERASE"); spCall.SetBigInt("@ID", id); db.ExecuteNonQuery(spCall); }
public void UpdateInvoiceLog(QuickBooksInvoiceLog log) { SpCall spCall = new SpCall("DAT.QB_INVOICE_LOG_UPDATE"); spCall.SetBigInt("@ID", log.Id); spCall.SetVarchar("@INTEGRATION_STATUS", log.IntegrationStatus); spCall.SetDateTime("@INTEGRATION_DATE", log.IntegrationDate); spCall.SetBigInt("@BATCH_ID", log.BatchId); spCall.SetVarchar("@QB_INVOICE_NO", log.QuickBooksInvoiceId); spCall.SetVarchar("@QB_TXN_ID", log.QuickBooksTxnId); spCall.SetVarchar("@ERROR_LOG", log.ErrorLog); spCall.SetDateTime("@UPDATE_DATE", log.CreateDate); spCall.SetVarchar("@UPDATE_USER", context.UserName); spCall.SetVarchar("@RECORD_STATUS", log.RecordStatus); db.ExecuteNonQuery(spCall); }
public void InsertNewItem(MaestroProduct product) { SpCall call = new SpCall("DAT.PRODUCT_INSERT"); call.SetVarchar("@PRODUCT_NAME", product.Name); call.SetVarchar("@PRODUCT_DESCRIPTION", product.Description); call.SetVarchar("@QB_PRODUCT_ID", product.QuickBooksProductId); call.SetDecimal("@PRICE", product.Price); call.SetInt("@MINIMUM_ORDER_QUANTITY", product.MinimumOrderQuantity); call.SetBigInt("@UNIT_TYPE_ID", product.UnitType.Id); call.SetBigInt("@PRODUCT_GROUP_ID", product.GroupId); call.SetDecimal("@COST_BASE", product.CostBase); call.SetDateTime("@CREATE_DATE", product.CreateDate); call.SetVarchar("@CREATE_USER", product.CreatedUser); product.Id = db.ExecuteScalar <long>(call); }
public void Delete(long id) { SpCall spCall = new SpCall("DAT.PRODUCT_DELETE"); spCall.SetBigInt("@ID", id); spCall.SetDateTime("@UPDATE_DATE", DateTime.Now); spCall.SetVarchar("@UPDATE_USER", context.UserName); db.ExecuteNonQuery(spCall); }
public List <QuickBooksInvoiceLog> List(DateTime begin, DateTime end, long customerId, string status, long batchId, bool notIntegrated) { List <QuickBooksInvoiceLog> result = new List <QuickBooksInvoiceLog>(); SpCall spCall = new SpCall("DAT.QB_INVOICE_LOG_LIST"); spCall.SetVarchar("@INTEGRATION_STATUS", status); spCall.SetDateTime("@INTEGRATION_DATE_BEGIN", begin); spCall.SetDateTime("@INTEGRATION_DATE_END", end); spCall.SetBigInt("@BATCH_ID", batchId); spCall.SetBigInt("@CUSTOMER_ID", customerId); spCall.SetBit("@NOT_INTEGRATED", notIntegrated); DataSet ds = db.ExecuteDataSet(spCall); ds.Tables[0].AsEnumerable().ToList().ForEach(logRow => { result.Add(InitLog(logRow)); }); return(result); }
protected override void New() { Entity.CustomerProductUnit item = (Entity.CustomerProductUnit)request.TransactionEntityList[0]; if (CustomerProductUnitCache.Instance.Exists(item)) { throw new Exception("Item already exists"); } SpCall call = new SpCall("DAT.CUSTOMER_PRODUCT_UNIT_INSERT"); call.SetBigInt("@CUSTOMER_ID", item.Customer.Id); call.SetBigInt("@PRODUCT_ID", item.Product.Id); call.SetBigInt("@UNIT_ID", item.Unit.Id); call.SetDateTime("@CREATE_DATE", DateTime.Now); call.SetVarchar("@CREATE_USER", Context.UserName); item.Id = db.ExecuteScalar <long>(call); response.TransactionResult = item; }
public void Delete(long id) { //MaestroCustomer td = (MaestroCustomer)request.TransactionEntityList[0]; SpCall spCall = new SpCall("DAT.CUSTOMER_DELETE"); spCall.SetBigInt("@ID", id); spCall.SetDateTime("@UPDATE_DATE", DateTime.Now); spCall.SetVarchar("@UPDATE_USER", context.UserName); db.ExecuteNonQuery(spCall); }
public void UpdateOrderItem(OrderItem item) { item.UpdateDate = DateTime.Now; item.UpdatedUser = context.UserName; SpCall spCall = new SpCall("DAT.ORDER_ITEM_UPDATE"); spCall.SetBigInt("@ID", item.Id); spCall.SetBigInt("@ORDER_ID", item.OrderId); spCall.SetBigInt("@PRODUCT_ID", item.Product.Id); spCall.SetInt("@QUANTITY", item.Quantity); spCall.SetBigInt("@UNIT_ID", item.Unit.Id); spCall.SetBigInt("@QB_PRODUCT_MAP_ID", item.QbProductMap.Id); spCall.SetDecimal("@PRICE", item.Price); spCall.SetDateTime("@UPDATE_DATE", item.UpdateDate); spCall.SetVarchar("@UPDATE_USER", context.UserName); spCall.SetDecimal("@AMOUNT", item.Amount); db.ExecuteNonQuery(spCall); }
void UpdateOrderInternal(OrderMaster orderMaster, bool cleanItems) { orderMaster.UpdateDate = DateTime.Now; SpCall spCall = new SpCall("DAT.ORDER_MASTER_UPDATE"); spCall.SetBigInt("@ID", orderMaster.Id); spCall.SetBigInt("@CUSTOMER_ID", orderMaster.Customer.Id); spCall.SetDateTime("@ORDER_DATE", orderMaster.OrderDate); spCall.SetDateTime("@DELIVERY_DATE", orderMaster.DeliveryDate); spCall.SetVarchar("@PAYMENT_TYPE", orderMaster.PaymentType); spCall.SetVarchar("@NOTES", orderMaster.Notes); spCall.SetVarchar("@ORDER_STATUS", orderMaster.OrderStatus); spCall.SetDateTime("@UPDATE_DATE", orderMaster.UpdateDate); spCall.SetVarchar("@UPDATE_USER", orderMaster.UpdatedUser); spCall.SetBit("@CLEAN_ORDERITEMS", cleanItems); spCall.SetBigInt("@SHIP_ADDRESS", orderMaster.ShippingAddressId); db.ExecuteNonQuery(spCall); }
public void Update(QuickBooksProductMapDef map) { SpCall call = new SpCall("DAT.QB_PRODUCT_MAP_UPDATE"); call.SetBigInt("@ID", map.Id); call.SetBigInt("@PRODUCT_ID", map.Product.Id); call.SetVarchar("@QB_CODE", map.QuickBooksCode); call.SetVarchar("@QB_LIST_ID", map.QuickBooksListId); call.SetVarchar("@QB_PARENT_CODE", map.QuickBooksParentCode); call.SetVarchar("@QB_PARENT_LIST_ID", map.QuickBooksParentListId); call.SetVarchar("@QB_DESCRIPTION", map.QuickBooksDescription); call.SetBigInt("@UNIT_ID", map.Unit.Id); call.SetDecimal("@PRICE", map.Price); call.SetDateTime("@UPDATE_DATE", DateTime.Now); call.SetVarchar("@UPDATE_USER", context.UserName); call.SetVarchar("@REPORT_LABEL", map.Label); db.ExecuteNonQuery(call); }
public void UpdateBatch(long batchId, string batchStatus) { SpCall spCall = new SpCall("DAT.QB_BATCH_INTEGRATION_UPDATE"); spCall.SetBigInt("@ID", batchId); spCall.SetVarchar("@STATUS", batchStatus); spCall.SetDateTime("@UPDATE_DATE", DateTime.Now); spCall.SetVarchar("@UPDATE_USER", context.UserName); db.ExecuteNonQuery(spCall); }
public void InsertNewItem(MaestroUnit item) { SpCall call = new SpCall("DAT.UNIT_INSERT"); call.SetBigInt("@UNIT_TYPE_ID", item.UnitType.Id); call.SetVarchar("@UNIT_NAME", item.Name); call.SetVarchar("@QB_UNIT", item.QuickBooksUnit); call.SetDateTime("@CREATE_DATE", DateTime.Now); call.SetVarchar("@CREATE_USER", context.UserName); item.Id = db.ExecuteScalar <long>(call); }
protected override void Update() { Entity.CustomerProductUnit item = (Entity.CustomerProductUnit)request.TransactionEntityList[0]; if (CustomerProductUnitCache.Instance.Exists(item)) { throw new Exception("Item already exists"); } SpCall call = new SpCall("DAT.CUSTOMER_PRODUCT_UNIT_UPDATE"); call.SetBigInt("@ID", item.Id); call.SetBigInt("@CUSTOMER_ID", item.Customer.Id); call.SetBigInt("@PRODUCT_ID", item.Product.Id); call.SetBigInt("@UNIT_ID", item.Unit.Id); call.SetDateTime("@UPDATE_DATE", DateTime.Now); call.SetVarchar("@UPDATE_USER", Context.UserName); db.ExecuteNonQuery(call); Context.TransactionObject = item; }
protected override void New() { Entity.QuickBooksProductMapDef map = (Entity.QuickBooksProductMapDef)request.TransactionEntityList[0]; SpCall call = new SpCall("DAT.QB_PRODUCT_MAP_INSERT"); call.SetBigInt("@PRODUCT_ID", map.Product.Id); call.SetVarchar("@QB_CODE", map.QuickBooksCode); call.SetVarchar("@QB_LIST_ID", map.QuickBooksListId); call.SetVarchar("@QB_PARENT_CODE", map.QuickBooksParentCode); call.SetVarchar("@QB_PARENT_LIST_ID", map.QuickBooksParentListId); call.SetVarchar("@QB_DESCRIPTION", map.QuickBooksDescription); call.SetBigInt("@UNIT_ID", map.Unit.Id); call.SetDecimal("@PRICE", map.Price); call.SetDateTime("@CREATE_DATE", DateTime.Now); call.SetVarchar("@CREATE_USER", Context.UserName); call.SetVarchar("@REPORT_LABEL", map.Label); map.Id = db.ExecuteScalar <long>(call); response.TransactionResult = map; }
public void InsertIntegrationLog(QuickBooksInvoiceLog log) { SpCall spCall = new SpCall("DAT.QB_INVOICE_LOG_INSERT"); spCall.SetBigInt("@ORDER_ID", log.OrderId); spCall.SetBigInt("@MAESTRO_CUSTOMER_ID", log.Customer.Id); spCall.SetVarchar("@QB_CUSTOMER_ID", log.Customer.QuickBooksId); spCall.SetVarchar("@INTEGRATION_STATUS", log.IntegrationStatus); spCall.SetDateTime("@INTEGRATION_DATE", log.IntegrationDate); spCall.SetBigInt("@BATCH_ID", log.BatchId); spCall.SetVarchar("@QB_INVOICE_NO", log.QuickBooksInvoiceId); spCall.SetVarchar("@QB_TXN_ID", log.QuickBooksTxnId); spCall.SetVarchar("@ERROR_LOG", log.ErrorLog); spCall.SetDateTime("@CREATE_DATE", log.CreateDate); spCall.SetVarchar("@CREATE_USER", context.UserName); long result = db.ExecuteScalar <long>(spCall); log.Id = result; }
protected override void Delete() { long id = ValidateEntityIdFromDataExtension(); Context.TransactionObject = UnitTypeCache.Instance[id]; SpCall spCall = new SpCall("DAT.UNIT_TYPE_DELETE"); spCall.SetBigInt("@ID", id); spCall.SetDateTime("@UPDATE_DATE", DateTime.Now); spCall.SetVarchar("@UPDATE_USER", Context.UserName); Context.Database.ExecuteNonQuery(spCall); }
protected override void Delete() { long id = ValidateEntityIdFromDataExtension(); Context.TransactionObject = CustomerProductUnitCache.Instance[id]; SpCall spCall = new SpCall("DAT.CUSTOMER_PRODUCT_UNIT_DELETE"); spCall.SetBigInt("@ID", id); spCall.SetDateTime("@UPDATE_DATE", DateTime.Now); spCall.SetVarchar("@UPDATE_USER", Context.UserName); db.ExecuteNonQuery(spCall); }
void DeleteOrderItem(OrderItem item) { item.UpdateDate = DateTime.Now; item.UpdatedUser = context.UserName; SpCall spCall = new SpCall("DAT.ORDER_ITEM_DELETE"); spCall.SetBigInt("@ID", item.Id); spCall.SetDateTime("@UPDATE_DATE", item.UpdateDate); spCall.SetVarchar("@UPDATE_USER", context.UserName); db.ExecuteNonQuery(spCall); }
public void Update(MaestroProductGroup productGroup) { SpCall call = new SpCall("DAT.PRODUCT_GROUP_UPDATE"); call.SetBigInt("@ID", productGroup.Id); call.SetVarchar("@PRODUCT_GROUP_NAME", productGroup.Name); call.SetVarchar("@GROUP_DESCRIPTION", productGroup.GroupDescription); call.SetDateTime("@UPDATE_DATE", DateTime.Now); call.SetVarchar("@UPDATE_USER", context.UserName); db.ExecuteNonQuery(call); }
public void Update(MaestroProduct product) { SpCall call = new SpCall("DAT.PRODUCT_UPDATE"); call.SetBigInt("@ID", product.Id); call.SetVarchar("@PRODUCT_NAME", product.Name); call.SetVarchar("@PRODUCT_DESCRIPTION", product.Description); call.SetVarchar("@QB_PRODUCT_ID", product.QuickBooksProductId); call.SetDecimal("@PRICE", product.Price); call.SetInt("@MINIMUM_ORDER_QUANTITY", product.MinimumOrderQuantity); call.SetBigInt("@UNIT_TYPE_ID", product.UnitType.Id); call.SetBigInt("@PRODUCT_GROUP_ID", product.GroupId); call.SetDecimal("@COST_BASE", product.CostBase); call.SetDateTime("@UPDATE_DATE", DateTime.Now); call.SetVarchar("@UPDATE_USER", context.UserName); db.ExecuteNonQuery(call); }
protected override void Delete() { string userName = request.MessageHeader.UserName; long id = ValidateEntityIdFromDataExtension(); Context.TransactionObject = UnitCache.Instance[id]; SpCall spCall = new SpCall("DAT.UNIT_DELETE"); spCall.SetBigInt("@ID", id); spCall.SetDateTime("@UPDATE_DATE", DateTime.Now); spCall.SetVarchar("@UPDATE_USER", userName); db.ExecuteNonQuery(spCall); }
protected override void Update() { MaestroUnitType item = (MaestroUnitType)request.TransactionEntityList[0]; Context.TransactionObject = item; SpCall call = new SpCall("DAT.UNIT_TYPE_UPDATE"); call.SetBigInt("@ID", item.Id); call.SetVarchar("@UNIT_TYPE_NAME", item.Name); call.SetVarchar("@UNIT_TYPE_DESCRIPTION", item.Description); call.SetBit("@CAN_HAVE_UNITS", item.CanHaveUnits); call.SetDateTime("@UPDATE_DATE", DateTime.Now); call.SetVarchar("@UPDATE_USER", Context.UserName); db.ExecuteNonQuery(call); }
public void Update(MaestroCustomer customer) { SpCall call = new SpCall("DAT.CUSTOMER_UPDATE"); call.SetBigInt("@ID", customer.Id); call.SetVarchar("@CUSTOMER_NAME", customer.QuickBoosCompany); call.SetVarchar("@CUSTOMER_TITLE", customer.Title); call.SetVarchar("@CUSTOMER_ADDRESS", customer.Address); call.SetVarchar("@CUSTOMER_PHONE", customer.Phone); call.SetVarchar("@CUSTOMER_EMAIL", customer.Email); call.SetVarchar("@QB_CUSTOMER_ID", customer.QuickBooksId); call.SetVarchar("@QB_COMPANY", customer.Name); call.SetBigInt("@REGION_ID", customer.Region.Id); call.SetVarchar("@DEFAULT_PAYMENT_TYPE", customer.DefaultPaymentType); call.SetVarchar("@CUSTOMER_GROUP", customer.CustomerGroup); call.SetVarchar("@REPORT_GROUP", customer.ReportGroup); call.SetDateTime("@UPDATE_DATE", DateTime.Now); call.SetVarchar("@UPDATE_USER", context.UserName); call.SetVarchar("@RECORD_STATUS", string.IsNullOrWhiteSpace(customer.RecordStatus) ? "A" : customer.RecordStatus); call.SetVarchar("@INVOICE_GROUP", customer.InvoiceGroup); db.ExecuteNonQuery(call); }
protected override void Update() { MaestroRegion region = (MaestroRegion)request.TransactionEntityList[0]; SpCall call = new SpCall("DAT.REGION_UPDATE"); call.SetBigInt("@ID", region.Id); call.SetVarchar("@POSTAL_CODE", region.PostalCode); call.SetVarchar("@REGION_NAME", region.Name); call.SetVarchar("@REGION_DESCRIPTION", region.Description); call.SetVarchar("@GREATER_REGION", region.GreaterRegion); call.SetDateTime("@UPDATE_DATE", DateTime.Now); call.SetVarchar("@UPDATE_USER", Context.UserName); db.ExecuteNonQuery(call); Context.TransactionObject = region; RegionCache.Instance.Reload(true); }
public void InsertTransactionLog(TransactionLog tranLog) { SpCall call = new SpCall("COR.TRANSACTION_LOG_INSERT"); call.SetVarchar("@TRAN_CODE", tranLog.TransactionCode); call.SetBinary("@TRANSACTION_LOG", tranLog.Log); call.SetVarchar("@TRANSACTION_JSON", tranLog.LogJson); call.SetVarchar("@TRANSACTION_STATUS", tranLog.Status); call.SetBigInt("@TRANSACTION_OBJECT_ID", tranLog.LogObjectId); call.SetVarchar("@ACTION_TYPE", tranLog.ActionType); call.SetVarchar("@REQUEST_TYPE", tranLog.RequestType); call.SetDateTime("@CREATE_DATE", DateTime.Now); call.SetVarchar("@CREATE_USER", tranLog.CreatedUser); call.SetDecimal("@DURATION", tranLog.Duration); long id = db.ExecuteScalar <long>(call); tranLog.Id = id; }
protected override void Delete() { long id = ValidateEntityIdFromDataExtension(); try { Context.TransactionObject = TransactionCache.Instance[id]; } catch (Exception ex) { throw new Exception(string.Format("Transaction id {0} could not be found", id), ex); } SpCall spCall = new SpCall("COR.TRANSACTION_DEFINITION_DELETE"); spCall.SetBigInt("@ID", id); spCall.SetDateTime("@UPDATE_DATE", DateTime.Now); spCall.SetVarchar("@UPDATE_USER", Context.UserName); db.ExecuteNonQuery(spCall); }
protected override void Delete() { long orderId = ValidateEntityIdFromDataExtension(); //Context.TransactionObject = new Framework.ManagerRepository.OrderManager(Context).GetOrder(id); QuickBooksInvoiceLog log = qim.GetInvoiceLog(orderId); if (log.IntegrationStatus == QbIntegrationLogStatus.OK || log.IntegrationStatus == QbIntegrationLogStatus.REVOKED) { Context.TransactionObject = log; qim.CancelInvoice(log); } SpCall spCall = new SpCall("DAT.ORDER_MASTER_DELETE"); spCall.SetBigInt("@ID", orderId); spCall.SetDateTime("@UPDATE_DATE", DateTime.Now); spCall.SetVarchar("@UPDATE_USER", Context.UserName); db.ExecuteNonQuery(spCall); }