예제 #1
0
        public static void update(Guid id, string name)
        {
            State objOld = new State(id);

            //generate log description
            string logDescription = "";

            if (objOld.Name != name)
            {
                logDescription = Tools.append(logDescription, String.Format("Name: '{0}' to '{1}'", objOld.Name, name), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "state_update",
                    new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id),
                    new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name)
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }
예제 #2
0
        public static void delete(Guid id)
        {
            InventoryStockLevel obj = new InventoryStockLevel(id);

            //generate log description
            string logDescription = "";

            logDescription = Tools.append(logDescription, String.Format("Product Store Name: '{0}'", obj.ProductStoreName), ",");
            logDescription = Tools.append(logDescription, String.Format("Grade: '{0}'", obj.GradeName), ",");
            logDescription = Tools.append(logDescription, String.Format("Product Width: '{0}'", obj.ProductWidthName), ",");
            logDescription = Tools.append(logDescription, String.Format("Length Unit: '{0}'", obj.LengthUnitName), ",");
            logDescription = Tools.append(logDescription, String.Format("Vendor: '{0}'", obj.VendorName), ",");
            logDescription = Tools.append(logDescription, String.Format("Qty: '{0}'", obj.Qty), ",");
            logDescription = Tools.append(logDescription, String.Format("PO Notes: '{0}'", obj.PONotes), ",");
            logDescription = Tools.append(logDescription, String.Format("Notes: '{0}'", obj.Notes), ",");

            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "inventorystocklevel_delete",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id)
                );

            if (result.IsSuccessful)
            {
                ActivityLog.submit(id, String.Format("Deleted: {0}", logDescription));
            }
        }
        public static void update(Guid id, Guid customerID, Guid gradeID, Guid productStoreNameID, Guid productWidthID, Guid lengthUnitID, Guid?colorID, decimal adjustmentPerUnit, string notes)
        {
            CustomerSaleAdjustment objOld = new CustomerSaleAdjustment(id);

            //generate log description
            string logDescription = "";

            if (objOld.CustomerID != customerID)
            {
                Customer customer = new Customer(customerID); logDescription = Tools.append(logDescription, String.Format("Customer Name: '{0}' to '{1}'", objOld.CustomerName, customer.Name), ",");
            }
            if (objOld.ProductStoreNameID != productStoreNameID)
            {
                logDescription = Tools.append(logDescription, String.Format("Product Store Name: '{0}' to '{1}'", objOld.ProductStoreName, new ProductStoreName(productStoreNameID).Name), ",");
            }
            if (objOld.GradeID != gradeID)
            {
                logDescription = Tools.append(logDescription, String.Format("Grade: '{0}' to '{1}'", objOld.GradeID, new Grade(gradeID).Name), ",");
            }
            if (objOld.ProductWidthID != productWidthID)
            {
                logDescription = Tools.append(logDescription, String.Format("Product Width: '{0}' to '{1}'", objOld.ProductWidthName, new ProductWidth(productWidthID).Name), ",");
            }
            if (objOld.LengthUnitID != lengthUnitID)
            {
                logDescription = Tools.append(logDescription, String.Format("Length Unit: '{0}' to '{1}'", objOld.LengthUnitID, new LengthUnit(lengthUnitID).Name), ",");
            }
            if (objOld.AdjustmentPerUnit != adjustmentPerUnit)
            {
                logDescription = Tools.append(logDescription, String.Format("Adjustment: '{0}' to '{1}'", objOld.AdjustmentPerUnit, adjustmentPerUnit), ",");
            }
            if (objOld.Notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "customersaleadjustment_update",
                    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)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }
예제 #4
0
        public static void update(Guid id, string name)
        {
            try
            {
                Grade objOld = new Grade(id);

                //generate log description
                string logDescription = "";
                if (objOld.Name != name)
                {
                    logDescription = Tools.append(logDescription, String.Format("Name: '{0}' to '{1}'", objOld.Name, name), ",");
                }

                if (!string.IsNullOrEmpty(logDescription))
                {
                    using (SqlCommand cmd = new SqlCommand("grade_update", DBConnection.ActiveSqlConnection))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@" + COL_DB_ID, SqlDbType.UniqueIdentifier).Value = id;
                        cmd.Parameters.Add("@" + COL_DB_NAME, SqlDbType.VarChar).Value        = name;

                        cmd.ExecuteNonQuery();

                        ActivityLog.submitUpdate(id, logDescription);
                    }
                    Tools.hasMessage("Item updated");
                }
            }
            catch (Exception ex) { Tools.showError(ex.Message); }
        }
        public static void delete(Guid id)
        {
            CustomerSaleAdjustment obj = new CustomerSaleAdjustment(id);

            //generate log description
            string logDescription = "";

            logDescription = Tools.append(logDescription, String.Format("Customer Name: '{0}'", obj.CustomerName), ",");
            logDescription = Tools.append(logDescription, String.Format("Product Store Name: '{0}'", obj.ProductStoreName), ",");
            logDescription = Tools.append(logDescription, String.Format("Grade: '{0}'", obj.GradeName), ",");
            logDescription = Tools.append(logDescription, String.Format("Product Width: '{0}'", obj.ProductWidthName), ",");
            logDescription = Tools.append(logDescription, String.Format("Unit: '{0}'", obj.LengthUnitName), ",");
            logDescription = Tools.append(logDescription, String.Format("Adjustment: '{0}'", obj.AdjustmentPerUnit), ",");
            logDescription = Tools.append(logDescription, String.Format("Notes: '{0}'", obj.Notes), ",");

            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "customersaleadjustment_delete",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id)
                );

            if (result.IsSuccessful)
            {
                ActivityLog.submit(id, String.Format("Item deleted: {0}", logDescription));
            }
        }
예제 #6
0
        public static void update(Guid id, string name, string address, Guid cityID, Guid?defaultTransportID, string phone1, string phone2, string notes, Guid?salesUserID)
        {
            Customer objOld = new Customer(id);

            //generate log description
            string logDescription = "";

            if (objOld.Name != name)
            {
                logDescription = Tools.append(logDescription, String.Format("Name: '{0}' to '{1}'", objOld.Name, name), ",");
            }
            if (objOld.Address != address)
            {
                logDescription = Tools.append(logDescription, String.Format("Address: '{0}' to '{1}'", objOld.Address, address), ",");
            }
            if (objOld.CityID != cityID)
            {
                logDescription = Tools.append(logDescription, String.Format("City: '{0}' to '{1}'", objOld.CityName, new City(cityID).Name), ",");
            }
            logDescription = ActivityLog.appendChange(logDescription, objOld.DefaultTransportName, new Transport(defaultTransportID).Name, "Angkutan: '{0}' to '{1}'");
            if (objOld.Phone1 != phone1)
            {
                logDescription = Tools.append(logDescription, String.Format("Phone 1: '{0}' to '{1}'", objOld.Phone1, phone1), ",");
            }
            if (objOld.Phone2 != phone2)
            {
                logDescription = Tools.append(logDescription, String.Format("Phone 2: '{0}' to '{1}'", objOld.Phone2, phone2), ",");
            }
            if (objOld.Notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ",");
            }
            logDescription = ActivityLog.appendChange(logDescription, objOld.SalesUserName, new UserAccount(salesUserID).name, "Sales: '{0}' to '{1}'");

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "customer_update",
                    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, Util.wrapNullable(salesUserID))
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }
예제 #7
0
        public void update()
        {
            UserAccount objOld = new UserAccount(id);

            //generate log description
            string logDescription = "";

            if (objOld.name != name)
            {
                logDescription = Tools.append(logDescription, String.Format("Name: '{0}' to '{1}'", objOld.name, name), ",");
            }
            if (!string.IsNullOrEmpty(_hashed_password) && objOld._hashed_password != _hashed_password)
            {
                logDescription = Tools.append(logDescription, "Password update", ",");
            }
            if (objOld.role != role)
            {
                logDescription = Tools.append(logDescription, String.Format("Role: '{0}' to '{1}'", objOld.role, role), ",");
            }
            if (objOld.percentCommission != percentCommission)
            {
                logDescription = Util.appendChange(logDescription, objOld.percentCommission, percentCommission, "% Comission: {0:N2} to {1:N2}");
            }
            if (objOld.GlobalPercentComission != GlobalPercentComission)
            {
                logDescription = Util.appendChange(logDescription, objOld.GlobalPercentComission, GlobalPercentComission, "Global % Comission: {0} to {1}");
            }
            if (objOld.notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.notes, notes), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "users_update",
                    new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id),
                    new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name),
                    new SqlQueryParameter(COL_DB_HashedPassword, SqlDbType.VarChar, Util.wrapNullable(_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)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }
예제 #8
0
        private static string compileSortPhrase(string column1Name, SortOrder?column1Direction, string column2Name, SortOrder?column2Direction)
        {
            string str = "";

            if (!string.IsNullOrEmpty(column1Name))
            {
                str = Tools.append(str, string.Format("{0} {1}", column1Name, getDirectionString(column1Direction)), ",");
            }
            if (!string.IsNullOrEmpty(column2Name))
            {
                str = Tools.append(str, string.Format("{0} {1}", column2Name, getDirectionString(column2Direction)), ",");
            }
            return(str);
        }
예제 #9
0
        public static void update(Guid id, string name, string address, string phone1, string phone2, string notes)
        {
            Vendor objOld = new Vendor(id);

            //generate log description
            string logDescription = "";

            if (objOld.Name != name)
            {
                logDescription = Tools.append(logDescription, String.Format("Name: '{0}' to '{1}'", objOld.Name, name), ",");
            }
            if (objOld.Address != address)
            {
                logDescription = Tools.append(logDescription, String.Format("Address: '{0}' to '{1}'", objOld.Address, address), ",");
            }
            if (objOld.Phone1 != phone1)
            {
                logDescription = Tools.append(logDescription, String.Format("Phone 1: '{0}' to '{1}'", objOld.Phone1, phone1), ",");
            }
            if (objOld.Phone2 != phone2)
            {
                logDescription = Tools.append(logDescription, String.Format("Phone 2: '{0}' to '{1}'", objOld.Phone2, phone2), ",");
            }
            if (objOld.Notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "vendor_update",
                    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)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }
예제 #10
0
        public static void update(Guid id, Guid storeNameID, string nameVendor, Guid vendorID, decimal percentageOfPercentCommission, decimal?maxCommissionAmount, string notes)
        {
            Product objOld = new Product(id);

            //generate log description
            string logDescription = "";

            if (objOld.NameVendor != nameVendor)
            {
                logDescription = Tools.append(logDescription, String.Format("Name - Vendor: '{0}' to '{1}'", objOld.NameVendor, nameVendor), ",");
            }
            if (objOld.StoreNameID != storeNameID)
            {
                logDescription = Tools.append(logDescription, String.Format("Name - Store: '{0}' to '{1}'", objOld.StoreName, new ProductStoreName(storeNameID).Name), ",");
            }
            if (objOld.VendorID != vendorID)
            {
                logDescription = Tools.append(logDescription, String.Format("Vendor ID: '{0}' to '{1}'", objOld.VendorName, new Vendor(vendorID).Name), ",");
            }
            logDescription = LIBUtil.Util.appendChange(logDescription, objOld.PercentageOfPercentCommission, percentageOfPercentCommission, "Percentage of Percent Comission: {0:N2} to {1:N2}");
            logDescription = LIBUtil.Util.appendChange(logDescription, objOld.MaxCommissionAmount, maxCommissionAmount, "Max Comission: {0:N0} to {1:N0}");
            if (objOld.Notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "product_update",
                    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)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }
예제 #11
0
        public static string compileQuickSearchFilter(string keyword, string[] fieldNames)
        {
            string filter = "";

            foreach (string word in keyword.Split())
            {
                if (!string.IsNullOrEmpty(word.Trim()))
                {
                    foreach (string fieldname in fieldNames)
                    {
                        filter = Tools.append(filter, string.Format("CONVERT({0},System.String) LIKE '%{1}%'", fieldname, word), "OR");
                    }
                }
            }
            return(filter);
        }
