示例#1
0
        public static string CodigoPredet(Lfx.Workspace workspace, Lfx.Data.Row Articulo)
        {
            // Devuelve el código predeterminado de un artículo
            // Si se pasa un registro artículo como parmetro, devuelve el valor del
            // De lo contrario, devuelve el nombre del campo
            // Espero que no se preste a confusin
            string CodPredet = workspace.CurrentConfig.ReadGlobalSetting <string>("Sistema.Stock.CodigoPredet", "0");

            switch (CodPredet)
            {
            case "0":
            case "":
                // Usar el código autonumérico integrado
                CodPredet = "id_articulo";
                break;

            default:
                // Usar un código en particular
                CodPredet = "codigo" + CodPredet;
                break;
            }

            if (Articulo == null)
            {
                return(CodPredet);
            }
            else
            {
                return(System.Convert.ToString(Articulo[CodPredet]));
            }
        }
示例#2
0
        public Workspace(string workspaceName, bool openConnection, bool webAppMode)
        {
            if (Lfx.Workspace.Master == null)
            {
                Lfx.Workspace.Master = this;
            }

            this.WebAppMode = webAppMode;
            m_Name          = workspaceName;

            this.CurrentConfig = new Lfx.Config.ConfigManager();

            if (this.WebAppMode == false)
            {
                this.DefaultScheduler = new Lfx.Services.Scheduler(this);
                this.RunTime          = new Lfx.RunTimeServices();
            }

            this.Bootstrap();

            if (openConnection)
            {
                m_MasterConnection.Open();
            }

            // Personalizo los valores de CultureInfo
            this.CultureInfo.NumberFormat.CurrencyDecimalSeparator = ".";
            this.CultureInfo.NumberFormat.CurrencyDecimalDigits    = 2;
            this.CultureInfo.NumberFormat.CurrencyGroupSeparator   = "";
            this.CultureInfo.NumberFormat.CurrencySymbol           = "$";

            this.CultureInfo.NumberFormat.NumberDecimalSeparator = ".";
            this.CultureInfo.NumberFormat.NumberGroupSeparator   = "";

            this.CultureInfo.DateTimeFormat.FullDateTimePattern = Lfx.Types.Formatting.DateTime.FullDateTimePattern;
            this.CultureInfo.DateTimeFormat.LongDatePattern     = Lfx.Types.Formatting.DateTime.LongDatePattern;
            this.CultureInfo.DateTimeFormat.ShortDatePattern    = Lfx.Types.Formatting.DateTime.ShortDatePattern;
            this.CultureInfo.DateTimeFormat.ShortTimePattern    = "HH:mm";
            this.CultureInfo.DateTimeFormat.LongTimePattern     = "HH:mm:ss";

            System.Threading.Thread.CurrentThread.CurrentCulture   = this.CultureInfo;
            System.Threading.Thread.CurrentThread.CurrentUICulture = this.CultureInfo;

            this.MetadataFactory = new Lazaro.Orm.Mapping.AnnotationMetadataFactory();
            this.MetadataFactory.ScanFolder(System.IO.Path.GetDirectoryName(this.GetType().Assembly.Location), true);
        }
示例#3
0
 public Scheduler(Workspace workspace)
 {
     Workspace = workspace;
 }
示例#4
0
 public Scheduler(Workspace workspace)
 {
         Workspace = workspace;
 }
示例#5
0
        public Workspace(string workspaceName, bool openConnection, bool webAppMode)
        {
            if (Lfx.Workspace.Master == null)
            {
                Lfx.Workspace.Master = this;
            }

            this.WebAppMode = webAppMode;
            m_Name          = workspaceName;

            this.CurrentConfig = new Lfx.Config.ConfigManager();

            if (this.WebAppMode == false)
            {
                this.DefaultScheduler = new Lfx.Services.Scheduler(this);
                this.RunTime          = new Lfx.RunTimeServices();
            }

            if (m_MasterConnection == null)
            {
                m_MasterConnection = new Lfx.Data.Connection(this, this.Name);
                m_MasterConnection.RequiresTransaction = false;
            }

            if (Lfx.Data.DataBaseCache.DefaultCache == null)
            {
                Lfx.Data.DataBaseCache.DefaultCache = new Lfx.Data.DataBaseCache(m_MasterConnection);
            }

            if (this.MasterConnection.AccessMode == Lfx.Data.AccessModes.Undefined)
            {
                switch (this.CurrentConfig.ReadLocalSettingString("Data", "ConnectionType", "mysql"))
                {
                case "odbc":
                    Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.Odbc;
                    break;

                case "myodbc":
                case "mysql":
                    Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.MySql;
                    break;

                case "npgsql":
                    Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.Npgsql;
                    break;

                case "mssql":
                    Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.MSSql;
                    break;

                case "sqlite":
                    Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.SQLite;
                    break;
                }
            }

            if (Lfx.Data.DataBaseCache.DefaultCache.ServerName == null)
            {
                Lfx.Data.DataBaseCache.DefaultCache.ServerName   = this.CurrentConfig.ReadLocalSettingString("Data", "DataSource", "localhost");
                Lfx.Data.DataBaseCache.DefaultCache.DataBaseName = this.CurrentConfig.ReadLocalSettingString("Data", "DatabaseName", "lazaro");
                Lfx.Data.DataBaseCache.DefaultCache.UserName     = this.CurrentConfig.ReadLocalSettingString("Data", "User", "lazaro");
                Lfx.Data.DataBaseCache.DefaultCache.Password     = this.CurrentConfig.ReadLocalSettingString("Data", "Password", string.Empty);
            }

            System.Text.RegularExpressions.Regex IpLocal1 = new System.Text.RegularExpressions.Regex(@"^192\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
            System.Text.RegularExpressions.Regex IpLocal2 = new System.Text.RegularExpressions.Regex(@"^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
            if (Lfx.Data.DataBaseCache.DefaultCache.ServerName.Contains(".") == false || IpLocal1.IsMatch(Lfx.Data.DataBaseCache.DefaultCache.ServerName) || IpLocal2.IsMatch(Lfx.Data.DataBaseCache.DefaultCache.ServerName))
            {
                Lfx.Data.DataBaseCache.DefaultCache.SlowLink = false;
            }
            else
            {
                Lfx.Data.DataBaseCache.DefaultCache.SlowLink = true;
            }

            if (openConnection)
            {
                m_MasterConnection.Open();
            }

            // Personalizo los valores de CultureInfo
            this.CultureInfo.NumberFormat.CurrencyDecimalSeparator = ".";
            this.CultureInfo.NumberFormat.CurrencyDecimalDigits    = 2;
            this.CultureInfo.NumberFormat.CurrencyGroupSeparator   = "";
            this.CultureInfo.NumberFormat.CurrencySymbol           = "$";

            this.CultureInfo.NumberFormat.NumberDecimalSeparator = ".";
            this.CultureInfo.NumberFormat.NumberGroupSeparator   = "";

            this.CultureInfo.DateTimeFormat.FullDateTimePattern = Lfx.Types.Formatting.DateTime.FullDateTimePattern;
            this.CultureInfo.DateTimeFormat.LongDatePattern     = Lfx.Types.Formatting.DateTime.LongDatePattern;
            this.CultureInfo.DateTimeFormat.ShortDatePattern    = Lfx.Types.Formatting.DateTime.ShortDatePattern;
            this.CultureInfo.DateTimeFormat.ShortTimePattern    = "HH:mm";
            this.CultureInfo.DateTimeFormat.LongTimePattern     = "HH:mm:ss";

            System.Threading.Thread.CurrentThread.CurrentCulture   = this.CultureInfo;
            System.Threading.Thread.CurrentThread.CurrentUICulture = this.CultureInfo;
        }
示例#6
0
 public static string CodigoPredet(Lfx.Workspace workspace)
 {
     return(CodigoPredet(workspace, null));
 }
示例#7
0
                public Workspace(string workspaceName, bool openConnection, bool webAppMode)
                {
                        if (Lfx.Workspace.Master == null)
                                Lfx.Workspace.Master = this;

                        this.WebAppMode = webAppMode;
                        m_Name = workspaceName;

                        this.CurrentConfig = new Lfx.Config.ConfigManager();

                        if (this.WebAppMode == false) {
                                this.DefaultScheduler = new Lfx.Services.Scheduler(this);
                                this.RunTime = new Lfx.RunTimeServices();
                        }

                        if (m_MasterConnection == null) {
                                m_MasterConnection = new Lfx.Data.Connection(this, this.Name);
                                m_MasterConnection.RequiresTransaction = false;
                        }

                        if (Lfx.Data.DataBaseCache.DefaultCache == null)
                                Lfx.Data.DataBaseCache.DefaultCache = new Lfx.Data.DataBaseCache(m_MasterConnection);

                        if (this.MasterConnection.AccessMode == Lfx.Data.AccessModes.Undefined) {
                                switch (this.CurrentConfig.ReadLocalSettingString("Data", "ConnectionType", "mysql")) {
                                        case "odbc":
                                                Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.Odbc;
                                                break;

                                        case "myodbc":
                                        case "mysql":
                                                Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.MySql;
                                                break;

                                        case "npgsql":
                                                Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.Npgsql;
                                                break;

                                        case "mssql":
                                                Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.MSSql;
                                                break;

                                        case "sqlite":
                                                Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.SQLite;
                                                break;
                                }
                        }

                        if (Lfx.Data.DataBaseCache.DefaultCache.ServerName == null) {
                                Lfx.Data.DataBaseCache.DefaultCache.ServerName = this.CurrentConfig.ReadLocalSettingString("Data", "DataSource", "localhost");
                                Lfx.Data.DataBaseCache.DefaultCache.DataBaseName = this.CurrentConfig.ReadLocalSettingString("Data", "DatabaseName", "lazaro");
                                Lfx.Data.DataBaseCache.DefaultCache.UserName = this.CurrentConfig.ReadLocalSettingString("Data", "User", "lazaro");
                                Lfx.Data.DataBaseCache.DefaultCache.Password = this.CurrentConfig.ReadLocalSettingString("Data", "Password", string.Empty);
                        }

                        System.Text.RegularExpressions.Regex IpLocal1 = new System.Text.RegularExpressions.Regex(@"^192\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
                        System.Text.RegularExpressions.Regex IpLocal2 = new System.Text.RegularExpressions.Regex(@"^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
                        if (Lfx.Data.DataBaseCache.DefaultCache.ServerName.Contains(".") == false || IpLocal1.IsMatch(Lfx.Data.DataBaseCache.DefaultCache.ServerName) || IpLocal2.IsMatch(Lfx.Data.DataBaseCache.DefaultCache.ServerName)) {
                                Lfx.Data.DataBaseCache.DefaultCache.SlowLink = false;
                        } else {
                                Lfx.Data.DataBaseCache.DefaultCache.SlowLink = true;
                        }

                        if (openConnection)
                                m_MasterConnection.Open();

                        // Personalizo los valores de CultureInfo
                        this.CultureInfo.NumberFormat.CurrencyDecimalSeparator = ".";
                        this.CultureInfo.NumberFormat.CurrencyDecimalDigits = 2;
                        this.CultureInfo.NumberFormat.CurrencyGroupSeparator = "";
                        this.CultureInfo.NumberFormat.CurrencySymbol = "$";

                        this.CultureInfo.NumberFormat.NumberDecimalSeparator = ".";
                        this.CultureInfo.NumberFormat.NumberGroupSeparator = "";

                        this.CultureInfo.DateTimeFormat.FullDateTimePattern = Lfx.Types.Formatting.DateTime.FullDateTimePattern;
                        this.CultureInfo.DateTimeFormat.LongDatePattern = Lfx.Types.Formatting.DateTime.LongDatePattern;
                        this.CultureInfo.DateTimeFormat.ShortDatePattern = Lfx.Types.Formatting.DateTime.ShortDatePattern;
                        this.CultureInfo.DateTimeFormat.ShortTimePattern = "HH:mm";
                        this.CultureInfo.DateTimeFormat.LongTimePattern = "HH:mm:ss";

                        System.Threading.Thread.CurrentThread.CurrentCulture = this.CultureInfo;
                        System.Threading.Thread.CurrentThread.CurrentUICulture = this.CultureInfo;
                }