Example #1
0
        /*******************************************************************************************************/
        #region DATABASE METHODS

        public Guid?submitNew()
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "users_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name),
                new SqlQueryParameter(COL_DB_HashedPassword, SqlDbType.VarChar, _hashed_password),
                new SqlQueryParameter(COL_ROLE, SqlDbType.TinyInt, (int)role),
                new SqlQueryParameter(COL_DB_PercentCommission, SqlDbType.Decimal, percentCommission),
                new SqlQueryParameter(COL_DB_GlobalPercentComission, SqlDbType.Decimal, GlobalPercentComission),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
        /*******************************************************************************************************/
        #region DATABASE METHODS

        public static Guid add(Guid Users_Id, DateTime Period, decimal GlobalPercentComission, int Amount, int CorrectionAmount, string CorrectionNotes, DateTime PaymentDate)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "SaleComissions_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_Users_Id, SqlDbType.UniqueIdentifier, Users_Id),
                new SqlQueryParameter(COL_DB_Period, SqlDbType.DateTime, Period),
                new SqlQueryParameter(COL_DB_GlobalPercentComission, SqlDbType.Decimal, GlobalPercentComission),
                new SqlQueryParameter(COL_DB_Amount, SqlDbType.Int, Amount),
                new SqlQueryParameter(COL_DB_CorrectionAmount, SqlDbType.Int, CorrectionAmount),
                new SqlQueryParameter(COL_DB_CorrectionNotes, SqlDbType.VarChar, CorrectionNotes),
                new SqlQueryParameter(COL_DB_PaymentDate, SqlDbType.DateTime, PaymentDate)
                );

            if (result.IsSuccessful)
            {
                ActivityLog.submitCreate(Id);
            }

            return(Id);
        }
        public static Guid?add(Guid customerID, decimal debtLimit, int termDays, string notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "CustomerTerms_add",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_CUSTOMERS_ID, SqlDbType.UniqueIdentifier, customerID),
                new SqlQueryParameter(COL_DB_DEBTLIMIT, SqlDbType.Decimal, debtLimit),
                new SqlQueryParameter(COL_DB_TERMDAYS, SqlDbType.Int, termDays),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #4
0
        public Guid?submitNew()
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "inventory_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_BUYPRICE, SqlDbType.Decimal, buy_price),
                new SqlQueryParameter(COL_DB_GRADEID, SqlDbType.UniqueIdentifier, grade_id),
                new SqlQueryParameter(COL_DB_PRODUCTID, SqlDbType.UniqueIdentifier, product_id),
                new SqlQueryParameter(COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier, product_width_id),
                new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, length_unit_id),
                new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, color_id),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes)),
                new SqlQueryParameter(COL_DB_POITEMID, SqlDbType.UniqueIdentifier, Util.wrapNullable(POItemID)),
                new SqlQueryParameter(COL_DB_PACKINGLISTNO, SqlDbType.VarChar, PackingListNo),
                new SqlQueryParameter(COL_DB_VENDORINVOICEID, SqlDbType.UniqueIdentifier, Util.wrapNullable(VendorInvoiceID))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #5
0
        /*******************************************************************************************************/
        #region CONSTRUCTORS
        #endregion CONSTRUCTORS
        /*******************************************************************************************************/
        #region DATABASE STATIC METHODS

        public static Guid?submitNew(Guid customerID, decimal creditAmount, Guid?salePaymentID, string notes, PaymentMethod?paymentMethod)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "customercredit_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_CUSTOMERID, SqlDbType.UniqueIdentifier, customerID),
                new SqlQueryParameter(COL_DB_AMOUNT, SqlDbType.Decimal, creditAmount),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, notes),
                new SqlQueryParameter(COL_DB_SALEPAYMENTID, SqlDbType.UniqueIdentifier, Util.wrapNullable(salePaymentID)),
                new SqlQueryParameter(COL_DB_USERID, SqlDbType.UniqueIdentifier, GlobalData.UserAccount.id),
                new SqlQueryParameter(COL_DB_METHODENUMID, SqlDbType.TinyInt, Util.wrapNullable(paymentMethod))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #6
0
        public static Guid?add(string name, string address, string phone1, string phone2, string notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "vendor_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name),
                new SqlQueryParameter(COL_DB_ADDRESS, SqlDbType.VarChar, address),
                new SqlQueryParameter(COL_DB_PHONE1, SqlDbType.VarChar, phone1),
                new SqlQueryParameter(COL_DB_PHONE2, SqlDbType.VarChar, phone2),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #7
0
        public static Guid?add(string name, string address, Guid cityID, Guid?defaultTransportID, string phone1, string phone2, string notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "customer_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name),
                new SqlQueryParameter(COL_DB_ADDRESS, SqlDbType.VarChar, address),
                new SqlQueryParameter(COL_DB_CITYID, SqlDbType.UniqueIdentifier, cityID),
                new SqlQueryParameter(COL_DB_DEFAULTTRANSPORTID, SqlDbType.UniqueIdentifier, Util.wrapNullable(defaultTransportID)),
                new SqlQueryParameter(COL_DB_PHONE1, SqlDbType.VarChar, phone1),
                new SqlQueryParameter(COL_DB_PHONE2, SqlDbType.VarChar, phone2),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, notes),
                new SqlQueryParameter(COL_DB_SALESUSERID, SqlDbType.UniqueIdentifier, GlobalData.UserAccount.id)
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #8
0
        public static Guid?add(Guid storeNameID, string nameVendor, Guid vendorID, decimal percentageOfPercentCommission, decimal?maxCommissionAmount, string notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "product_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_STORENAMEID, SqlDbType.UniqueIdentifier, storeNameID),
                new SqlQueryParameter(COL_DB_NAMEVENDOR, SqlDbType.VarChar, nameVendor),
                new SqlQueryParameter(COL_DB_VENDORID, SqlDbType.UniqueIdentifier, vendorID),
                new SqlQueryParameter(COL_DB_PercentageOfPercentCommission, SqlDbType.Decimal, percentageOfPercentCommission),
                new SqlQueryParameter(COL_DB_MaxCommissionAmount, SqlDbType.Decimal, Util.wrapNullable(maxCommissionAmount)),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
        public Guid?submitNew()
        {
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "inventoryitem_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id),
                new SqlQueryParameter(COL_DB_INVENTORY_ID, SqlDbType.UniqueIdentifier, inventory_id),
                new SqlQueryParameter(COL_DB_LENGTH, SqlDbType.Decimal, item_length),
                new SqlQueryParameter(COL_DB_BARCODE, SqlDbType.VarChar, barcode.ToUpper()),
                new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, Util.wrapNullable(ColorID)),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(id);
                return(id);
            }
        }
Example #10
0
        public static Guid?add(Guid?ProductStoreNameID, Guid?GradeID, Guid?ProductWidthID, Guid?LengthUnitID, decimal TagPrice, string Notes,
                               Guid?InventoryID, Guid?ColorID, decimal?BuyPrice)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "productprice_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_PRODUCTSTORENAMEID, SqlDbType.UniqueIdentifier, Util.wrapNullable(ProductStoreNameID)),
                new SqlQueryParameter(COL_DB_GRADEID, SqlDbType.UniqueIdentifier, Util.wrapNullable(GradeID)),
                new SqlQueryParameter(COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier, Util.wrapNullable(ProductWidthID)),
                new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, Util.wrapNullable(LengthUnitID)),
                new SqlQueryParameter(COL_DB_INVENTORYID, SqlDbType.UniqueIdentifier, Util.wrapNullable(InventoryID)),
                new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, Util.wrapNullable(ColorID)),
                new SqlQueryParameter(COL_DB_SELLPRICE, SqlDbType.Decimal, TagPrice),
                new SqlQueryParameter(COL_DB_BuyPrice, SqlDbType.Decimal, Util.wrapNullable(BuyPrice)),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(Notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #11
0
        /*******************************************************************************************************/
        #region DATABASE METHODS

        public static Guid add(DateTime Timestamp, Guid?Customers_Id, Guid?Vendors_Id, string No, decimal DPP, decimal PPN, string Notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "FakturPajaks_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_Timestamp, SqlDbType.DateTime, Util.getAsStartDate(Timestamp)),
                new SqlQueryParameter(COL_DB_Customers_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(Customers_Id)),
                new SqlQueryParameter(COL_DB_Vendors_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(Vendors_Id)),
                new SqlQueryParameter(COL_DB_No, SqlDbType.VarChar, No),
                new SqlQueryParameter(COL_DB_DPP, SqlDbType.Decimal, DPP),
                new SqlQueryParameter(COL_DB_PPN, SqlDbType.Decimal, PPN),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.NVarChar, Util.wrapNullable(Notes))
                );

            if (result.IsSuccessful)
            {
                ActivityLog.submitCreate(Id);
            }

            return(Id);
        }
        public static Guid?add(Guid customerID, Guid gradeID, Guid productStoreNameID, Guid productWidthID, Guid lengthUnitID, Guid?colorID, decimal adjustmentPerUnit, string notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "customersaleadjustment_add",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_CUSTOMERID, SqlDbType.UniqueIdentifier, customerID),
                new SqlQueryParameter(COL_DB_GRADEID, SqlDbType.UniqueIdentifier, gradeID),
                new SqlQueryParameter(COL_DB_PRODUCSTORENAMEID, SqlDbType.UniqueIdentifier, productStoreNameID),
                new SqlQueryParameter(COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier, productWidthID),
                new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, lengthUnitID),
                new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, Util.wrapNullable(colorID)),
                new SqlQueryParameter(COL_DB_ADJUSTMENTPERUNIT, SqlDbType.Decimal, adjustmentPerUnit),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #13
0
        public static Guid?add(string storageName, string vendorName, string vendorInfo, string description, DateTime?priceDate, decimal?pricePerUnit, DateTime?discontinueDate, string notes, Guid?lengthUnitID, decimal?sellPricePerUnit)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "sample_add",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_STORAGENAME, SqlDbType.VarChar, storageName),
                new SqlQueryParameter(COL_DB_VENDORNAME, SqlDbType.VarChar, vendorName),
                new SqlQueryParameter(COL_DB_VENDORINFO, SqlDbType.VarChar, vendorInfo),
                new SqlQueryParameter(COL_DB_DESCRIPTION, SqlDbType.VarChar, description),
                new SqlQueryParameter(COL_DB_PRICEDATE, SqlDbType.DateTime, Util.wrapNullable(priceDate)),
                new SqlQueryParameter(COL_DB_PRICEPERUNIT, SqlDbType.Decimal, Util.wrapNullable(pricePerUnit)),
                new SqlQueryParameter(COL_DB_DISCONTINUEDATE, SqlDbType.DateTime, Util.wrapNullable(discontinueDate)),
                new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, Util.wrapNullable(lengthUnitID)),
                new SqlQueryParameter(COL_DB_SELLPRICEPERUNIT, SqlDbType.Decimal, Util.wrapNullable(sellPricePerUnit)),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #14
0
        /*******************************************************************************************************/
        #region CONSTRUCTORS

        #endregion CONSTRUCTORS
        /*******************************************************************************************************/
        #region DATABASE METHODS

        public static Guid?add(Guid referenceId, PaymentMethod paymentMethod, decimal amount, string notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "Payments_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_ReferenceId, SqlDbType.UniqueIdentifier, referenceId),
                new SqlQueryParameter(COL_DB_PaymentMethod_enumid, SqlDbType.TinyInt, paymentMethod),
                new SqlQueryParameter(COL_DB_Amount, SqlDbType.Decimal, amount),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #15
0
        public static bool add(Guid id, Guid customerId, string customerInfo, List <SaleOrderItem> items, string notes, DateTime targetDate, string customerPONo)
        {
            bool           isSuccess = false;
            SqlQueryResult result    = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "SaleOrders_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, id),
                new SqlQueryParameter(COL_DB_Customers_Id, SqlDbType.UniqueIdentifier, customerId),
                new SqlQueryParameter(COL_DB_CustomerInfo, SqlDbType.VarChar, customerInfo),
                new SqlQueryParameter(COL_DB_TargetDate, SqlDbType.DateTime, targetDate),
                new SqlQueryParameter(COL_DB_CustomerPONo, SqlDbType.VarChar, customerPONo),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.NVarChar, Util.wrapNullable(notes))
                );

            if (result.IsSuccessful)
            {
                ActivityLog.submitCreate(id);

                //submit items
                if (SaleOrderItem.add(items))
                {
                    isSuccess = true;
                }
            }

            return(isSuccess);
        }
Example #16
0
        public static Guid?add(Guid gradeID, Guid productID, Guid productWidthID, Guid lengthUnitID, Guid colorID, int qty, int orderLotQty, string poNotes, string notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "inventorystocklevel_add",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_GRADEID, SqlDbType.UniqueIdentifier, gradeID),
                new SqlQueryParameter(COL_DB_PRODUCTID, SqlDbType.UniqueIdentifier, productID),
                new SqlQueryParameter(COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier, productWidthID),
                new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, lengthUnitID),
                new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, colorID),
                new SqlQueryParameter(COL_DB_ORDERLOTQTY, SqlDbType.Int, orderLotQty),
                new SqlQueryParameter(COL_DB_QTY, SqlDbType.Int, qty),
                new SqlQueryParameter(COL_DB_PONOTES, SqlDbType.VarChar, Util.wrapNullable(poNotes)),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #17
0
        /*******************************************************************************************************/
        #region DATABASE METHODS

        public Guid?submitNew()
        {
            //submit new sale record
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                false, true, false, false, false,
                "salereturn_new",
                new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, id),
                new SqlQueryParameter(COL_DB_Timestamp, SqlDbType.DateTime, time_stamp),
                new SqlQueryParameter(COL_DB_Users_Id, SqlDbType.UniqueIdentifier, user_id),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(id);
                barcode = Tools.getHex(result.ValueInt, Settings.saleBarcodeLength);
            }

            //mark sale items as returned
            foreach (DataRow row in saleReturnItems.Rows)
            {
                result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "saleitem_return",
                    new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, Util.wrapNullable <Guid>(row, SaleItem.COL_ID)),
                    new SqlQueryParameter("return_id", SqlDbType.UniqueIdentifier, id)
                    );

                if (!result.IsSuccessful)
                {
                    return(null);
                }
                else
                {
                    ActivityLog.submit((Guid)row[SaleItem.COL_ID], "Sale Item returned in sale return ID: " + id.ToString());
                    ActivityLog.submit((Guid)row[SaleItem.COL_INVENTORY_ITEM_ID], "Returned in sale return ID: " + barcode);
                }
            }

            return(id);
        }
Example #18
0
        /*******************************************************************************************************/
        #region DATABASE METHODS

        public Guid?submitNew(DataTable SaleItems)
        {
            //format notes
            if (string.IsNullOrWhiteSpace(notes))
            {
                notes = null;
            }
            else
            {
                notes = string.Format("{0:MM/dd/yy}-{1}: {2}", DateTime.Now, GlobalData.UserAccount.name, notes);
            }

            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                true, false, false, false, false,
                "sale_new",
                new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, id),
                new SqlQueryParameter(COL_DB_Timestamp, SqlDbType.DateTime, time_stamp),
                new SqlQueryParameter(COL_DB_Voided, SqlDbType.Bit, voided),
                new SqlQueryParameter(COL_CUSTOMER_ID, SqlDbType.UniqueIdentifier, Util.wrapNullable(customer_id)),
                new SqlQueryParameter(COL_DB_Vendors_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(Vendors_Id)),
                new SqlQueryParameter(COL_DB_CUSTOMERINFO, SqlDbType.VarChar, customer_info),
                new SqlQueryParameter(COL_DB_UserId, SqlDbType.UniqueIdentifier, user_id),
                new SqlQueryParameter(COL_DB_TRANSPORTID, SqlDbType.UniqueIdentifier, Util.wrapNullable(TransportID)),
                new SqlQueryParameter(COL_DB_SHIPPINGCOST, SqlDbType.Decimal, ShippingCost),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(id);

                barcode = result.ValueString;
                SaleItem.submitItems(getListOfSaleItems(SaleItems), barcode, customer_id);

                return(id);
            }
        }
Example #19
0
        public static Guid add(string name)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "color_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name)
                );

            if (result.IsSuccessful)
            {
                ActivityLog.submitCreate(Id);
            }

            return(Id);
        }
Example #20
0
        public static Guid?submitNew(Guid id, Guid vendorID, string vendorInfo, List <POItem> items, string notes, DateTime targetDate, string poNo)
        {
            //format notes
            if (string.IsNullOrWhiteSpace(notes))
            {
                notes = null;
            }
            else
            {
                notes = string.Format("{0:MM/dd/yy}-{1}: {2}", DateTime.Now, GlobalData.UserAccount.name, notes);
            }

            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "po_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id),
                new SqlQueryParameter(COL_DB_VENDORID, SqlDbType.UniqueIdentifier, vendorID),
                new SqlQueryParameter(COL_DB_VENDORINFO, SqlDbType.VarChar, vendorInfo),
                new SqlQueryParameter(COL_DB_TARGETDATE, SqlDbType.Date, targetDate),
                new SqlQueryParameter(COL_DB_PONO, SqlDbType.VarChar, poNo),
                new SqlQueryParameter(COL_DB_USERID, SqlDbType.UniqueIdentifier, GlobalData.UserAccount.id),
                new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes)
                                      ));

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(id);

                //submit items
                POItem.submitItems(items);

                return(id);
            }
        }
Example #21
0
        public static Guid?add(string name, Guid stateID)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "city_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name),
                new SqlQueryParameter(COL_DB_STATEID, SqlDbType.UniqueIdentifier, stateID)
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #22
0
        public static Guid?add(string invoiceNo, Guid Vendors_Id)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "VendorInvoices_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_InvoiceNo, SqlDbType.VarChar, invoiceNo),
                new SqlQueryParameter(COL_DB_Vendors_Id, SqlDbType.UniqueIdentifier, Vendors_Id)
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
        public static Guid?add(string name, string notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "PettyCashRecordsCategories_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_Name, SqlDbType.VarChar, Util.wrapNullable(name)),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
Example #24
0
        /*******************************************************************************************************/
        #region DATABASE METHODS

        public static Guid add(DateTime Timestamp, Guid Customers_Id, string No, decimal Amount, DateTime?ReturnDate, string Notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "Kontrabons_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_Timestamp, SqlDbType.DateTime, Util.getAsStartDate(Timestamp)),
                new SqlQueryParameter(COL_DB_Customers_Id, SqlDbType.UniqueIdentifier, Customers_Id),
                new SqlQueryParameter(COL_DB_No, SqlDbType.VarChar, No),
                new SqlQueryParameter(COL_DB_Amount, SqlDbType.Decimal, Amount),
                new SqlQueryParameter(COL_DB_ReturnDate, SqlDbType.DateTime, Util.wrapNullable(Util.getAsStartDate(ReturnDate))),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.NVarChar, Util.wrapNullable(Notes))
                );

            if (result.IsSuccessful)
            {
                ActivityLog.submitCreate(Id);
            }

            return(Id);
        }
Example #25
0
        public static Guid?add(string description, Guid?customerID, Guid?vendorID)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "todo_add",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_DESCRIPTION, SqlDbType.VarChar, description),
                new SqlQueryParameter(COL_DB_CUSTOMERID, SqlDbType.UniqueIdentifier, Util.wrapNullable(customerID)),
                new SqlQueryParameter(COL_DB_VENDORID, SqlDbType.UniqueIdentifier, Util.wrapNullable(vendorID))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }