Ejemplo n.º 1
0
        private bool RestoreProcedures()
        {
            var commodities = this.totalSmartPortalEntities.Commodities.ToList();

            foreach (Commodity commodity in commodities)
            {
                if (commodity.CodePartB.IndexOf("[") > 0 || commodity.CodePartC.IndexOf("[") > 0 || (commodity.CodePartD != null && commodity.CodePartD.IndexOf("[") > 0))
                {
                    throw new Exception("[9999999999999");
                }

                string newCode = ((commodity.CommodityTypeID != (int)GlobalEnums.CommodityTypeID.Items && !String.IsNullOrWhiteSpace(commodity.CodePartA) ? commodity.CodePartA + " " : "") + (!String.IsNullOrWhiteSpace(commodity.CodePartB) ? commodity.CodePartB + " " : "") + (!String.IsNullOrWhiteSpace(commodity.CodePartC) ? commodity.CodePartC + " " : "") + (!String.IsNullOrWhiteSpace(commodity.CodePartD) ? commodity.CodePartD + " " : "") + (commodity.CommodityTypeID == (int)GlobalEnums.CommodityTypeID.Items && !String.IsNullOrWhiteSpace(commodity.CodePartA) ? commodity.CodePartA + " " : "") + (!String.IsNullOrWhiteSpace(commodity.CodePartE) ? commodity.CodePartE + " x " : "") + (!String.IsNullOrWhiteSpace(commodity.CodePartF) ? commodity.CodePartF : "")).Trim();
                this.ExecuteStoreCommand("UPDATE Commodities SET Code = N'" + newCode + "', OfficialCode = N'" + TotalBase.CommonExpressions.AlphaNumericString(newCode) + "' WHERE CommodityID = " + commodity.CommodityID, new ObjectParameter[] { });
            }



            this.totalSmartPortalEntities.ColumnAdd("Repacks", "SerialID", "int", "0", true);
            this.totalSmartPortalEntities.ColumnAdd("WarehouseAdjustments", "CustomerID", "int", "1", true);
            this.totalSmartPortalEntities.ColumnAdd("WarehouseAdjustmentDetails", "CustomerID", "int", "1", true);

            this.InitReports();

            this.CreateStoredProcedure();

            //SET LASTEST VERSION AFTER RESTORE SUCCESSFULL
            this.ExecuteStoreCommand("UPDATE Configs SET StoredID = " + GlobalEnums.MaxConfigVersionID() + " WHERE StoredID < " + GlobalEnums.MaxConfigVersionID(), new ObjectParameter[] { });

            return(true);
        }
Ejemplo n.º 2
0
        public bool AutoUpdates(bool restoreProcedures)
        {
            if (restoreProcedures || this.GetStoredID(GlobalEnums.ConfigID) < GlobalEnums.MaxConfigVersionID())
            {
                this.RestoreProcedures();
            }

            return(this.GetStoredID(GlobalEnums.ConfigID) == GlobalEnums.MaxConfigVersionID());
        }