예제 #12
0
        public static string compileDBFilterString(CheckedListBox clb, string fieldName, Type type)
        {
            string filter = "";

            foreach (object item in clb.CheckedItems)
            {
                if (type == typeof(Guid))
                {
                    filter = Tools.append(filter, string.Format("Convert('{0}', 'System.Guid')", ((DataRowView)item)[0].ToString()), ",");
                }
                else if (type == typeof(string))
                {
                    filter = Tools.append(filter, string.Format("'{0}'", ((DataRowView)item)[0].ToString()), ",");
                }
            }
            return(filter);
        }
예제 #13
0
        public bool update()
        {
            InventoryItem objOld = new InventoryItem(id);

            //generate log description
            string logDescription = "";

            if (objOld.inventory_id != inventory_id)
            {
                logDescription = Tools.append(logDescription, String.Format("Inventory ID: '{0}' to '{1}'", objOld.inventory_id, inventory_id), ",");
            }
            if (objOld.item_length != item_length)
            {
                logDescription = Tools.append(logDescription, String.Format("Length: '{0}' to '{1}'", objOld.item_length, item_length), ",");
            }
            logDescription = Util.appendChange(logDescription, objOld.ColorName, new FabricColor(ColorID).Name, "Color: '{0}' to '{1}'");
            if (objOld.notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.notes, notes), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "inventoryitem_update",
                    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)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                    return(true);
                }
            }

            return(false);
        }
예제 #14
0
        public string compileData()
        {
            string data = Name;

            if (!string.IsNullOrEmpty(Address))
            {
                data += Environment.NewLine + Address;
            }

            string phones = Tools.append(Phone1, Phone2, ",");

            if (!string.IsNullOrEmpty(phones))
            {
                data += Environment.NewLine + phones;
            }

            return(data);
        }
예제 #15
0
        public static void update(Guid id, string description, Guid?customerID, Guid?vendorID)
        {
            ToDo objOld = new ToDo(id);

            //generate log description
            string logDescription = "";

            if (objOld.Description != description)
            {
                logDescription = Tools.append(logDescription, String.Format("Description: '{0}' to '{1}'", objOld.Description, description), ",");
            }
            if (objOld.CustomerID != customerID)
            {
                logDescription = Tools.append(logDescription, String.Format("Customer Name: '{0}' to '{1}'", objOld.CustomerName, new Customer(customerID).Name), ",");
            }
            if (objOld.VendorID != vendorID)
            {
                logDescription = Tools.append(logDescription, String.Format("Customer Name: '{0}' to '{1}'", objOld.VendorName, new Vendor(vendorID).Name), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "todo_update",
                    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)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }
예제 #16
0
        public static void update(Guid Id, decimal debtLimit, int termDays, string notes)
        {
            CustomerTerm objOld = new CustomerTerm(Id);

            //generate log description
            string logDescription = "";

            if (objOld.DebtLimit != debtLimit)
            {
                logDescription = Tools.append(logDescription, String.Format("Limit: '{0}' to '{1}'", objOld.DebtLimit, debtLimit), ",");
            }
            if (objOld.TermDays != termDays)
            {
                logDescription = Tools.append(logDescription, String.Format("Term days: '{0}' to '{1}'", objOld.TermDays, termDays), ",");
            }
            if (objOld.Notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "CustomerTerms_update",
                    new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                    new SqlQueryParameter(COL_DB_DEBTLIMIT, SqlDbType.Decimal, debtLimit),
                    new SqlQueryParameter(COL_DB_TERMDAYS, SqlDbType.Int, termDays),
                    new SqlQueryParameter(COL_DB_NOTES, SqlDbType.NVarChar, Util.wrapNullable(notes))
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submitUpdate(Id, logDescription);
                }
            }
        }
예제 #17
0
        public static void update(Guid id, string storageName, string vendorName, string vendorInfo, string description, DateTime?priceDate, decimal?pricePerUnit, DateTime?discontinueDate, string notes, Guid?lengthUnitID, decimal?sellPricePerUnit)
        {
            Sample objOld = new Sample(id);

            //generate log description
            string logDescription = "";

            if (objOld.StorageName != storageName)
            {
                logDescription = Tools.append(logDescription, String.Format("Storage Name: '{0}' to '{1}'", objOld.StorageName, storageName), ",");
            }
            if (objOld.VendorName != vendorName)
            {
                logDescription = Tools.append(logDescription, String.Format("Vendor Name: '{0}' to '{1}'", objOld.VendorName, vendorName), ",");
            }
            if (objOld.VendorInfo != vendorInfo)
            {
                logDescription = Tools.append(logDescription, String.Format("Vendor Info: '{0}' to '{1}'", objOld.VendorInfo, vendorInfo), ",");
            }
            if (objOld.Description != description)
            {
                logDescription = Tools.append(logDescription, String.Format("Description: '{0}' to '{1}'", objOld.Description, description), ",");
            }
            if (objOld.PriceDate != priceDate)
            {
                logDescription = Tools.append(logDescription, String.Format("Price Date: '{0:MM/dd/yy}' to '{1:MM/dd/yy}'", objOld.PriceDate, priceDate), ",");
            }
            if (objOld.PricePerUnit != pricePerUnit)
            {
                logDescription = Tools.append(logDescription, String.Format("Price Per Unit: '{0:N2}' to '{1:N2}'", objOld.PricePerUnit, pricePerUnit), ",");
            }
            if (objOld.DiscontinueDate != discontinueDate)
            {
                logDescription = Tools.append(logDescription, String.Format("Discontinue Date: '{0:MM/dd/yy}' to '{1:MM/dd/yy}'", objOld.DiscontinueDate, discontinueDate), ",");
            }
            if (objOld.Notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ",");
            }
            logDescription = ActivityLog.appendChange(logDescription, objOld.SellPricePerUnit, sellPricePerUnit, "Sell Price: '{0}' to '{1}'");
            logDescription = ActivityLog.appendChange(logDescription, objOld.LengthUnitName, new LengthUnit(lengthUnitID).Name, "Unit: '{0}' to '{1}'");

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "sample_update",
                    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)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }
예제 #18
0
        public static void update(Guid id, Guid gradeID, Guid productID, Guid productWidthID, Guid lengthUnitID, Guid colorID, int qty, int orderLotQty, string poNotes, string notes)
        {
            InventoryStockLevel objOld = new InventoryStockLevel(id);

            //generate log description
            string  logDescription = "";
            Product product        = new Product(productID);

            if (objOld.ProductStoreNameID != product.StoreNameID)
            {
                logDescription = Tools.append(logDescription, String.Format("Product Store Name: '{0}' to '{1}'", objOld.ProductStoreName, product.StoreName), ",");
            }
            if (objOld.GradeID != gradeID)
            {
                logDescription = Tools.append(logDescription, String.Format("Grade: '{0}' to '{1}'", objOld.GradeID, new Grade(gradeID).Name), ",");
            }
            if (objOld.ProductWidthID != productWidthID)
            {
                logDescription = Tools.append(logDescription, String.Format("Product Width: '{0}' to '{1}'", objOld.ProductWidthName, new ProductWidth(productWidthID).Name), ",");
            }
            if (objOld.LengthUnitID != lengthUnitID)
            {
                logDescription = Tools.append(logDescription, String.Format("Length Unit: '{0}' to '{1}'", objOld.LengthUnitID, new LengthUnit(lengthUnitID).Name), ",");
            }
            if (objOld.VendorName != product.VendorName)
            {
                logDescription = Tools.append(logDescription, String.Format("Vendor: '{0}' to '{1}'", objOld.VendorName, product.VendorName), ",");
            }
            if (objOld.OrderLotQty != orderLotQty)
            {
                logDescription = Tools.append(logDescription, String.Format("Lot qty: '{0}' to '{1}'", objOld.OrderLotQty, orderLotQty), ",");
            }
            if (objOld.Qty != qty)
            {
                logDescription = Tools.append(logDescription, String.Format("Qty: '{0}' to '{1}'", objOld.Qty, qty), ",");
            }
            if (objOld.PONotes != poNotes)
            {
                logDescription = Tools.append(logDescription, String.Format("PO Notes: '{0}' to '{1}'", objOld.PONotes, poNotes), ",");
            }
            if (objOld.Notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "inventorystocklevel_update",
                    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)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }