Example #1
0
        public Node[] Render <T>(IEnumerable <T> items, RenderItemWithKey <T> render)
        {
            var toRender = new List <Node>();

            int itemIdx = 0;

            foreach (var item in items)
            {
                var(key, rendered) = render(item, itemIdx);
                rendered.Name      = obj.name + $"({key})";
                toRender.Add(rendered);
                itemIdx++;

                if (!keys.Contains(key))
                {
                    var go = Instantiate(obj, wrapper);
                    go.SetActive(true);
                    go.name = obj.name + $"({key})";
                    keys.Add(key);
                }
            }

            return(new Node[] {
                toRender.Count > 0 ? DSL.Draw(wrapper.name, toRender.ToArray()) : DSL.Draw(wrapper.name)
            });
        }
Example #2
0
        public List <Dictionary <string, object> > getEquipments(HttpRequestMessage req)
        {
            var postedString = req.Content.ReadAsStringAsync().Result;
            //JArray v = JArray.Parse(postedString);
            dynamic d     = JObject.Parse(Convert.ToString(postedString));
            string  jobId = Convert.ToString(d.jobId);

            obj = new DSL();
            DataTable dt;

            dt = obj.getEquipments(jobId);
            JavaScriptSerializer serializer          = new JavaScriptSerializer();
            List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();
            Dictionary <string, object>         row;

            foreach (DataRow dr in dt.Rows)
            {
                row = new Dictionary <string, object>();
                foreach (DataColumn col in dt.Columns)
                {
                    row.Add(col.ColumnName, dr[col]);
                }
                rows.Add(row);
            }

            return(rows);
        }
Example #3
0
        public List <Cita> BusCita(string Fec)
        {
            Paciente    p  = new Paciente();
            List <Cita> LP = new List <Cita>();
            Cita        P  = new Cita();

            dsl = new DSL();
            try
            {
                P = new Cita();
                dsl.Open(Con, Proveedor.SQLServer);
                dsl.InitialSQLStatement("SELECT * FROM dbo.ConsCitFec('" + Fec + "');", CommandType.Text);
                DataTable Dt = dsl.ReturnTable();
                for (int i = 0; i < Dt.Rows.Count; i++)
                {
                    P           = new Cita();
                    P.FechaHora = Dt.Rows[i]["FechaHora"].ToString();
                    P.Nombre    = Dt.Rows[i]["Nombre"].ToString();

                    LP.Add(P);
                }
                //dsl.Close();
                return(LP);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                dsl = null;
            }
        }
Example #4
0
        public string Upload()
        {
            string status = "";

            if (HttpContext.Current.Request.Files.AllKeys.Any())
            {
                // Get the uploaded image from the Files collection
                var    httpPostedFile = HttpContext.Current.Request.Files["file"];
                string keyID          = HttpContext.Current.Request.Form["KeyID"];
                string UploadedBy     = HttpContext.Current.Request.Form["UploadedBy"];
                UploadedBy = UploadedBy.Trim('"');
                string Description      = HttpContext.Current.Request.Form["Description"];
                string rootpath         = ConfigurationManager.AppSettings["ViewpointUploadRootPath"];
                string uploadPath       = ConfigurationManager.AppSettings["UploadPath"];
                string completepath     = @rootpath + uploadPath;
                string upload_directory = DateTime.Now.Month.ToString("00") + "-" + DateTime.Now.Year.ToString();
                CreateIfMissing(completepath + upload_directory);

                if (httpPostedFile != null)
                {
                    // Get the complete file path
                    String fileSavePath = @completepath + upload_directory + @"\" + httpPostedFile.FileName.ToString();

                    // Save the uploaded file to "UploadedFiles" folder
                    httpPostedFile.SaveAs(fileSavePath);
                    DSL obj = new DSL();
                    status = obj.insertAttachmentViewpoint(keyID, "From Transit: " + Description, completepath + upload_directory + "\\" + httpPostedFile.FileName.ToString(), httpPostedFile.FileName.ToString(), UploadedBy);
                }
            }
            return(status);
        }
Example #5
0
        public int CheckUser(Usuario U)
        {
            // DSL dsl = new DSL();
            int IDT = 0;

            //Usuario Us = new Usuario();
            dsl = new DSL();
            DataTable Dt = new DataTable();

            try
            {
                dsl.Open(Con, Proveedor.SQLServer);
                dsl.InitialSQLStatement("dbo.CheckUser", CommandType.StoredProcedure);
                dsl.SetParameterProcedure("Id", ParameterDirection.Output, eTypes.Entero, null);
                dsl.SetParameterProcedure("NombreU", ParameterDirection.Input, eTypes.Cadena, U.NombreUsuario);
                dsl.SetParameterProcedure("Password", ParameterDirection.Input, eTypes.Cadena, U.CodigoAcceso);
                IDT = int.Parse(dsl.ExecuteStoredOutPut().ToString());
                dsl.Close();
                return(IDT);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                dsl = null;
            }
        }
 public void AddCons(Consulta C, int IDCH)
 {
     try
     {
         dsl = new DSL();
         dsl.Open("DATA SOURCE = DESKTOP - 3AQGIM6\\SQLEXPRESS; INITIAL CATALOG = PROYECTOINTEGRADOR; user = sa; password =#m1m2m3m4m5", Proveedor.SQLServer);
         dsl.InitialSQLStatement("dbo.usp_AddCons", CommandType.StoredProcedure);
         dsl.SetParameterProcedure("@IdPac", ParameterDirection.Input, eTypes.Entero, IDCH);
         dsl.SetParameterProcedure("@Peso", ParameterDirection.Input, eTypes.Entero, C.Peso);
         dsl.SetParameterProcedure("@Altura", ParameterDirection.Input, eTypes.Entero, C.Altura);
         dsl.SetParameterProcedure("@Presion", ParameterDirection.Input, eTypes.Cadena, C.PresionArt);
         dsl.SetParameterProcedure("@Motivo", ParameterDirection.Input, eTypes.Cadena, C.Motivo);
         dsl.SetParameterProcedure("@Antecedentes", ParameterDirection.Input, eTypes.Cadena, C.Antecedentes);
         dsl.SetParameterProcedure("@Diagnostico", ParameterDirection.Input, eTypes.Cadena, C.Diagnostico);
         dsl.SetParameterProcedure("@Receta", ParameterDirection.Input, eTypes.Cadena, C.Receta);
         dsl.ExecuteNonQuery();
         dsl.Close();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
     finally
     {
         dsl = null;
     }
 }
Example #7
0
 public int AddLab(Modelos.Laboratorio L)
 {
     try
     {
         dsl = new DSL();
         int IDL;
         dsl.Open("DATA SOURCE = JARVIS; INITIAL CATALOG = PROYECTOINTEGRADOR; INTEGRATED SECURITY = YES", Proveedor.SQLServer);
         dsl.InitialSQLStatement("dbo.usp_AddLab", CommandType.StoredProcedure);
         dsl.SetParameterProcedure("@Nombre", ParameterDirection.Input, eTypes.Cadena, L.Nombre);
         dsl.SetParameterProcedure("@Director", ParameterDirection.Input, eTypes.Cadena, L.Director);
         dsl.SetParameterProcedure("@Telefono", ParameterDirection.Input, eTypes.Cadena, L.Telefono);
         dsl.SetParameterProcedure("@Calle", ParameterDirection.Input, eTypes.Cadena, L.Calle);
         dsl.SetParameterProcedure("@Colonia", ParameterDirection.Input, eTypes.Cadena, L.Colonia);
         dsl.SetParameterProcedure("@Municipio", ParameterDirection.Input, eTypes.Cadena, L.Municipio);
         dsl.SetParameterProcedure("@Estado", ParameterDirection.Input, eTypes.Cadena, L.Estado);
         dsl.SetParameterProcedure("@Id", ParameterDirection.Output, eTypes.Entero, null);
         IDL = int.Parse(dsl.ExecuteStoredOutPut().ToString());
         dsl.Close();
         return(IDL);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
     finally
     {
         dsl = null;
     }
 }
Example #8
0
    public long LoginXML(Credenciales cre)
    {
        DSL _connection = new DSL();
        try
        {
            _connection.Open(ConfigurationManager.ConnectionStrings["dbLogin"].ToString(), RNConnection.DataAbstractionLayer.eProvider.SQLServer);
            _connection.InitialSQLStatement("dbo.fe_Autenticarse_xml", System.Data.CommandType.StoredProcedure);
            _connection.SetParameterProcedure("@nick", System.Data.ParameterDirection.Input, RNConnection.DataAbstractionLayer.eTypes.Cadena, cre.Nick);
            _connection.SetParameterProcedure("@pwd", System.Data.ParameterDirection.Input, RNConnection.DataAbstractionLayer.eTypes.Cadena, cre.Password);
            _connection.SetParameterProcedure("@ResultadoXML", System.Data.ParameterDirection.ReturnValue, RNConnection.DataAbstractionLayer.eTypes.XML, null);

            long IdCredencial = 0;
            XmlReader xmlr = _connection.ExecuteXMLReader();
            XDocument XDocEsquema = XDocument.Load(xmlr);
            var Cursor = from valor in XDocEsquema.Descendants("Personas")
                         select valor;
            foreach (var item in Cursor)
            {
                IdCredencial = long.Parse(item.Element("Credencial").Value.ToString());
                break;
            }
            return IdCredencial;
        }
        catch (Exception ex)
        {
            throw new Exception("Error: " + ex.Message, ex);
        }
    }
Example #9
0
 public void ModLab(Modelos.Laboratorio L)
 {
     try
     {
         dsl = new DSL();
         dsl.Open("DATA SOURCE = DESKTOP-3AQGIM6\\SQLEXPRESS; INITIAL CATALOG = PROYECTOINTEGRADOR; user=sa; password=#m1m2m3m4m5", Proveedor.SQLServer);
         dsl.InitialSQLStatement("dbo.usp_ModLab", CommandType.StoredProcedure);
         dsl.SetParameterProcedure("@Id", ParameterDirection.Input, eTypes.Entero, L.IdLab);
         dsl.SetParameterProcedure("@Nombre", ParameterDirection.Input, eTypes.Cadena, L.Nombre);
         dsl.SetParameterProcedure("@Director", ParameterDirection.Input, eTypes.Cadena, L.Director);
         dsl.SetParameterProcedure("@Telefono", ParameterDirection.Input, eTypes.Cadena, L.Telefono);
         dsl.SetParameterProcedure("@Calle", ParameterDirection.Input, eTypes.Cadena, L.Calle);
         dsl.SetParameterProcedure("@Colonia", ParameterDirection.Input, eTypes.Cadena, L.Colonia);
         dsl.SetParameterProcedure("@Municipio", ParameterDirection.Input, eTypes.Cadena, L.Municipio);
         dsl.SetParameterProcedure("@Estado", ParameterDirection.Input, eTypes.Cadena, L.Estado);
         dsl.ExecuteNonQuery();
         dsl.Close();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
     finally
     {
         dsl = null;
     }
 }
Example #10
0
        //update Batch status
        public string updateBatch(HttpRequestMessage req)
        {
            var    postedString = req.Content.ReadAsStringAsync().Result;
            JArray v            = JArray.Parse(postedString);
            //dynamic d = JObject.Parse(Convert.ToString(postedString));
            string jobId   = Convert.ToString(v[0]["jobId"]);
            string message = Convert.ToString(v[0]["message"]);

            obj = new DSL();
            string status = obj.updateBatchStatus(jobId, message);

            return(status);
        }
Example #11
0
        public List <Paciente> BusIdPac(Paciente PP)
        {
            List <Paciente> LP = new List <Paciente>();
            Paciente        P  = new Paciente();

            dsl = new DSL();
            try
            {
                P = new Paciente();
                dsl.Open(Con, Proveedor.SQLServer);
                dsl.InitialSQLStatement("SELECT * FROM dbo.ConsIdPac(" + PP.IdPersona + ");", CommandType.Text);
                DataTable Dt = dsl.ReturnTable();
                for (int i = 0; i < Dt.Rows.Count; i++)
                {
                    P = new Paciente();

                    P.Nombre          = Dt.Rows[i]["Nombre"].ToString();
                    P.ApePaterno      = Dt.Rows[i]["ApePat"].ToString();
                    P.ApeMaterno      = Dt.Rows[i]["ApeMat"].ToString();
                    P.Edad            = int.Parse(Dt.Rows[i]["Edad"].ToString());
                    P.Sexo            = Dt.Rows[i]["Sexo"].ToString();
                    P.FechaNacimiento = Dt.Rows[i]["FechaNac"].ToString();
                    P.EstadoCivil     = Dt.Rows[i]["EstadoCivil"].ToString();
                    P.RFC             = Dt.Rows[i]["RFC"].ToString();
                    P.CURP            = Dt.Rows[i]["CURP"].ToString();
                    P.Ocupacion       = Dt.Rows[i]["Ocupacion"].ToString();
                    P.NumeroCasa      = Dt.Rows[i]["NumeroCasa"].ToString();
                    P.Calle           = Dt.Rows[i]["Calle"].ToString();
                    P.Colonia         = Dt.Rows[i]["Colonia"].ToString();
                    P.Estado          = Dt.Rows[i]["Estado"].ToString();
                    P.Municipio       = Dt.Rows[i]["Municipio"].ToString();
                    P.TelCasa         = Dt.Rows[i]["TelefonoCasa"].ToString();
                    P.TelMovil        = Dt.Rows[i]["TelefonoMovil"].ToString();
                    LP.Add(P);
                }
                //dsl.Close();
                return(LP);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                dsl = null;
            }
        }
Example #12
0
        public string updatePhysicalDateViewpoint(HttpRequestMessage req)
        {
            var     postedString = req.Content.ReadAsStringAsync().Result;
            dynamic v            = JArray.Parse(postedString);
            //dynamic d = JObject.Parse(Convert.ToString(postedString));
            //dynamic d = JObject.Parse(Convert.ToString(postedString));
            //string month = Convert.ToDateTime(d.month);
            JArray toCsv   = new JArray();
            JArray pushJob = new JArray();

            foreach (var equipment in v)
            {
                JObject item        = new JObject();
                JObject itemPushJob = new JObject();



                // for pushing into Transit Database
                itemPushJob.Add(new JProperty("EquipmentID", Convert.ToString(equipment.EquipmentID)));
                itemPushJob.Add(new JProperty("SerialNo", equipment.SerialNo));
                itemPushJob.Add(new JProperty("Description", Convert.ToString(equipment.Description)));


                itemPushJob.Add(new JProperty("PhysicalDate", Convert.ToString(equipment.PhysicalDate)));


                pushJob.Add(itemPushJob);
            }
            obj = new DSL();
            try
            {
                int ViewpointDbUpdate = obj.updateEquipmentPhysicaDateViewpoint(pushJob);
                if (ViewpointDbUpdate == 1)
                {
                    return("Success");
                }
                else
                {
                    return("failed");
                }
            }
            catch (Exception ex)
            {
                return("failed");
            }
        }
Example #13
0
    public long Login(Credenciales cre)
    {
        DSL _connection = new DSL();
        try
        {
            _connection.Open(ConfigurationManager.ConnectionStrings["dbLogin"].ToString(), RNConnection.DataAbstractionLayer.eProvider.SQLServer);
            _connection.InitialSQLStatement("dbo.Autenticarse", System.Data.CommandType.StoredProcedure);
            _connection.SetParameterProcedure("@nick", System.Data.ParameterDirection.Input, RNConnection.DataAbstractionLayer.eTypes.Cadena, cre.Nick);
            _connection.SetParameterProcedure("@pwd", System.Data.ParameterDirection.Input, RNConnection.DataAbstractionLayer.eTypes.Cadena, cre.Password);

            long IdCredencial = long.Parse(_connection.ReturnObject().ToString());
            return IdCredencial;
        }
        catch (Exception ex)
        {
            throw new Exception("Error: " + ex.Message, ex);
        }
    }
Example #14
0
    public long LoginOUTPUT(Credenciales cre)
    {
        DSL _connection = new DSL();
        try
        {
            _connection.Open(ConfigurationManager.ConnectionStrings["dbLogin"].ToString(), RNConnection.DataAbstractionLayer.eProvider.SQLServer);
            _connection.InitialSQLStatement("dbo.Autenticarse_out", System.Data.CommandType.StoredProcedure);
            _connection.SetParameterProcedure("@nick", System.Data.ParameterDirection.Input, RNConnection.DataAbstractionLayer.eTypes.Cadena, cre.Nick);
            _connection.SetParameterProcedure("@pwd", System.Data.ParameterDirection.Input, RNConnection.DataAbstractionLayer.eTypes.Cadena, cre.Password);
            _connection.SetParameterProcedure("@Credencial", System.Data.ParameterDirection.Output, RNConnection.DataAbstractionLayer.eTypes.Entero, null);

            long IdCredencial = long.Parse(_connection.ExecuteStroedOutPut().ToString());
            return IdCredencial;
        }
        catch (Exception ex)
        {
            return 0;
        }
    }
Example #15
0
 public void DelPac(int IDP)
 {
     try
     {
         dsl = new DSL();
         dsl.Open(Con, Proveedor.SQLServer);
         dsl.InitialSQLStatement("dbo.usp_DelPac", CommandType.StoredProcedure);
         dsl.SetParameterProcedure("@Id", ParameterDirection.Input, eTypes.Entero, IDP);
         dsl.ExecuteNonQuery();
         dsl.Close();
     }
     catch (Exception e)
     {
         throw new Exception();
     }
     finally
     {
         dsl = null;
     }
 }
Example #16
0
 public void DelCita(int IDC)
 {
     try
     {
         dsl = new DSL();
         dsl.Open("DATA SOURCE = JARVIS; INITIAL CATALOG = PROYECTOINTEGRADOR; INTEGRATED SECURITY = YES", Proveedor.SQLServer);
         dsl.InitialSQLStatement("dbo.usp_DelCita", CommandType.StoredProcedure);
         dsl.SetParameterProcedure("@Id", ParameterDirection.Input, eTypes.Entero, IDC);
         dsl.ExecuteNonQuery();
         dsl.Close();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
     finally
     {
         dsl = null;
     }
 }
Example #17
0
 public void DelLab(int IDL)
 {
     try
     {
         dsl = new DSL();
         dsl.Open("DATA SOURCE = DESKTOP-3AQGIM6\\SQLEXPRESS; INITIAL CATALOG = PROYECTOINTEGRADOR; user=sa; password=#m1m2m3m4m5", Proveedor.SQLServer);
         dsl.InitialSQLStatement("dbo.usp_DelLab", CommandType.StoredProcedure);
         dsl.SetParameterProcedure("@Id", ParameterDirection.Input, eTypes.Entero, IDL);
         dsl.ExecuteNonQuery();
         dsl.Close();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
     finally
     {
         dsl = null;
     }
 }
Example #18
0
    public int CompAuth(long obtainedCred)
    {
        DSL _connection = new DSL();

        try
        {
            _connection.Open(ConfigurationManager.ConnectionStrings["dbLogin"].ToString(), RnConection.DataAbstractionLayer.Provedor.SQLServer);
            _connection.InitialSQLStatement("ComprobarNivel", System.Data.CommandType.StoredProcedure);
            _connection.SetParameterProcedure("@id", System.Data.ParameterDirection.Input, RnConection.DataAbstractionLayer.eTypes.Entero, obtainedCred);
            int NivelAuth = int.Parse(_connection.ReturnObject().ToString());
            return(NivelAuth);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message, ex);
        }
        finally
        {
            _connection.Close();
        }
    }
Example #19
0
        public string disconnectSession(HttpRequestMessage req)
        {
            var     postedString = req.Content.ReadAsStringAsync().Result;
            dynamic d            = JObject.Parse(Convert.ToString(postedString));
            //JArray v = JArray.Parse(postedString);
            //dynamic d = JObject.Parse(Convert.ToString(postedString));
            string sessionId = Convert.ToString(d.SessionId);
            string message   = Convert.ToString(d.message);

            obj = new DSL();
            int logoutStatus = obj.updateSession(sessionId, message);

            if (logoutStatus > 0)
            {
                return("success");
            }
            else
            {
                return("failed");
            }
        }
Example #20
0
    public long Login(Username users)
    {
        DSL _connection = new DSL();

        try
        {
            _connection.Open(ConfigurationManager.ConnectionStrings["dbLogin"].ToString(), RnConection.DataAbstractionLayer.Provedor.SQLServer);
            _connection.InitialSQLStatement("Autenticarse", System.Data.CommandType.StoredProcedure);
            _connection.SetParameterProcedure("@nick", System.Data.ParameterDirection.Input, RnConection.DataAbstractionLayer.eTypes.Cadena, users.user);
            _connection.SetParameterProcedure("@pwd", System.Data.ParameterDirection.Input, RnConection.DataAbstractionLayer.eTypes.Cadena, users.password);
            long IdCredencial = long.Parse(_connection.ReturnObject().ToString());
            return(IdCredencial);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message, ex);
        }
        finally
        {
            _connection.Close();
        }
    }
Example #21
0
        public List <Dictionary <string, object> > getInProgressBatchIDs()
        {
            obj = new DSL();
            DataTable dt;

            dt = obj.getScheduledBatches();
            JavaScriptSerializer serializer          = new JavaScriptSerializer();
            List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();
            Dictionary <string, object>         row;

            foreach (DataRow dr in dt.Rows)
            {
                row = new Dictionary <string, object>();
                foreach (DataColumn col in dt.Columns)
                {
                    row.Add(col.ColumnName, dr[col]);
                }
                rows.Add(row);
            }

            return(rows);
        }
Example #22
0
 public void AddEL(int IDP, int IDL, EstudioLab EL)
 {
     try
     {
         dsl = new DSL();
         dsl.Open("DATA SOURCE = JARVIS; INITIAL CATALOG = PROYECTOINTEGRADOR; INTEGRATED SECURITY = YES", Proveedor.SQLServer);
         dsl.InitialSQLStatement("dbo.usp_AddEL", CommandType.StoredProcedure);
         dsl.SetParameterProcedure("@Idp", ParameterDirection.Input, eTypes.Entero, IDP);
         dsl.SetParameterProcedure("@Idl", ParameterDirection.Input, eTypes.Entero, IDL);
         dsl.SetParameterProcedure("@Motivo", ParameterDirection.Input, eTypes.Cadena, EL.Motivo);
         dsl.ExecuteNonQuery();
         dsl.Close();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
     finally
     {
         dsl = null;
     }
 }
Example #23
0
        public static IServiceProvider Configure(DSL.Core.Container container, Database database, string connectionString, bool withAspects, bool externalConfiguration)
        {
            var dllPlugins = externalConfiguration == false ? new string[0] :
                (from key in ConfigurationManager.AppSettings.AllKeys
                 where key.StartsWith("PluginsPath", StringComparison.OrdinalIgnoreCase)
                 let path = ConfigurationManager.AppSettings[key]
                 let pathRelative = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path)
                 let chosenPath = Directory.Exists(pathRelative) ? pathRelative : path
                 select chosenPath)
                .ToArray();
            var assemblies =
                from asm in Revenj.Utility.AssemblyScanner.GetAssemblies()
                where asm.FullName.StartsWith("Revenj.")
                select asm;
            var state = new SystemState();
            var builder = container == DSL.Core.Container.Autofac
                ? Revenj.Extensibility.Setup.UseAutofac(assemblies, dllPlugins, externalConfiguration, false, withAspects)
                : Revenj.Extensibility.Setup.UseDryIoc(assemblies, dllPlugins, false);
            builder.RegisterSingleton<ISystemState>(state);
            if (database == Core.Database.Postgres)
                SetupPostgres(builder, connectionString);
            else
                SetupOracle(builder, connectionString);
            var serverModels =
                (from asm in Revenj.Utility.AssemblyScanner.GetAssemblies()
                 let type = asm.GetType("SystemBoot.Configuration")
                 where type != null && type.GetMethod("Initialize") != null
                 select asm)
                .ToList();
            builder.ConfigurePatterns(_ => serverModels);
            builder.ConfigureSerialization();
            builder.ConfigureSecurity(false);

            var factory = builder.Build();
            factory.Resolve<IDomainModel>();//TODO: explicit model initialization
            state.IsBooting = false;
            state.Started(factory);
            return factory;
        }
Example #24
0
        public List <Dictionary <string, object> > getLocations()
        {
            obj = new DSL();
            DataTable dt;

            dt = obj.getAllLocations();
            JavaScriptSerializer serializer          = new JavaScriptSerializer();
            List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();
            Dictionary <string, object>         row;

            foreach (DataRow dr in dt.Rows)
            {
                row = new Dictionary <string, object>();
                foreach (DataColumn col in dt.Columns)
                {
                    row.Add(col.ColumnName, dr[col]);
                }
                rows.Add(row);
            }
            locationList = rows;
            return(rows);
        }
Example #25
0
 public void ModPac(Paciente P)
 {
     try
     {
         dsl = new DSL();
         dsl.Open(Con, Proveedor.SQLServer);
         dsl.InitialSQLStatement("dbo.usp_ModPac", CommandType.StoredProcedure);
         dsl.SetParameterProcedure("@Nombre", ParameterDirection.Input, eTypes.Cadena, P.Nombre);
         dsl.SetParameterProcedure("@ApePat", ParameterDirection.Input, eTypes.Cadena, P.ApePaterno);
         dsl.SetParameterProcedure("@ApeMat", ParameterDirection.Input, eTypes.Cadena, P.ApeMaterno);
         dsl.SetParameterProcedure("@Edad", ParameterDirection.Input, eTypes.Cadena, P.Edad);
         dsl.SetParameterProcedure("@Sexo", ParameterDirection.Input, eTypes.Cadena, P.Sexo);
         dsl.SetParameterProcedure("@FechaNac", ParameterDirection.Input, eTypes.Cadena, P.FechaNacimiento);
         dsl.SetParameterProcedure("@EstadoCivil", ParameterDirection.Input, eTypes.Cadena, P.EstadoCivil);
         dsl.SetParameterProcedure("@RFC", ParameterDirection.Input, eTypes.Cadena, P.RFC);
         dsl.SetParameterProcedure("@CURP", ParameterDirection.Input, eTypes.Cadena, P.CURP);
         dsl.SetParameterProcedure("@Email", ParameterDirection.Input, eTypes.Cadena, P.Email);
         dsl.SetParameterProcedure("@Ocupacion", ParameterDirection.Input, eTypes.Cadena, P.Ocupacion);
         dsl.SetParameterProcedure("@TelefonoMovil", ParameterDirection.Input, eTypes.Cadena, P.TelMovil);
         dsl.SetParameterProcedure("@TelefonoCasa", ParameterDirection.Input, eTypes.Cadena, P.TelCasa);
         dsl.SetParameterProcedure("@Calle", ParameterDirection.Input, eTypes.Cadena, P.Calle);
         dsl.SetParameterProcedure("@Colonia", ParameterDirection.Input, eTypes.Cadena, P.Colonia);
         dsl.SetParameterProcedure("@Estado", ParameterDirection.Input, eTypes.Cadena, P.Estado);
         dsl.SetParameterProcedure("@Municipio", ParameterDirection.Input, eTypes.Cadena, P.Municipio);
         dsl.SetParameterProcedure("@Num", ParameterDirection.Input, eTypes.Cadena, P.NumeroCasa);
         dsl.SetParameterProcedure("@IdPe", ParameterDirection.Input, eTypes.Entero, P.IdPersona);
         dsl.ExecuteNonQuery();
         dsl.Close();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
     finally
     {
         dsl = null;
     }
 }
Example #26
0
 public void AddHC(Paciente P, Consulta HC)
 {
     try
     {
         dsl = new DSL();
         dsl.Open("DATA SOURCE = JARVIS; INITIAL CATALOG = PROYECTOINTEGRADOR; INTEGRATED SECURITY = YES", Proveedor.SQLServer);
         dsl.InitialSQLStatement("dbo.usp_AddHC", CommandType.StoredProcedure);
         dsl.SetParameterProcedure("@Id", ParameterDirection.Input, eTypes.Entero, P.IdPaciente);
         dsl.SetParameterProcedure("@Peso", ParameterDirection.Input, eTypes.Entero, HC.Peso);
         dsl.SetParameterProcedure("@Altura", ParameterDirection.Input, eTypes.Entero, HC.Altura);
         dsl.SetParameterProcedure("@Presion", ParameterDirection.Input, eTypes.Entero, HC.PresionArt);
         dsl.ExecuteNonQuery();
         dsl.Close();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
     finally
     {
         dsl = null;
     }
 }
Example #27
0
        public List <Laboratorio> BusLab()
        {
            List <Laboratorio> LP = new List <Laboratorio>();
            Laboratorio        P  = new Laboratorio();

            dsl = new DSL();
            try
            {
                P = new Laboratorio();
                dsl.Open(Con, Proveedor.SQLServer);
                dsl.InitialSQLStatement("SELECT * FROM dbo.ConsAllLab();", CommandType.Text);
                DataTable Dt = dsl.ReturnTable();
                for (int i = 0; i < Dt.Rows.Count; i++)
                {
                    P           = new Laboratorio();
                    P.IdLab     = int.Parse(Dt.Rows[i]["IdLab"].ToString());
                    P.Nombre    = Dt.Rows[i]["Nombre"].ToString();
                    P.Director  = Dt.Rows[i]["Director"].ToString();
                    P.Telefono  = Dt.Rows[i]["Telefono"].ToString();
                    P.Calle     = Dt.Rows[i]["Calle"].ToString();
                    P.Colonia   = Dt.Rows[i]["Colonia"].ToString();
                    P.Municipio = Dt.Rows[i]["Municipio"].ToString();
                    P.Estado    = Dt.Rows[i]["Estado"].ToString();
                    LP.Add(P);
                }
                //dsl.Close();
                return(LP);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                dsl = null;
            }
        }
Example #28
0
 public void AddServ(List <ItemServLab> LS, int idl)
 {
     try
     {
         foreach (ItemServLab SL in LS)
         {
             dsl = new DSL();
             dsl.Open("DATA SOURCE = DESKTOP-DMUTBHE; INITIAL CATALOG = PROYECTOINTEGRADOR; INTEGRATED SECURITY = YES", Proveedor.SQLServer);
             dsl.InitialSQLStatement("dbo.usp_AddServs", CommandType.StoredProcedure);
             dsl.SetParameterProcedure("@IdLab", ParameterDirection.Input, eTypes.Entero, idl);
             dsl.SetParameterProcedure("@Serv", ParameterDirection.Input, eTypes.Cadena, SL.Servicio);
             dsl.ExecuteNonQuery();
             dsl.Close();
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
     finally
     {
         dsl = null;
     }
 }
Example #29
0
        public string TransferBatch(HttpRequestMessage req)
        {
            var     postedString = req.Content.ReadAsStringAsync().Result;
            dynamic v            = JArray.Parse(postedString);
            //dynamic d = JObject.Parse(Convert.ToString(postedString));
            //string month = Convert.ToDateTime(d.month);
            JArray toCsv   = new JArray();
            JArray pushJob = new JArray();

            foreach (var equipment in v)
            {
                JObject item        = new JObject();
                JObject itemPushJob = new JObject();

                string   indate      = equipment.jobDate;
                string[] dateinarray = indate.Split(' ');

                // for pushing into Transit Database
                itemPushJob.Add(new JProperty("SerialNo", equipment.SerialNo));
                itemPushJob.Add(new JProperty("EquipmentID", Convert.ToString(equipment.Equipment)));
                itemPushJob.Add(new JProperty("EquipmentDescription", Convert.ToString(equipment.EquipmentDescription)));
                if (equipment.ToJob == "")
                {
                    itemPushJob.Add(new JProperty("TransferLocID", equipment.ToLocation));
                }
                else if (equipment.ToLocation == "")
                {
                    itemPushJob.Add(new JProperty("TransferLocID", equipment.ToJob));
                }

                itemPushJob.Add(new JProperty("TransferLocName", equipment.TransferLocDescription));
                itemPushJob.Add(new JProperty("jobDate", equipment.jobDate));
                itemPushJob.Add(new JProperty("CreatedBY", equipment.CreatedBy));
                itemPushJob.Add(new JProperty("CreatedTime", DateTime.Now.ToString()));
                itemPushJob.Add(new JProperty("PhysicalDate", DateTime.Now.ToShortDateString()));
                pushJob.Add(itemPushJob);
            }
            obj = new DSL();
            try
            {
                //string updateStatus= obj.UpdatevEMLocationHistory(JArray.Parse(postedString));
                string updateStatus = obj.UpdatevEMLocationHistoryV2(JArray.Parse(postedString));

                if (updateStatus == "1")
                {
                    int TransitDBUpdate = obj.SchdeuleJob(pushJob);
                    if (TransitDBUpdate == 1)
                    {
                        int phyisycalDateUpdate = obj.updateEquipmentPhysicaDateViewpoint(pushJob);
                        if (phyisycalDateUpdate == 1)
                        {
                            return("Success");
                        }
                        else
                        {
                            return("Date_update_failed");
                        }
                    }

                    else
                    {
                        return("failed");
                    }
                }
                else if (updateStatus == "-1")
                {
                    return("failed");
                }
                else
                {
                    //return faulty equipment status in batch
                    return(updateStatus);
                }
            }
            catch (Exception ex)
            {
                return("failed");
            }
        }
Example #30
0
        public string ScheduleBatch(HttpRequestMessage req)
        {
            var     postedString = req.Content.ReadAsStringAsync().Result;
            dynamic v            = JArray.Parse(postedString);
            //dynamic d = JObject.Parse(Convert.ToString(postedString));
            //string month = Convert.ToDateTime(d.month);
            JArray toCsv   = new JArray();
            JArray pushJob = new JArray();

            foreach (var equipment in v)
            {
                JObject item        = new JObject();
                JObject itemPushJob = new JObject();
                //for converting it to CSV
                item.Add(new JProperty("Mth", DateTime.Today.ToString("MM/dd/yyyy")));
                item.Add(new JProperty("Equipment", Convert.ToString(equipment.Equipment)));
                item.Add(new JProperty("ToJob", equipment.ToJob));
                item.Add(new JProperty("ToLocation", equipment.ToLocation));
                string   indate      = equipment.jobDate;
                string[] dateinarray = indate.Split(' ');
                item.Add(new JProperty("DateIn", DateTime.Today.ToString(dateinarray[0])));
                item.Add(new JProperty("TimeIn", DateTime.Now.ToString(dateinarray[1])));
                toCsv.Add(item);
                // for pushing into Transit Database
                itemPushJob.Add(new JProperty("SerialNo", equipment.SerialNo));
                itemPushJob.Add(new JProperty("EquipmentID", Convert.ToString(equipment.Equipment)));
                itemPushJob.Add(new JProperty("EquipmentDescription", Convert.ToString(equipment.EquipmentDescription)));
                if (equipment.ToJob == "")
                {
                    itemPushJob.Add(new JProperty("TransferLocID", equipment.ToLocation));
                }
                else if (equipment.ToLocation == "")
                {
                    itemPushJob.Add(new JProperty("TransferLocID", equipment.ToJob));
                }

                itemPushJob.Add(new JProperty("TransferLocName", equipment.TransferLocDescription));
                itemPushJob.Add(new JProperty("jobDate", equipment.jobDate));
                itemPushJob.Add(new JProperty("CreatedBY", equipment.CreatedBy));
                itemPushJob.Add(new JProperty("CreatedTime", DateTime.Now.ToString()));
                pushJob.Add(itemPushJob);
            }
            Console.WriteLine(toCsv);
            obj = new DSL();
            try
            {
                string csv = obj.convertToCSV(toCsv);

                int    fcount   = Directory.GetFiles("\\\\DEV-VPOIN\\Viewpoint_EMAutoImport", "*.*", SearchOption.TopDirectoryOnly).Length;
                string date     = DateTime.Now.ToString().Replace(':', '_').Replace('/', '-');
                string filename = (fcount + 1) + "_" + date;
                File.WriteAllText("\\\\DEV-VPOIN\\Viewpoint_EMAutoImport\\Job_" + filename + ".csv", csv);
                int i = obj.SchdeuleJob(pushJob);
                if (i == 1)
                {
                    return("Success");
                }
                else
                {
                    return("faliure");
                }
            }
            catch (Exception ex)
            {
                return("failed");
            }
        }
Example #31
0
 public Cursor <R> fetchLazy <R>(Table <R> table) where R : class, Record
 {
     return(fetchLazy(table, DSL.noCondition()));
 }
Example #32
0
        public List <Dictionary <string, object> > validateUser(HttpRequestMessage req)
        {
            var    postedString  = req.Content.ReadAsStringAsync().Result;
            string base64Encoded = postedString;
            string base64Decoded;

            byte[] data = System.Convert.FromBase64String(base64Encoded);
            base64Decoded = System.Text.ASCIIEncoding.ASCII.GetString(data);
            dynamic d = JObject.Parse(Convert.ToString(base64Decoded));

            string username = Convert.ToString(d.username);
            string pwd      = Convert.ToString(d.password);
            List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();
            Dictionary <string, object>         row;

            row = new Dictionary <string, object>();
            obj = new DSL();
            using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "IEA"))
            {
                bool isValid = pc.ValidateCredentials(username, pwd, ContextOptions.Negotiate);
                if (isValid)
                {
                    using (UserPrincipal user = UserPrincipal.FindByIdentity(pc, username))
                    {
                        if (user != null)
                        {
                            //string employeeID = user.EmployeeId;
                            int get_session_id = obj.getSessionID(user.SamAccountName);
                            if (get_session_id > 0)
                            {
                                string Name = user.DisplayName;
                                row.Add("UserName", username);
                                row.Add("Name", Name);
                                row.Add("UserValidated", "true");
                                row.Add("UserID", user.SamAccountName);
                                row.Add("SessionID", get_session_id);
                                rows.Add(row);
                            }
                            else
                            {
                                string Name = user.DisplayName;
                                row.Add("UserName", username);
                                row.Add("Name", Name);
                                row.Add("UserValidated", "true");
                                row.Add("UserID", user.SamAccountName);
                                row.Add("SessionID", -1);
                                rows.Add(row);
                            }
                            return(rows);
                        }
                        else
                        {
                            row.Add("UserName", username);
                            row.Add("Name", "Not Found");
                            row.Add("UserValidated", "true");
                            row.Add("SessionID", -1);
                            rows.Add(row);
                            //string employeeID = user.EmployeeId;
                            return(rows);
                        }
                    }
                }
                else
                {
                    row.Add("UserName", username);
                    row.Add("Name", "Not Found");
                    row.Add("UserValidated", "false");
                    rows.Add(row);
                    //string employeeID = user.EmployeeId;
                    return(rows);
                }
            }
        }