Ejemplo n.º 1
0
        public IList <Pipe> GetStored()
        {
            try
            {
                PipeTestResult result      = null;
                Inspector      inspector   = null;
                Certificate    certificate = null;
                Coat           coat        = null;
                Weld           weld        = null;
                Spool          spool       = null;

                var q = session.QueryOver <Pipe>()
                        .Where(n => ((n.Status == PipeMillStatus.Stocked) && (n.IsActive == true) && n.Railcar == null))
                        .JoinAlias(r => r.PipeTestResult, () => result, JoinType.LeftOuterJoin)
                        .JoinAlias(() => result.Inspectors, () => inspector, JoinType.LeftOuterJoin)
                        .JoinAlias(() => inspector.Certificates, () => certificate, JoinType.LeftOuterJoin)
                        .JoinAlias(r => r.Coats, () => coat, JoinType.LeftOuterJoin)
                        .JoinAlias(r => r.Welds, () => weld, JoinType.LeftOuterJoin)
                        .JoinAlias(r => r.Spools, () => spool, JoinType.LeftOuterJoin)
                        .TransformUsing(Transformers.DistinctRootEntity)
                        .List <Pipe>();

                return(q);
            }
            catch (GenericADOException ex)
            {
                throw new RepositoryException("GetStored", ex);
            }
        }
Ejemplo n.º 2
0
 public TurbineBlade(int maxtemp, bool hascoolingchannels, int length, int chord, string materialType)
     : base(length, chord, materialType)
 {
     _parentSpool = null;
     _maxTemp = maxtemp;
     _hasCoolingChannels = hascoolingchannels;
 }
Ejemplo n.º 3
0
        void MapSerializableEntityToSpool(string tempDir, SpoolObject spoolObj, Spool spool)
        {
            spool.Id                 = spoolObj.Id;
            spool.IsActive           = spoolObj.IsActive;
            spool.PipeNumber         = spoolObj.PipeNumber;
            spool.Number             = spoolObj.Number;
            spool.Length             = spoolObj.Length;
            spool.IsAvailableToJoint = spoolObj.IsAvailableToJoint;
            spool.ConstructionStatus = spoolObj.ConstructionStatus;
            spool.InspectionStatus   = spoolObj.InspectionStatus;

            if (spoolObj.Attachments != null)
            {
                if (!Directory.Exists(Directories.TargetPath))
                {
                    Directory.CreateDirectory(Directories.TargetPath);
                    DirectoryInfo directoryInfo = new DirectoryInfo(Directories.TargetPath);
                    directoryInfo.Attributes |= FileAttributes.Hidden;
                }
                spool.Attachments = new List <Prizm.Domain.Entity.File>();
                foreach (var fileObject in spoolObj.Attachments)
                {
                    Prizm.Domain.Entity.File f = ImportFile(fileObject, spool.Id);
                    CopyAttachment(tempDir, f);
                }
            }
        }
Ejemplo n.º 4
0
        public IList <Pipe> GetPipesToExport()
        {
            try
            {
                // PipeTestResult result = null;
                // Inspector inspector = null;
                // Certificate certificate = null;
                // var q = session.QueryOver<Pipe>()
                //     .Where(n => ((n.ToExport == true)))
                //     .JoinAlias(r => r.PipeTestResult, () => result, JoinType.LeftOuterJoin)
                //     .JoinAlias(() => result.Inspectors, () => inspector, JoinType.LeftOuterJoin)
                //     .JoinAlias(() => inspector.Certificates, () => certificate, JoinType.LeftOuterJoin)
                //     .TransformUsing(Transformers.DistinctRootEntity)
                //     .List<Pipe>();
                //return q;

                Plate             plate       = null;
                Heat              heat        = null;
                PlateManufacturer plateMan    = null;
                PipeMillSizeType  type        = null;
                PipeTest          tests       = null;
                PipeTestResult    result      = null;
                Inspector         inspector   = null;
                Certificate       certificate = null;
                Project           proj        = null;
                SeamType          seam        = null;
                Spool             spool       = null;
                File              attach      = null;

                var q = session.QueryOver <Pipe>()
                        .Where(n => ((n.ToExport == true)))

                        .JoinAlias(r => r.PipeTestResult, () => result, JoinType.LeftOuterJoin)
                        .JoinAlias(() => result.Inspectors, () => inspector, JoinType.LeftOuterJoin)
                        .JoinAlias(() => inspector.Certificates, () => certificate, JoinType.LeftOuterJoin)

                        .JoinAlias(p => p.Plate, () => plate, JoinType.LeftOuterJoin)
                        .JoinAlias(() => plate.Heat, () => heat, JoinType.LeftOuterJoin)
                        .JoinAlias(() => heat.PlateManufacturer, () => plateMan, JoinType.LeftOuterJoin)

                        .JoinAlias(t => t.Type, () => type, JoinType.LeftOuterJoin)
                        .JoinAlias(() => type.SeamType, () => seam, JoinType.LeftOuterJoin)
                        .JoinAlias(() => type.PipeTests, () => tests, JoinType.LeftOuterJoin)

                        .JoinAlias(t => t.Spools, () => spool, JoinType.LeftOuterJoin)
                        .JoinAlias(t => t.Attachments, () => attach, JoinType.LeftOuterJoin)
                        .JoinAlias(t => t.Project, () => proj, JoinType.LeftOuterJoin)

                        .Fetch(o => o.PurchaseOrder).Eager
                        .Fetch(r => r.Railcar).Eager

                        .TransformUsing(Transformers.DistinctRootEntity)
                        .List <Pipe>();
                return(q);
            }
            catch (GenericADOException ex)
            {
                throw new RepositoryException("GetPipesToExport", ex);
            }
        }
Ejemplo n.º 5
0
        private Spool ImportSpool(string tempDir, SpoolObject so, Pipe pipe)
        {
            Spool spool = importRepo.SpoolRepo.Get(so.Id);

            bool isNew = false;

            if (spool == null)
            {
                spool = new Spool();
                isNew = true;
            }

            MapSerializableEntityToSpool(tempDir, so, spool);
            spool.Pipe = pipe;

            if (isNew)
            {
                importRepo.SpoolRepo.Save(spool);
            }
            else
            {
                importRepo.SpoolRepo.SaveOrUpdate(spool);
            }

            return(spool);
        }
Ejemplo n.º 6
0
 public SpoolObject(Spool spool)
 {
     this.Id                 = spool.Id;
     this.IsActive           = spool.IsActive;
     this.PipeNumber         = spool.PipeNumber;
     this.Number             = spool.Number;
     this.Length             = spool.Length;
     this.IsAvailableToJoint = spool.IsAvailableToJoint;
     this.ConstructionStatus = spool.ConstructionStatus;
     this.InspectionStatus   = spool.InspectionStatus;
 }
Ejemplo n.º 7
0
 void MapSerializableEntityToSpool(SpoolObject spoolObj, Spool spool)
 {
     spool.Id                 = spoolObj.Id;
     spool.IsActive           = spoolObj.IsActive;
     spool.PipeNumber         = spoolObj.PipeNumber;
     spool.Number             = spoolObj.Number;
     spool.Length             = spoolObj.Length;
     spool.IsAvailableToJoint = spoolObj.IsAvailableToJoint;
     spool.ConstructionStatus = spoolObj.ConstructionStatus;
     spool.InspectionStatus   = spoolObj.InspectionStatus;
 }
Ejemplo n.º 8
0
        public void RefreshList()
        {
            string Lib = IBMi.CurrentSystem.GetValue("printerLib"), Obj = IBMi.CurrentSystem.GetValue("printerObj");

            Thread spoolThread = new Thread((ThreadStart) delegate
            {
                ListViewItem curItem;
                List <ListViewItem> Items = new List <ListViewItem>();
                SpoolFile[] Listing       = IBMiUtils.GetSpoolListing(Lib, Obj);

                if (Listing != null)
                {
                    foreach (SpoolFile Spool in Listing)
                    {
                        curItem     = new ListViewItem(new[] { Spool.getName(), Spool.getData(), Spool.getStatus(), Spool.getJob() }, 0);
                        curItem.Tag = Spool;
                        Items.Add(curItem);
                    }
                }
                else
                {
                    Items.Add(new ListViewItem("No spool files found."));
                }

                if (spoolList != null)
                {
                    this.Invoke((MethodInvoker) delegate
                    {
                        spoolList.Items.Clear();
                        spoolList.Items.AddRange(Items.ToArray());
                    });
                }
            });

            if (Lib == "" || Obj == "")
            {
                MessageBox.Show("You must setup the Output Queue in the Connection Settings for the spool file listing to work.", "Spool Listing", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                spoolThread.Start();
            }
        }
Ejemplo n.º 9
0
        public SpoolObject(Spool spool)
        {
            this.Id                 = spool.Id;
            this.IsActive           = spool.IsActive;
            this.PipeNumber         = spool.PipeNumber;
            this.Number             = spool.Number;
            this.Length             = spool.Length;
            this.IsAvailableToJoint = spool.IsAvailableToJoint;
            this.ConstructionStatus = spool.ConstructionStatus;
            this.InspectionStatus   = spool.InspectionStatus;

            if (spool.Attachments != null)
            {
                this.Attachments = new List <FileObject>();
                foreach (var file in spool.Attachments)
                {
                    Attachments.Add(new FileObject(file));
                }
            }
        }
Ejemplo n.º 10
0
        public IList <TurbineBladeAndSpoolTypeInfoDto> GetTurbineBladeAndSpoolTypeInfoDtos()
        {
            using (ITransaction transaction = session.BeginTransaction())
            {
                TurbineBladeAndSpoolTypeInfoDto result = new TurbineBladeAndSpoolTypeInfoDto();
                TurbineBlade turbineBladeAlias         = null;
                Spool        spoolAlias = null;

                QueryOver <TurbineBlade> subquery =
                    QueryOver.Of <TurbineBlade>().Where(tb => tb.MaterialType.IsLike("%tungsten%")).Select(tb => tb.Id);

                var results = new List <TurbineBladeAndSpoolTypeInfoDto>();

                results = session.QueryOver <TurbineBlade>(() => turbineBladeAlias)
                          .JoinQueryOver(() => turbineBladeAlias.ParentSpool, () => spoolAlias)
                          .Where(() => spoolAlias.Id == turbineBladeAlias.ParentSpool.Id)
                          .WithSubquery.WhereProperty(() => turbineBladeAlias.Id)
                          .NotIn(subquery)
                          .And(
                    new OrExpression(
                        new InsensitiveLikeExpression(Projections.Property(() => turbineBladeAlias.MaterialType),
                                                      "%alloy%"),
                        Restrictions.Gt(Projections.Property(() => turbineBladeAlias.MaxTemp), 1400)))
                          .SelectList(list => list
                                      .Select(tb => tb.Id).WithAlias(() => result.TubineBladeID)
                                      .Select(() => turbineBladeAlias.ParentSpool.Id).WithAlias(() => result.ParentSpoolID)
                                      .Select(() => turbineBladeAlias.HasCoolingChannels).WithAlias(() => result.HasCoolingChannels)
                                      .Select(() => turbineBladeAlias.MaxTemp).WithAlias(() => result.MaxTemp)
                                      .Select(() => turbineBladeAlias.MaterialType).WithAlias(() => result.MaterialType)
                                      .Select(() => turbineBladeAlias.Length).WithAlias(() => result.Length)
                                      .Select(() => turbineBladeAlias.Chord).WithAlias(() => result.Chord))
                          .TransformUsing(Transformers.AliasToBean <TurbineBladeAndSpoolTypeInfoDto>())
                          .List <TurbineBladeAndSpoolTypeInfoDto>().ToList();


                transaction.Commit();
                return(results);
            }
        }
Ejemplo n.º 11
0
    public void OnGUI()
    {
        EditorGUI.BeginChangeCheck();
        targetSpool = (Spool)EditorGUILayout.ObjectField(targetSpool, typeof(Spool), false);
        if (EditorGUI.EndChangeCheck())
        {
            myNodes.Clear();
            if (targetSpool != null)
            {
                for (int i = 0; i < targetSpool.stitchCollection.Length; i++)
                {
                    myNodes.Add(new StitchNode(new Rect(100 * i, 20, 100, 100), i));
                }
            }
        }

        if (targetSpool != null)
        {
            for (int i = 0; i < targetSpool.stitchCollection.Length; i++)
            {
                for (int j = 0; j < targetSpool.stitchCollection[i].yarns.Length; j++)
                {
                    if (targetSpool.stitchCollection[i].yarns[j].choiceStitch != null)
                    {
                        DrawNodeCurve(myNodes[i].rect, myNodes[targetSpool.stitchCollection[i].yarns[j].choiceStitch.stitchID].rect);
                    }
                }
            }
        }

        BeginWindows();
        for (int i = 0; i < myNodes.Count; i++)
        {
            myNodes[i].rect = GUI.Window(i, myNodes[i].rect, myNodes[i].DrawGUI, targetSpool.stitchCollection[i].stitchName);
        }
        EndWindows();

        for (int i = 0; i < myNodes.Count; i++)
        {
            if (GUI.Button(new Rect(myNodes[i].rect.x + myNodes[i].rect.height - 70, myNodes[i].rect.yMax, 40, 20), "Edit"))
            {
                //Open Edit Window
                editorToggle = true;
                nodeSelected = i;
            }

            /*if (GUI.Button(new Rect(myNodes[i].rect.xMax - 10, myNodes[i].rect.y + myNodes[i].rect.height / 2, 20, 20), "+"))
             * {
             * BeginAttachment(i);
             * }
             *
             * if (GUI.Button(new Rect(myNodes[i].rect.xMin - 10, myNodes[i].rect.y + myNodes[i].rect.height / 2, 20, 20), "O"))
             * {
             * EndAttachment(i);
             * }*/
        }

        if (editorToggle)
        {
            Rect editorWindow = new Rect(position.width - position.width / 3, 0, position.width / 3, position.height);
            EditorGUI.DrawRect(editorWindow, Color.black);
        }
    }
Ejemplo n.º 12
0
        protected void FinishButton_Click(object sender, EventArgs e)
        {
            codigoControl      = "";
            lMsjDocumento.Text = "";
            string obligadocontabilidad = "";
            string guiaRemision;

            codigoControl = "";
            if (String.IsNullOrEmpty(ddlSucursal.SelectedValue))
            {
                ddlSucursal.Items.Clear();
                ddlSucursal.DataBind();
            }
            if (String.IsNullOrEmpty(ddlEmision.SelectedValue))
            {
                ddlEmision.Items.Clear();
                ddlEmision.DataBind();
            }
            if (String.IsNullOrEmpty(ddlAmbiente.SelectedValue))
            {
                ddlAmbiente.Items.Clear();
                ddlAmbiente.DataBind();
            }
            if (String.IsNullOrEmpty(ddlComprobante.SelectedValue))
            {
                ddlComprobante.Items.Clear();
                ddlComprobante.DataBind();
            }
            if (String.IsNullOrEmpty(ddlPtoEmi.SelectedValue))
            {
                ddlPtoEmi.Items.Clear();
                ddlPtoEmi.DataBind();
            }

            if (cbObligado.Checked)
            {
                obligadocontabilidad = "SI";
            }
            else
            {
                obligadocontabilidad = "NO";
            }
            try
            {
                spoolComprobante = new Spool();
                spoolComprobante.xmlComprobante();
                spoolComprobante.InformacionTributaria(ddlAmbiente.SelectedValue, ddlEmision.SelectedValue, tbRazonSocial.Text, tbNombreComercial.Text,
                                                       tbRuc.Text, "", ddlComprobante.SelectedValue, ddlSucursal.SelectedValue, ddlPtoEmi.SelectedValue, "", tbDirMatriz.Text, tbEmail.Text);
                spoolComprobante.infromacionDocumento(tbFechaEmision.Text, tbDirEstablecimiento.Text, tbContribuyenteEspecial.Text, obligadocontabilidad,
                                                      ddlTipoIdentificacion.SelectedValue, "", tbRazonSocialComprador.Text, tbIdentificacionComprador.Text, tbMoneda.Text,
                                                      "", "", "", "", "", "", "", "", "", "", "", formatCero, "");
                spoolComprobante.cantidades(tbSubtotal12.Text, tbSubtotal0.Text, tbSubtotalNoSujeto.Text, tbTotalSinImpuestos.Text,
                                            tbTotalDescuento.Text, tbICE.Text, tbIVA12.Text, tbImporteTotal.Text, tbPropinas.Text, tbImporteaPagar.Text);
                spoolComprobante.totalImpuestos(idUser);
                spoolComprobante.detalles(idUser);
                spoolComprobante.impuestos(idUser);
                spoolComprobante.detallesAdicionales(idUser);
                spoolComprobante.informacionAdicional(idUser);
                codigoControl = spoolComprobante.generarDocumento();
                if (!String.IsNullOrEmpty(codigoControl))
                {
                    Session["codigoControl"] = codigoControl;
                    Response.Redirect("~/Procesando.aspx");
                }
                else
                {
                    lMsjDocumento.Text = "No se pudo crear el Comprobante.";
                }
            }
            catch (Exception ex)
            {
                msj = log.PA_mensajes("EM011")[0];
                lMsjDocumento.Text = msj;
                log.mensajesLog("EM011", "", ex.Message, "Crear Factura", "");
            }
        }
Ejemplo n.º 13
0
 public TurbineBlade(int maxtemp, bool hascoolingchannels, int length, int chord, string materialType) : base(length, chord, materialType)
 {
     _parentSpool        = null;
     _maxTemp            = maxtemp;
     _hasCoolingChannels = hascoolingchannels;
 }
Ejemplo n.º 14
0
        //protected void FinishButton_Click_Client(object sender, WizardNavigationEventArgs e)
        //{
        //    switch (Wizard1.ActiveStepIndex)
        //    {
        //        case 2:
        //            Page.Validate("Receptor");
        //            if (!Page.IsValid)
        //            {
        //                e.Cancel = true;
        //            }
        //            break;
        //        default:
        //            break;
        //    }
        //}

        protected void FinishButton_Click(object sender, EventArgs e)
        {
            Wizard1.Enabled = false;
            //if (ddlMetodoPago.SelectedValue !="Selecciona una opción")
            //{
            //    if (tbFechaV.Text.Length > 0)

            //    {

            codigoControl      = "";
            lMsjDocumento.Text = "";
            string obligadocontabilidad = "";
            string guiaRemision;

            codigoControl = "";
            if (String.IsNullOrEmpty(ddlSucursal.SelectedValue))
            {
                ddlSucursal.Items.Clear();
                ddlSucursal.DataBind();
            }
            if (String.IsNullOrEmpty(ddlEmision.SelectedValue))
            {
                ddlEmision.Items.Clear();
                ddlEmision.DataBind();
            }
            if (String.IsNullOrEmpty(ddlAmbiente.SelectedValue))
            {
                ddlAmbiente.Items.Clear();
                ddlAmbiente.DataBind();
            }
            if (String.IsNullOrEmpty(ddlComprobante.SelectedValue))
            {
                ddlComprobante.Items.Clear();
                ddlComprobante.DataBind();
            }
            if (String.IsNullOrEmpty(ddlPtoEmi.SelectedValue))
            {
                ddlPtoEmi.Items.Clear();
                ddlPtoEmi.DataBind();
            }

            if (cbObligado.Checked)
            {
                obligadocontabilidad = "SI";
            }
            else
            {
                obligadocontabilidad = "NO";
            }
            try
            {
                obligadocontabilidad = "SI";
                string auxtipovemta = "";
                //if (tbIdentificacionComprador.Text.Length == 13)
                //{auxtipovemta = "04";  }

                spoolComprobante = new Spool();
                spoolComprobante.xmlComprobante();
                spoolComprobante.InformacionTributaria(ddlAmbiente.SelectedValue, ddlEmision.SelectedValue, tbRazonSocial.Text, tbNombreComercial.Text,
                                                       tbRuc.Text, "", ddlComprobante.SelectedValue, "001", "001", tbFolio.Text, tbDirMatriz.Text, tbEmail.Text);
                spoolComprobante.infromacionDocumento(tbFechaEmision.Text, tbDirEstablecimiento.Text, "", obligadocontabilidad,
                                                      ddlTipoIdentificacion.SelectedValue, "", tbRazonSocialComprador.Text, tbIdentificacionComprador.Text, tbMoneda.Text,
                                                      "", "", "", "", "", "", "", "", "", "", "", formatCero, "");
                spoolComprobante.cantidades(tbSubtotal12.Text, tbSubtotal0.Text, tbSubtotalNoSujeto.Text, tbTotalSinImpuestos.Text,
                                            tbTotalDescuento.Text, tbICE.Text, tbIVA12.Text, tbImporteTotal.Text, tbPropinas.Text, tbImporteaPagar.Text);
                spoolComprobante.totalImpuestos(idUser);
                spoolComprobante.detalles(idUser);
                spoolComprobante.impuestos(idUser);
                spoolComprobante.detallesAdicionales(idUser);
                spoolComprobante.informacionAdicional(idUser);


                consultaEmp(Session["idUser"].ToString());
                //INFO ADICONAL
                spoolComprobante.infoSatcom(txt_dir_cli.Text, txt_fono.Text, tbObservaciones.Text, ddlMetodoPago.SelectedValue, tbMonto.Text, tbEmail.Text);



                codigoControl = spoolComprobante.generarDocumento();



                if (!String.IsNullOrEmpty(codigoControl))
                {
                    registroSecuencial(ddlComprobante.SelectedValue, ddlSucursal.SelectedValue, ddlPtoEmi.SelectedValue, tbFolio.Text);


                    Session["codigoControl"] = codigoControl;
                    //Response.Redirect("~/Procesando.aspx");
                    Response.Redirect("~/Procesando.aspx", false);
                }
                else
                {
                    lMsjDocumento.Text = "No se pudo crear el Comprobante.";
                }
            }
            catch (Exception ex)
            {
                msj = log.PA_mensajes("EM011")[0];
                lMsjDocumento.Text = msj;
                log.mensajesLog("EM011", "", ex.Message, "Crear Factura", "");
            }
            //        }
            //        else { lMsjDocumento.Text = "Debes seleccionar fecha de pago"; }

            //}
            //else { lMsjDocumento.Text = "Debes seleccionar método de pago"; }
        }
Ejemplo n.º 15
0
        //[STAThread]
        static void Main()
        {
            //Thread t = new Thread(new ThreadStart(StartNewStaThread));
            //t.Start();

            Logger log = Logger.GetLogger();
            AviationAdministration FAA = AviationAdministration.GetInstance();
            NTSB NTSB = new NTSB();

            #region Side tasks (testing things)

            //JetEngine jet1 = new JetEngine(600, 500, 5, new List<Propellants> { Propellants.Jet_A },
            //    new List<Oxidisers> { Oxidisers.GOX }, "Rolls-Royce", "RB-201", "100000008", 27000, 12, "88", 0, OnOff.Stopped);
            //JetEngine jet2 = new JetEngine(600, 500, 5, new List<Propellants> { Propellants.Jet_A },
            //    new List<Oxidisers> { Oxidisers.GOX }, "Rolls-Royce", "RB-201", "888888888", 27000, 12, "88", 0, OnOff.Running);


            //var compartments = new List<GasCompartment>
            //{
            //    new GasCompartment(20, 15),
            //    new GasCompartment(20, 10),
            //    new GasCompartment(20, 15),
            //    new GasCompartment(15, 10)
            //};

            //LighterThanAirAircraft baloon = new LighterThanAirAircraft(new SafeGasPumpManager(), 300, "He", compartments,
            //    new List<Engine> { jet1, jet2 }, 100, "baloon Inc.", "Model-baloon", 700, 40, "88");
            //Console.WriteLine(baloon);
            //////Console.WriteLine("\n\nComparing gas compartments:");

            //baloon.ShiftGas(5,65,5);


            //Console.WriteLine("\n shifting gas");
            //try
            //{
            //    baloon.ShiftGas(0, 1, 14.5f);
            //    //baloon.ShiftGas(0, 0, 4.5f);
            //    //baloon.ShiftGas(0, 4, -4.5f);
            //}
            //catch (GasCompartmentsNotFoundException e) when (e.OriginCompartment == e.DestinationCompartment)
            //{
            //    Console.WriteLine($"\n{e.Message}.\n", e.Message);
            //}
            //catch (GasCompartmentsNotFoundException e)
            //{
            //    Console.WriteLine($"\n{e.Message} (origin: {e.OriginCompartment}, destination: {e.DestinationCompartment}).\n");
            //}
            //catch (Exception e)
            //{
            //    Console.WriteLine(e.Message);
            //    Debug.WriteLine(e.Message);
            //}
            //finally
            //{
            //    Console.WriteLine("An attempt was made to shift lifting gas\n");
            //}
            //Console.WriteLine(baloon);

            //Console.WriteLine();
            //Console.WriteLine("Attemting to stop an engine");

            //try
            //{
            //    baloon.StopEngine(baloon.Engines[0]);
            //}
            //catch (Exception e)
            //{
            //    Console.WriteLine(e.Message);
            //    Console.WriteLine(e.InnerException?.Message ?? "no inner exception");
            //}

            #endregion

            String[] ox = Enum.GetNames(typeof(OxidisersEnum));
            foreach (var s in ox)
            {
                Console.WriteLine(s);
            }

            ServiceLocator.RegisterAll();
            HeavierThanAirAircraftFactory factory = ServiceLocator.Get <HeavierThanAirAircraftFactory>();

            #region factories and cultures

            //RotorCraft rotorCraft = factory.TryMakeRotorCraft("00000000", new List<RotorBlade>(), "standart TEST rotor",
            //    42, 73, "TEST manufacturer", 4242);
            ////Console.WriteLine(rotorCraft);
            //FAA.RegisterAircraft(new List<AircraftRegistration>
            //    {
            //        new AircraftRegistration(rotorCraft, true),
            //        new AircraftRegistration(rotorCraft, false)
            //});

            #region

            //Thread t = new Thread(new ThreadStart(StartNewStaThread));
            //t.Start();


            //Thread.Sleep(4000);

            //Console.WriteLine("\n\n\n");
            //RotorCraft rotorCraft2 = factory.TryMakeRotorCraft("000000002", new List<RotorBlade>(),
            //    "standart TEST rotor2",
            //    42, 73, "TEST manufacturer2", 4242);
            //Console.WriteLine(rotorCraft2);

            //log.ExportToFile();
            //log.FileName = "NumberTWO";
            //log.ExportToFile();

            //log.AddToLog(log.FindInLog("000000002").ToString());
            //log.AddToLogWithOffset("Testing the offset method");

            //log.AddToLog("sdasdsadsadad");
            //Thread.Sleep(2000);
            //Console.WriteLine(log.CalculatePostTimeDifference());



            //switch (Console.ReadLine().ToUpper())
            //{
            //    case "US":
            //        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            //        break;
            //    case "UK":
            //        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
            //        break;
            //    default:
            //        Console.WriteLine("wrong answer)");
            //        break;
            //}

            //switch (Thread.CurrentThread.CurrentCulture.ToString())
            //{
            //    case "en-US":
            //        Console.WriteLine("honor, behavior...");
            //        Console.WriteLine(TimeZone.CurrentTimeZone.StandardName);
            //        break;
            //    case "en-GB":
            //        Console.WriteLine("colour, monetisation...");
            //        Console.WriteLine(TimeZone.CurrentTimeZone.StandardName);
            //        break;
            //}

            #endregion


            #endregion

            #region Decorator

            //var turbineEngineFactory = TurbineEngineFactory.GeTurbineEngineFactory();

            //var turboFan = new Turbofan();

            //if (turbineEngineFactory.TryMakeTurbofan(4, 3, new Generator(),
            //    new List<Spool>(), 600, 500, 5, new List<Propellants> { Propellants.Jet_A },
            //    new List<Oxidisers> { Oxidisers.GOX }, "Rolls-Royce", "RB-201", "100000008", 27000, 88, 0, OnOff.Stopped,
            //    out turboFan))
            //{
            //    Console.WriteLine();
            //    Console.WriteLine(turboFan);
            //}
            //else
            //{
            //    Console.WriteLine();
            //    Console.WriteLine("No engine could be created");
            //}


            //ReheatDecorator engineDecorator = new ReheatDecorator(turboFan);
            //engineDecorator.Decorate(new ReheatChamber(1.5));
            //engineDecorator.Reheat.Engage();
            //Console.WriteLine("\n\n\n\n");
            //Console.WriteLine(engineDecorator);

            //DumpAndBurnDecorator decorator2 = new DumpAndBurnDecorator(engineDecorator);
            //decorator2.Decorate(new FuelDumper(2));
            //decorator2.DumpandBurn.Engage();
            //Console.WriteLine("\n\n\n\n");
            //Console.WriteLine(decorator2);

            //#endregion

            //#region Proxy

            //Console.WriteLine("\n\n\n\n");
            //LighterThanAirAircraftProxy proxy = new LighterThanAirAircraftProxy(300);
            //Stopwatch performanceStopwatch = new Stopwatch();
            //performanceStopwatch.Start();
            //proxy.DumpBallast(100);
            //performanceStopwatch.Stop();
            //Console.WriteLine("Ballast dumping took aprox. {0} ticks", performanceStopwatch.ElapsedTicks);

            //Console.WriteLine("\n\n");
            //performanceStopwatch.Restart();
            //proxy.ShiftGas(0, 1, 50);
            //performanceStopwatch.Start();
            //Console.WriteLine("Creating a new object and shifting gas took aprox {0} ticks", performanceStopwatch.ElapsedTicks);

            #endregion

            //rotorCraft.IsOperational = false;
            //Console.WriteLine(rotorCraft);

            NHibernateProfiler.Initialize();


            //aircraft registry
            var aircraftRegistryRepository = ServiceLocator.Get <IAircraftRegistryRepository>();
            aircraftRegistryRepository.Save(new AircraftRegistry("VH-HYR", false, new DateTime(1996, 10, 10), "622"));

            //gas compartment
            var gasCompartmentRepository = ServiceLocator.Get <IGasCompartmentRepository>();
            gasCompartmentRepository.Save(new GasCompartment(4000, 3800));

            //generator
            var generatorRepository = ServiceLocator.Get <IGeneratorRepository>();
            generatorRepository.Save(new Generator(42, 73));

            //wing
            var wingRepository = ServiceLocator.Get <IWingRepository>();
            wingRepository.Save(new Wing(42, 73));

            ////VariableGeometryWing
            var VGWRepository = ServiceLocator.Get <IVariableGeometryWingRepository>();
            VGWRepository.Save(new VariableGeometryWing(42, 73, 42, 73));

            //aircraft
            var aircraftRepository = ServiceLocator.Get <IAircraftRepository>();
            //it's an abstarct class

            //powered aircraft
            var poweredAircraftRepository = ServiceLocator.Get <IPoweredAircraftRepository>();
            poweredAircraftRepository.Save(new PoweredAircraft(null, 42, "42", "73", 42, 73, "622"));
            poweredAircraftRepository.Save(new PoweredAircraft(null, 42, "42", "73", 42, 73, "888"));

            //lighter than air aircraft
            var lighterThanAirAircraftRepository = ServiceLocator.Get <ILighterThanAirAircraftRepository>();
            lighterThanAirAircraftRepository.Save(new LighterThanAirAircraft(null, 42, "He", new List <GasCompartment>(), new List <Engine>(), 73, "42", "73", 42, 73, "741"));

            //heavier than air aircraft
            var heavierThanAirAircraftRepository = ServiceLocator.Get <IHeavierThanAirAircraftRepository>();
            heavierThanAirAircraftRepository.Save(new HeavierThanAirAircraft(new List <Engine>(), 42, "42", "73", 42, 73, "2849"));

            //fixed wing aircraft
            var fixedWingAricraftRepository = ServiceLocator.Get <IFixedWingAircraftRepository>();
            fixedWingAricraftRepository.Save(new FixedWingAircraft(new List <Wing>(), 42, 73, new List <Engine>(), 42, "42", "73", 42, 73, "666"));

            //rotorcraft
            var rotorcraftRepository = ServiceLocator.Get <IRotorCraftRepository>();
            rotorcraftRepository.Save(new RotorCraft(42, new List <RotorBlade>(), "73", new List <Engine>(), 42, "42", "73", 42, 73, "19000130"));

            //propellant
            var propellantRepository = ServiceLocator.Get <IPropellantRepository>();
            propellantRepository.Save(new Propellant(PropellantsEnum.MonoMethylHydrazine));

            //oxidiser
            var oxidiserRepository = ServiceLocator.Get <IOxidiserRepository>();
            oxidiserRepository.Save(new Oxidiser(OxidisersEnum.DinitrogenTetroxide));

            //blade
            var bladeRepository = ServiceLocator.Get <IBladeRepository>();
            //it's an abstract class

            //turbine blade
            var turbineBladeRepository = ServiceLocator.Get <ITurbineBladeRepository>();
            turbineBladeRepository.Save(new TurbineBlade(1000, true, 18, 12, "High temp alloy"));

            //rotor blade
            var rotorBladeRepository = ServiceLocator.Get <IRotorBladeRepository>();
            rotorBladeRepository.Save(new RotorBlade(true, 42, 73, "42"));

            //spool
            var spoolRepository = ServiceLocator.Get <ISpoolRepository>();
            spoolRepository.Save(new Spool(new List <TurbineBlade>(), "42"));

            //engine
            var engineRepository = ServiceLocator.Get <IEngineRepository>();
            //it's an abstract class

            //piston engine
            var pistonEngineRepository = ServiceLocator.Get <IPistonEngineRepository>();
            pistonEngineRepository.Save(new PistonEngine(42, 73, "42", "73", "42", 73, 42, null, 73, OnOff.Stopped));

            //jet engine
            var jetEngineRepository = ServiceLocator.Get <IJetEngineRepository>();
            jetEngineRepository.Save(new JetEngine(42, 73, 42, null, null, "42", "73", "42", 73, 42, null, 42, OnOff.Stopped));

            //rocket engine
            var rocketEngineRepository = ServiceLocator.Get <IRocketEngineRepository>();
            rocketEngineRepository.Save(new RocketEngine(true, "42", 42, 73, 42, null, null, "42", "73", "42", 73, 42, null, 42, OnOff.Stopped));

            //solid fuel rocket engine
            var solidFuelRocketEngineRepository = ServiceLocator.Get <ISolidFuelRocketEngineRepository>();
            solidFuelRocketEngineRepository.Save(new SolidFuelRocketEngine(true, "42", 42, 73, 42, null, null, "42", "73", "42", 73, 42, null, 73, OnOff.Stopped));

            //turbine engine
            var turbineEngineRepository = ServiceLocator.Get <ITurbineEngineRepository>();
            turbineEngineRepository.Save(new TurbineEngine(true, 42, null, null, 42, 73, 42, null, null, "42", "73", "42", 73, 42, null, 42, OnOff.Stopped));

            //ramjet
            var ramjetRepository = ServiceLocator.Get <IRamjetRepository>();
            ramjetRepository.Save(new Ramjet(true, 42, 73, 42, null, null, "42", "73", "42", 73, 42, null, 42, OnOff.Stopped));

            //turbofan
            var turbofanRepository = ServiceLocator.Get <ITurbofanRepository>();
            turbofanRepository.Save(new Turbofan(42, true, true, 42, null, null, 73, 42, 73, null, null, "42", "73", "42", 73, 42, null, 42, OnOff.Stopped));

            //turboshaft
            var turboshaftRepository = ServiceLocator.Get <ITurboshaftRepository>();
            turboshaftRepository.Save(new Turboshaft(42, 73, true, 42, null, null, 73, 42, 73, null, null, "42", "73", "42", 73, 42, null, 42, OnOff.Stopped));

            //turbojet
            var turbojetRepository = ServiceLocator.Get <ITurbojetRepository>();
            turbojetRepository.Save(new Turbojet(true, 42, null, null, 73, 42, 73, null, null, "42", "73", "42", 73, 42, null, 42, OnOff.Stopped));



            ////testing double session use
            //var testSpool = turbojetRepository.LoadEntity<Spool>(159159);

            //var testTurbojet = turbojetRepository.LoadEntity<Turbojet>(120128);

            //testSpool.ParentEngine = testTurbojet;

            //testTurbojet.Spools.Add(testSpool);

            //turbojetRepository.Save(testTurbojet);

            ////turbojetRepository.Delete(testTurbojet);

            List <Spool> spools = new List <Spool>();
            spools.Add(new Spool(null, "Fan"));
            spools.Add(new Spool(null, "IP spool"));
            spools.Add(new Spool(null, "LP spool"));
            spools.Add(new Spool(null, "HP spool"));

            List <TurbineBlade> blades = new List <TurbineBlade>();
            for (int i = 0; i < 10; i++)
            {
                TurbineBlade tb = new TurbineBlade(1500, true, 12, 8, "Ti");
                blades.Add(tb);
                blades.Add(new TurbineBlade(1000, false, 18, 12, "High temp alloy"));
                blades.Add(new TurbineBlade(1350, true, 12, 8, "Ceramic plated alloy"));
                blades.Add(new TurbineBlade(1275, false, 12, 8, "W (tungsten) alloy"));
            }



            spools[0] = new Spool(blades.Where(x => x.MaterialType == "High temp alloy").ToList(), spools[0].Type);
            spools[1] = new Spool(blades.Where(x => x.MaterialType == "W (tungsten) alloy").ToList(), spools[1].Type);
            spools[2] = new Spool(blades.Where(x => x.MaterialType == "Ceramic plated alloy").ToList(), spools[2].Type);
            spools[3] = new Spool(blades.Where(x => x.MaterialType == "Ti").ToList(), spools[3].Type);


            foreach (var spool in spools)
            {
                foreach (var turbineBlade in spool.Blades)
                {
                    turbineBlade.ParentSpool = spool;
                }
            }


            foreach (var spool in spools)
            {
                spoolRepository.Save(spool);
            }

            foreach (var turbineBlade in blades)
            {
                turbineBladeRepository.Save(turbineBlade);
            }

            for (int i = 200; i < 1000; i += 50)
            {
                gasCompartmentRepository.Save(new GasCompartment(i, (float)(i - (i * 0.5))));
            }

            aircraftRegistryRepository.Save(new AircraftRegistry("ER-AXV", false, new DateTime(2003, 9, 22), "622"));
            aircraftRegistryRepository.Save(new AircraftRegistry("N452TA", false, new DateTime(1997, 11, 28), "741"));
            aircraftRegistryRepository.Save(new AircraftRegistry("ER-AXP", false, new DateTime(2011, 11, 3), "741"));
            aircraftRegistryRepository.Save(new AircraftRegistry("B-6156", false, new DateTime(2006, 8, 3), "2849"));
            aircraftRegistryRepository.Save(new AircraftRegistry("ER-AXL", false, new DateTime(2015, 6, 5), "2849"));
            aircraftRegistryRepository.Save(new AircraftRegistry("D-ASSY", false, new DateTime(1997, 3, 26), "666"));
            aircraftRegistryRepository.Save(new AircraftRegistry("SX-BHT", false, new DateTime(2014, 5, 31), "666"));
            aircraftRegistryRepository.Save(new AircraftRegistry("F-OSUD", false, new DateTime(2007, 12, 4), "19000130"));
            aircraftRegistryRepository.Save(new AircraftRegistry("ER-ECC", false, new DateTime(2013, 3, 29), "19000130"));

            Console.WriteLine("\nselecting all turbineblades not made out of W, but are an alloy or can withstand temperatures in excess of 1400 C");
            //SQLQuery2
            //selecting all turbineblades not made out of W, but are an alloy or can withstand temperatures in excess of 1400 C
            IList <TurbineBladeAndSpoolTypeInfoDto> results2 = turbineBladeRepository.GetTurbineBladeAndSpoolTypeInfoDtos();

            foreach (var turbineBladeAndSpoolTypeInfoDto in results2)
            {
                Console.WriteLine($"SerialNumber: {turbineBladeAndSpoolTypeInfoDto.TubineBladeID}, Material type: {turbineBladeAndSpoolTypeInfoDto.MaterialType}, Max. temp.:{turbineBladeAndSpoolTypeInfoDto.MaxTemp}");
            }

            Console.WriteLine("\ngets the number of compartments whose capacity is greater than 300 units of volume and their actual capacity ");
            //SQLQuery3
            //gets the number of compartments whose capacity is greater than 300 units of volume and their actual capacity
            List <GasCompatrmentsCountAndCapacityDto> results3_1 =
                gasCompartmentRepository.GetCompartmetnsCountWithLowerCapacityThan(300);

            foreach (var gasCompatrmentsCountAndCapacityDto in results3_1)
            {
                Console.WriteLine($"Capacity: {gasCompatrmentsCountAndCapacityDto.Capacity}, Count: {gasCompatrmentsCountAndCapacityDto.Count}");
            }

            Console.WriteLine("\nreturns the number of blades that have cooling channels and the number that don't");
            //SQLQuery3
            //returns the number of blades that have cooling channels and the number that don't
            List <TurbineBladeCountDifferentiateOnCoolingChannelsDto> results3_2 =
                turbineBladeRepository.GetNumberOfBladesWithOrWitjoutCooling();

            foreach (var turbineBladeCountDifferentiateOnCoolingChannelsDto in results3_2)
            {
                Console.WriteLine($"Count: {turbineBladeCountDifferentiateOnCoolingChannelsDto.Count}, HasCoolingChannels: {turbineBladeCountDifferentiateOnCoolingChannelsDto.HasCoolingChannels}");
            }

            Console.WriteLine("\ngets all the aircraft info and the number of times it was registered in the registry");
            //SQLQuery4
            //gets all the aircraft info and the number of times it was registered in the registry
            List <AicraftInfoAndNumberOfTimesRegisteredDto> results4_1 =
                aircraftRegistryRepository.GetAicraftInfoAndNumberOfTimesRegistered();

            foreach (var aicraftInfoAndNumberOfTimesRegisteredDto in results4_1)
            {
                Console.WriteLine($"Serial number: {aicraftInfoAndNumberOfTimesRegisteredDto.SerialNumber}, NumberOfTimesRegistered: {aicraftInfoAndNumberOfTimesRegisteredDto.Count}");
            }

            Console.WriteLine("\ngets all aircraft,that have been reregistered more than a year ago");
            //SQLQuery4
            //gets all aircraft,that have been reregistered more than a year ago
            List <AicraftInfoAndDateOfRegistrationDto> results4_2 =
                aircraftRegistryRepository.GetAicraftInfoAndDateOfPenultimateRegistrationDtos(1);

            foreach (var aicraftInfoAndDateOfRegistrationDto in results4_2)
            {
                Console.WriteLine($"Serial number: {aicraftInfoAndDateOfRegistrationDto.SerialNumber}, penultimate registration date: {aicraftInfoAndDateOfRegistrationDto.RegistryDate.Date}");
            }

            Console.WriteLine("\nreturns gas compartments' IDs whose volume is greater than the average volume");
            //SQLQuery4
            //returns gas compartments' IDs whose volume is greater than the average volume
            List <long> result4_3 = gasCompartmentRepository.GetCompartmentsWithLessThanDoubleTheAverageVolume();

            foreach (var l in result4_3)
            {
                Console.WriteLine($"CompartmentID: {l}");
            }

            Console.WriteLine("\ngets turbine blades IDs whose max temp is either the overall maximum or the overall average");
            //SQLQuery4
            //gets turbine blade IDs whose max temp is either the overall maximum or the overall average
            List <long> results4_4 = turbineBladeRepository.GetTubineBladesWithMaxTempInAVGorMAX();

            foreach (var l in results4_4)
            {
                Console.WriteLine($"Turbine blade ID: {l}");
            }

            Console.WriteLine("\nreturns all aircraft whose latest regsitration is more that 5 years old");
            //SQLQuery4
            //returns all aircraft whose latest regsitration is more that 5 years old
            List <AicraftInfoAndDateOfRegistrationDto> results4_5 =
                aircraftRegistryRepository.GetAicraftInfoAndLastDateOfRegistrationDtos(5);

            foreach (var aicraftInfoAndDateOfRegistrationDto in results4_5)
            {
                Console.WriteLine($"Serial number: {aicraftInfoAndDateOfRegistrationDto.SerialNumber}, Registration date: {aicraftInfoAndDateOfRegistrationDto.RegistryDate.Date}");
            }

            Console.WriteLine("\nGets info about aircraft and whether it was registered");
            //SQLQuery4
            //Gets info about aircraft and whether it was registered
            List <AicraftInfoAndIfRegisteredBoolDto> results4_6 =
                aircraftRegistryRepository.GetAicraftInfoAndIfRegisteredBoolDto();


            foreach (var aicraftInfoAndIfRegisteredBoolDto in results4_6)
            {
                Console.WriteLine($"SerialNumber: {aicraftInfoAndIfRegisteredBoolDto.SerialNumber}, is registered: {aicraftInfoAndIfRegisteredBoolDto.IsRegistered}");
            }


            Console.WriteLine("\nreturns aircraft, that have been registred in two scpecified years");
            //SQLQuery4
            //returns aircraft, that have been registred in two scpecified years
            List <string> results4_7 = aircraftRegistryRepository.GetAircraftRegisteredInTwoSpecificYears(2003, 1996);

            foreach (var VARIABLE in results4_7)
            {
                Console.WriteLine($"Serial number: {VARIABLE}");
            }

            log.Dispose();
        }
Ejemplo n.º 16
0
        //protected void FinishButton_Click_Client(object sender, WizardNavigationEventArgs e)
        //{
        //    switch (Wizard1.ActiveStepIndex)
        //    {
        //        case 2:
        //            Page.Validate("Receptor");
        //            if (!Page.IsValid)
        //            {
        //                e.Cancel = true;
        //            }
        //            break;
        //        default:
        //            break;
        //    }
        //}

        protected void FinishButton_Click(object sender, EventArgs e)
        {
            codigoControl      = "";
            lMsjDocumento.Text = "";
            string obligadocontabilidad = "";
            string guiaRemision;
            string datos         = "";
            string respuesta     = "";
            string ptoEmi        = "";
            string claveSucursal = "";

            ClaveAcceso       = "";
            NoAutorizacion    = "";
            FechaAutorizacion = "";
            Estado            = "";
            Ambiente          = "";
            Emision           = "";
            MensajeT          = "";
            Numero            = "";
            Codigo            = "";
            Mensaje           = "";
            IA = "";


            XmlDocument xmlRespuesta = new XmlDocument();

            codigoControl = "";
            if (String.IsNullOrEmpty(ddlSucursal.SelectedValue))
            {
                ddlSucursal.Items.Clear();
                ddlSucursal.DataBind();
            }
            if (String.IsNullOrEmpty(ddlEmision.SelectedValue))
            {
                ddlEmision.Items.Clear();
                ddlEmision.DataBind();
            }
            if (String.IsNullOrEmpty(ddlAmbiente.SelectedValue))
            {
                ddlAmbiente.Items.Clear();
                ddlAmbiente.DataBind();
            }
            if (String.IsNullOrEmpty(ddlComprobante.SelectedValue))
            {
                ddlComprobante.Items.Clear();
                ddlComprobante.DataBind();
            }
            if (String.IsNullOrEmpty(ddlPtoEmi.SelectedValue))
            {
                ddlPtoEmi.Items.Clear();
                ddlPtoEmi.DataBind();
                ptoEmi = ddlPtoEmi.SelectedValue;
            }
            if (Session["estab"] != null)
            {
                claveSucursal = Session["estab"].ToString();
            }
            if (Session["ptoemi"] != null)
            {
                ptoEmi = Session["ptoemi"].ToString();
            }

            if (cbObligado.Checked)
            {
                obligadocontabilidad = "SI";
            }
            else
            {
                obligadocontabilidad = "NO";
            }
            try
            {
                tbSecuencial.Text = obtenerSecuencial(claveSucursal, ptoEmi, ddlComprobante.SelectedValue);
                spoolComprobante  = new Spool();
                spoolComprobante.xmlComprobante();
                spoolComprobante.InformacionTributaria(ddlAmbiente.SelectedValue, ddlEmision.SelectedValue, tbRazonSocial.Text, tbNombreComercial.Text,
                                                       tbRuc.Text, "", ddlComprobante.SelectedValue, claveSucursal, ptoEmi, tbSecuencial.Text, tbDirMatriz.Text, tbEmail.Text);
                spoolComprobante.infromacionDocumento(tbFechaEmision.Text, tbDirEstablecimiento.Text, tbContribuyenteEspecial.Text, obligadocontabilidad,
                                                      ddlTipoIdentificacion.SelectedValue, "", tbRazonSocialComprador.Text, tbIdentificacionComprador.Text, tbMoneda.Text,
                                                      "", "", "", "", "", "", "", "", "", "", "", formatCero, "");
                spoolComprobante.cantidades(tbSubtotal12.Text, tbSubtotal0.Text, tbSubtotalNoSujeto.Text, tbTotalSinImpuestos.Text,
                                            tbTotalDescuento.Text, tbICE.Text, tbIVA12.Text, tbImporteTotal.Text, tbPropinas.Text, tbImporteaPagar.Text);
                spoolComprobante.datosHerbalife(System.DateTime.Now.ToString("yyyyMMddHHmmss"), "1900-01-01T00:00:00", "0.0", "", "", "",
                                                "", "0.0", "", "", "", "", "", "", "", "E3", "", "", "", "");

                spoolComprobante.totalImpuestos(idUser);
                spoolComprobante.detalles(idUser);
                spoolComprobante.impuestos(idUser);
                spoolComprobante.detallesAdicionales(idUser);
                spoolComprobante.informacionAdicional(idUser);
                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



                // wsGenerarDoc.wsGenerarDocSoapClient crearDocManual = new wsGenerarDoc.wsGenerarDocSoapClient();
                XdService.XdServicePruebasSoapClient crearDocManual = new XdService.XdServicePruebasSoapClient();
                //wsGenerarDocSSL.wsGenerarDocSoapClient crearDocManual = new wsGenerarDocSSL.wsGenerarDocSoapClient();

                txt           = spoolComprobante.generarDocumento();
                codigoControl = spoolComprobante.codigoControl;
                DB.Conectar();
                DB.CrearComando(@"insert into Log_Trama
                                (Trama,fecha)
                                values
                                (@Trama,@fecha)");
                DB.AsignarParametroCadena("@Trama", "FM ---" + txt.Replace("'", ""));
                DB.AsignarParametroCadena("@fecha", System.DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"));
                DB.EjecutarConsulta1();
                DB.Desconectar();

                //crearDocManual = new wsGenerarDoc.wsGenerarDocSoapClient();
                crearDocManual = new XdService.XdServicePruebasSoapClient();
                //encData_byte = new byte[txt.Length];
                //encData_byte = System.Text.Encoding.UTF8.GetBytes(txt);

                xmlRespuesta.LoadXml(crearDocManual.recibeInfoTXT(txt, tbRuc.Text).ToString());
                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


                ClaveAcceso       = xmlRespuesta.GetElementsByTagName("claveAcceso")[0].InnerText;
                NoAutorizacion    = xmlRespuesta.GetElementsByTagName("numeroAutorizacion")[0].InnerText;
                FechaAutorizacion = xmlRespuesta.GetElementsByTagName("fechaAutorizacion")[0].InnerText;
                Estado            = xmlRespuesta.GetElementsByTagName("estado")[0].InnerText;
                Mensaje           = xmlRespuesta.GetElementsByTagName("msj")[0].InnerText;
                MensajeT          = xmlRespuesta.GetElementsByTagName("msjT")[0].InnerText;

                Codigo = xmlRespuesta.GetElementsByTagName("codigo")[0].InnerText;

                if (!Estado.Equals("N0") && !String.IsNullOrEmpty(Estado))
                {
                    DB.Conectar();
                    DB.CrearComando(@"delete from Dat_detallesTemp where id_Empleado=@id_Empleado");
                    DB.AsignarParametroCadena("@id_Empleado", idUser);
                    DB.EjecutarConsulta1();
                    DB.Desconectar();
                    DB.Conectar();
                    DB.CrearComando(@"delete from Dat_ImpuestosDetallesTemp where id_Empleado=@id_Empleado");
                    DB.AsignarParametroCadena("@id_Empleado", idUser);
                    DB.EjecutarConsulta1();
                    DB.Desconectar();
                    Response.Redirect("~/Documentos.aspx", false);
                    //Response.Redirect("~/Procesando.aspx", false);
                }
                else
                {
                    lMsjDocumento.Text  = "No se pudo crear el Comprobante." + "<br>";
                    lMsjDocumento.Text += "ClaveAcceso:" + ClaveAcceso + "<br>";
                    lMsjDocumento.Text += "Número: " + Numero + "<br>";
                    lMsjDocumento.Text += "Mensaje: " + Mensaje + "<br>";
                    lMsjDocumento.Text += "IA: " + MensajeT + "<br>";
                }
            }
            catch (Exception ex)
            {
                msj = log.PA_mensajes("EM011")[0];

                lMsjDocumento.Text = msj;
                lMsjDocumento.Text = ex.ToString();
                log.mensajesLog("EM011", "", ex.Message, "0", "01");
            }
        }
Ejemplo n.º 17
0
        private void InitializeSpools()
        {
            try
            {
                FileLogger.Info(Logger, "Spool configurati: " + Cfg.Spools.Count);
                foreach (var spool in Cfg.Spools)
                {
                    var mySpool = new Spool(spool.Id);
                    FileLogger.Info(Logger, "Configurazione Spool: " + mySpool.Id);

                    // Inizializzo i timers dello spool
                    FileLogger.Info(Logger, "Timers configurati: " + spool.Timers.Count);
                    foreach (var timer in spool.Timers)
                    {
                        FileLogger.Debug(Logger, String.Format("Configurazione timer: {0} - {1}", timer.Id, timer.Type));

                        //Timer di riferimento
                        var tw = new TimerWork(timer.Type)
                        {
                            Id        = timer.Id,
                            Duetime   = timer.DueTime,
                            Period    = timer.Period,
                            BeginTime = timer.BeginTime,
                            EndTime   = timer.EndTime
                        };

                        var configuredModules = Cfg.Modules.Where(module => module.Spool == spool.Id && module.Timer == timer.Id && module.Enabled).ToList();
                        if (configuredModules.Count <= 0)
                        {
                            continue;
                        }

                        var timerModules = configuredModules.Select(configuredModule => Modules[configuredModule.Id]).ToList();

                        // Inizializzo tutti i moduli del timer
                        foreach (var jeepThreadedModule in timerModules)
                        {
                            jeepThreadedModule.Timer = tw;
                            JeepModules[jeepThreadedModule].Start();
                        }
                    }

                    FileLogger.Debug(Logger, "Spool configurato correttamente: " + mySpool.Id);
                    Spools.Add(mySpool.Id, mySpool);
                }

                foreach (var s in Spools.Values)
                {
                    FileLogger.Debug(Logger, "Spool configurato: " + s.Id);
                    foreach (var timer in s.Timers.Values)
                    {
                        FileLogger.Debug(Logger, "TimerWork configurato: " + timer);
                    }
                }

                if (Spools.Count != 0)
                {
                    return;
                }
                // Nessun modulo caricato
                FileLogger.Error(Logger, "Nessun modulo caricato");
                // Fermo il servizio
                Stop();
            }
            catch (Exception exc)
            {
                FileLogger.Error(Logger, "Errore in configurazione Spools", exc);
                Stop();
            }
        }
Ejemplo n.º 18
0
        private PartData ImportPartData(PartDataObject partDataObj, Data data, string tempDir, Joint joint)
        {
            if (partDataObj == null)
            {
                return(null);
            }

            PartType type   = partDataObj.PartType;
            Guid     partId = partDataObj.Id;

            switch (type)
            {
            case PartType.Pipe:
                Pipe pipe = importRepo.PipeRepo.Get(partId);

                bool newPipe = false;
                if (pipe == null)
                {
                    PipeObject pipeObj = FindPipeById(data, partId);
                    if (pipeObj != null)
                    {
                        pipe = new Pipe();
                        MapSerializableEntityToPipe(tempDir, pipeObj, pipe);
                        newPipe = true;
                    }
                }

                if (pipe != null)
                {
                    if (newPipe)
                    {
                        importRepo.PipeRepo.Save(pipe);
                    }
                    else
                    {
                        importRepo.PipeRepo.SaveOrUpdate(pipe);
                    }
                }

                break;

            case PartType.Spool:
                Spool spool = importRepo.SpoolRepo.Get(partId);

                bool isNewSpool = false;
                if (spool == null)
                {
                    SpoolObject spoolObj = FindSpoolById(data, partId);
                    if (spoolObj != null)
                    {
                        spool = new Spool();
                        MapSerializableEntityToSpool(tempDir, spoolObj, spool);
                        isNewSpool = true;
                    }
                }

                if (spool != null)
                {
                    if (isNewSpool)
                    {
                        importRepo.SpoolRepo.Save(spool);
                    }
                    else
                    {
                        importRepo.SpoolRepo.SaveOrUpdate(spool);
                    }
                }

                break;

            case PartType.Component:
                Component component = importRepo.ComponentRepo.Get(partId);

                bool isNewComponent = false;
                if (component == null)
                {
                    ComponentObject compObj = FindComponentById(data, partId);
                    if (compObj != null)
                    {
                        component = new Component();
                        MapSerializableEntityToComponent(tempDir, compObj, component, joint);
                        isNewComponent = true;
                    }
                }

                if (component != null)
                {
                    if (isNewComponent)
                    {
                        importRepo.ComponentRepo.Save(component);
                    }
                    else
                    {
                        importRepo.ComponentRepo.SaveOrUpdate(component);
                    }
                }

                break;
            }

            PartData pd = new PartData();

            pd.Id       = partId;
            pd.PartType = type;
            return(pd);
        }
Ejemplo n.º 19
0
        public void ImportarSpools(DataTable dtSpoolsImport, IProgress <ImportProgressReport> progress)
        {
            UnitOfWork uow = new UnitOfWork(((XPObjectSpace)objectSpace).Session.ObjectLayer);

            if (uow.FindObject <TabDiametro>(CriteriaOperator.Parse("")) is null)
            {
                throw new ArgumentNullException("TabDiametro vazia!");
            }

            if (uow.FindObject <TabEAPPipe>(CriteriaOperator.Parse("")) is null)
            {
                throw new ArgumentNullException("TabEAPPPipe vazia!");
            }

            if (uow.FindObject <TabPercInspecao>(CriteriaOperator.Parse("")) is null)
            {
                throw new ArgumentNullException("TabPercInspecao vazia!");
            }

            if (uow.FindObject <TabProcessoSoldagem>(CriteriaOperator.Parse("")) is null)
            {
                throw new ArgumentNullException("TabProcessoSoldagem vazia!");
            }

            if (uow.FindObject <TabSchedule>(CriteriaOperator.Parse("")) is null)
            {
                throw new ArgumentNullException("TabSchedule vazia!");
            }

            var TotalDeJuntas = dtSpoolsImport.Rows.Count;

            var oldSpools = Utils.GetOldDatasForCheck <Spool>(uow);

            progress.Report(new ImportProgressReport
            {
                TotalRows     = TotalDeJuntas,
                CurrentRow    = 0,
                MessageImport = "Inicializando importação"
            });

            uow.BeginTransaction();

            for (int i = 0; i < TotalDeJuntas; i++)
            {
                if (i >= 7)
                {
                    var linha      = dtSpoolsImport.Rows[i];
                    var contrato   = uow.FindObject <Contrato>(new BinaryOperator("NomeDoContrato", linha[0].ToString()));
                    var documento  = linha[2].ToString();
                    var isometrico = linha[9].ToString();
                    var tagSpool   = $"{Convert.ToString(linha[9])}-{Convert.ToString(linha[10])}";

                    var criteriaOperator = CriteriaOperator.Parse("Contrato.Oid = ? And Documento = ? And Isometrico = ? And TagSpool = ?",
                                                                  contrato.Oid, documento, isometrico, tagSpool);

                    var spool = uow.FindObject <Spool>(criteriaOperator);

                    if (spool == null)
                    {
                        spool = new Spool(uow);
                    }
                    else
                    {
                        oldSpools.FirstOrDefault(x => x.Oid == spool.Oid).DataExist = true;
                    }

                    //var spool = objectSpace.CreateObject<Spool>();
                    spool.Contrato             = contrato;
                    spool.SiteFabricante       = linha[8].ToString();
                    spool.ArranjoFisico        = linha[1].ToString();
                    spool.Documento            = documento;
                    spool.CampoAuxiliar        = linha[3].ToString();
                    spool.SubSop               = linha[4].ToString();
                    spool.AreaFisica           = Convert.ToString(linha[5]);
                    spool.Sth                  = Convert.ToString(linha[6]);
                    spool.Linha                = Convert.ToString(linha[7]);
                    spool.Isometrico           = isometrico;
                    spool.TagSpool             = tagSpool;
                    spool.RevSpool             = Convert.ToString(linha[11]);
                    spool.RevIso               = Convert.ToString(linha[12]);
                    spool.Material             = Convert.ToString(linha[13]);
                    spool.Norma                = Convert.ToString(linha[14]);
                    spool.Diametro             = Utils.ConvertINT(linha[15]);
                    spool.DiametroPolegada     = Convert.ToString(linha[16]);
                    spool.Espessura            = Utils.ConvertINT(linha[17]);
                    spool.Espec                = Convert.ToString(linha[18]);
                    spool.PNumber              = Convert.ToString(linha[19]);
                    spool.Fluido               = Convert.ToString(linha[20]);
                    spool.TipoIsolamento       = Convert.ToString(linha[21]);
                    spool.CondicaoPintura      = Convert.ToString(linha[22]);
                    spool.Comprimento          = Convert.ToDouble(linha[23]);
                    spool.PesoFabricacao       = Convert.ToDouble(linha[24]);
                    spool.Area                 = Convert.ToString(linha[25]);
                    spool.EspIsolamento        = Convert.ToString(linha[26]);
                    spool.QuantidadeIsolamento = Utils.ConvertINT(linha[27]);
                    spool.TotaldeJuntas        = Utils.ConvertINT(linha[28]);
                    spool.TotaldeJuntasPipe    = Utils.ConvertINT(linha[29]);
                    spool.DataCadastro         = Utils.ConvertDateTime(linha[30]);
                    spool.NrProgFab            = linha[31].ToString();
                    spool.DataProgFab          = Utils.ConvertDateTime(linha[32]);
                    spool.DataCorte            = Utils.ConvertDateTime(linha[33]);
                    spool.DataVaFab            = Utils.ConvertDateTime(linha[34]);
                    spool.DataSoldaFab         = Utils.ConvertDateTime(linha[35]);
                    spool.DataVsFab            = Utils.ConvertDateTime(linha[36]);
                    spool.DataDfFab            = Utils.ConvertDateTime(linha[37]);
                    spool.RelatorioDf          = Convert.ToString(linha[38]);
                    spool.InspetorDf           = Convert.ToString(linha[39]);
                    spool.DataEndFab           = Utils.ConvertDateTime(linha[40]);
                    spool.DataPiFundo          = Utils.ConvertDateTime(linha[41]);
                    spool.InspPinturaFundo     = Convert.ToString(linha[42]);
                    spool.RelatorioPinFundo    = Convert.ToString(linha[43]);
                    spool.RelIndFundo          = Convert.ToString(linha[44]);
                    spool.DataPiIntermediaria  = Utils.ConvertDateTime(linha[45]);
                    spool.InspPiIntermediaria  = Convert.ToString(linha[46]);
                    spool.RelPiIntermediaria   = Convert.ToString(linha[47]);
                    spool.RelIndIntermediaria  = Convert.ToString(linha[48]);
                    spool.DataPiAcabamento     = Utils.ConvertDateTime(linha[49]);
                    spool.InspPintAcabamento   = Convert.ToString(linha[50]);
                    spool.RelPintAcabamento    = Convert.ToString(linha[51]);
                    spool.RelIndPintAcabamento = Convert.ToString(linha[52]);
                    spool.DataPiRevUnico       = Utils.ConvertDateTime(linha[53]);
                    spool.InspPiRevUnico       = Convert.ToString(linha[54]);
                    spool.RelPiRevUnico        = Convert.ToString(linha[55]);
                    spool.DataPintFab          = Utils.ConvertDateTime(linha[56]);
                    spool.ProgMontagem         = Convert.ToString(linha[57]);
                    spool.Elevacao             = Convert.ToString(linha[58]);
                    spool.ProgPintura          = Convert.ToString(linha[59]);
                    spool.EscopoMontagem       = Convert.ToString(linha[60]);
                    spool.DataPreMontagem      = Utils.ConvertDateTime(linha[61]);
                    spool.DataVaMontagem       = Utils.ConvertDateTime(linha[62]);
                    spool.DataSoldaMontagem    = Utils.ConvertDateTime(linha[63]);
                    spool.DataVsMontagem       = Utils.ConvertDateTime(linha[64]);
                    spool.InspDiMontagem       = Convert.ToString(linha[65]);
                    spool.DataDiMontagem       = Utils.ConvertDateTime(linha[66]);
                    spool.DataEndMontagem      = Utils.ConvertDateTime(linha[67]);
                    spool.DataPintMontagem     = Utils.ConvertDateTime(linha[68]);
                    spool.TagComponente        = Convert.ToString(linha[69]);
                    spool.IdComponente         = Convert.ToString(linha[70]);
                    spool.Romaneio             = Convert.ToString(linha[71]);
                    spool.DataRomaneio         = Utils.ConvertDateTime(linha[72]);
                    spool.DataLiberacao        = Utils.ConvertDateTime(linha[73]);
                    spool.PesoMontagem         = Utils.ConvertDouble(linha[74]);
                    spool.SituacaoFabricacao   = Convert.ToString(linha[75]);
                    spool.SituacaoMontagem     = Convert.ToString(linha[76]);
                    //spool.DataLineCheck = Utils.ConvertDateTime(linha[75]);
                }


                if (i % 1000 == 0)
                {
                    try
                    {
                        uow.CommitTransaction();
                    }
                    catch
                    {
                        uow.RollbackTransaction();
                        throw new Exception("Process aborted by system");
                    }
                }

                progress.Report(new ImportProgressReport
                {
                    TotalRows     = TotalDeJuntas,
                    CurrentRow    = i + 1,
                    MessageImport = $"Importando linha {i}/{TotalDeJuntas}"
                });
            }

            uow.CommitTransaction();
            uow.PurgeDeletedObjects();
            uow.CommitChanges();
            uow.Dispose();

            progress.Report(new ImportProgressReport
            {
                TotalRows     = TotalDeJuntas,
                CurrentRow    = TotalDeJuntas,
                MessageImport = $"Gravando Alterações no Banco"
            });


            // Implatar funcionalidade
            //var excluirSpoolsNaoImportado = oldSpools.Where(x => x.DataExist = false);
        }