Ejemplo n.º 1
0
        protected void download_Click(object sender, EventArgs e)
        {
            LinkButton lnk = (LinkButton)sender;
            string     PO  = lnk.CommandArgument.ToString();

            using (var context = new YETIEntities())
            {
                ReportDocument cryRpt = new ReportDocument();
                cryRpt.Load(Server.MapPath("~/Reports/RWO.rpt"));

                cryRpt.SetDataSource(context.cqf_workOrder.Where(w => w.fs_workOrder == PO).ToList());
                crystalReportViewer1.ReportSource = cryRpt;

                crystalReportViewer1.RefreshReport();
                cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Server.MapPath("~/Reports/RWO.pdf"));

                cqf_logActividad log = new cqf_logActividad();
                log.fdt_fecha    = DateTime.Now;
                log.fi_idUsuario = int.Parse(Session["UserID"].ToString());
                log.fs_actividad = "Download Report Work Order:" + PO;

                context.cqf_logActividad.Add(log);
                context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        protected void lnkInicio_Click(object sender, EventArgs e)
        {
            string pass = Seguridad.Encriptar(inputPassword.Value);

            using (var context = new YETIEntities())
            {
                int users = context.cqc_usuarios.Where(w => w.cb_active == true && w.cs_correo == inputEmail.Value && w.cs_contrasena == pass).Count();

                if (users > 0)
                {
                    Session["UserID"] = context.cqc_usuarios.Where(w => w.cb_active == true && w.cs_correo == inputEmail.Value && w.cs_contrasena == pass).Select(c => c.ci_id).First().ToString();

                    cqf_logActividad log = new cqf_logActividad();
                    log.fdt_fecha    = DateTime.Now;
                    log.fi_idUsuario = int.Parse(Session["UserID"].ToString());
                    log.fs_actividad = "Sign In ";

                    context.cqf_logActividad.Add(log);
                    context.SaveChanges();


                    Response.Redirect("Inicio.aspx");
                }

                else
                {
                    //Usuario o Contraseña equivocados
                }
            }
        }
Ejemplo n.º 3
0
        protected void yes_Click(object sender, EventArgs e)
        {
            using (var context = new YETIEntities())
            {
                var result = context.cqf_workOrder.Where(w => w.fs_workOrder == txtWorkOrder.Text && w.fc_status == "A").ToList();

                var resul2 = context.cqf_WorkOrderMaster.Where(w => w.fs_workOrder == txtWorkOrder.Text && w.fc_status == "A").ToList();
                if (result != null)
                {
                    foreach (cqf_workOrder s in result)
                    {
                        s.fc_status = "C";
                        context.SaveChanges();

                        cqf_logActividad log = new cqf_logActividad();
                        log.fdt_fecha    = DateTime.Now;
                        log.fi_idUsuario = int.Parse(Session["UserID"].ToString());
                        log.fs_actividad = "Cancel Work Order: " + txtWorkOrder;

                        context.cqf_logActividad.Add(log);
                        context.SaveChanges();
                    }
                    foreach (cqf_WorkOrderMaster s in resul2)
                    {
                        s.fc_status = "C";
                        context.SaveChanges();

                        cqf_logActividad log = new cqf_logActividad();
                        log.fdt_fecha    = DateTime.Now;
                        log.fi_idUsuario = int.Parse(Session["UserID"].ToString());
                        log.fs_actividad = "Cancel Work Order Master: " + txtWorkOrder;

                        context.cqf_logActividad.Add(log);
                        context.SaveChanges();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        protected void UploadWO_Click(object sender, EventArgs e)
        {
            if (txtWorkOrder.Text != "" && txtWorkOrderDate.Text != "")
            {
                string[]            WODate = txtWorkOrderDate.Text.Split('-');
                cqf_WorkOrderMaster wom    = new cqf_WorkOrderMaster();
                wom.fc_status            = "A";
                wom.fs_workOrder         = txtWorkOrder.Text;
                wom.fdt_date             = new DateTime(int.Parse(WODate[0]), int.Parse(WODate[1]), int.Parse(WODate[2]));
                wom.fs_shipperUpsAccount = txtshipperAccount.Text;
                wom.fs_reference         = txtReference.Text;
                wom.fs_name                 = txtName.Text;
                wom.fs_telephone            = txtTelephone.Text;
                wom.fs_company              = txtCompany.Text;
                wom.fs_streetAddress        = txtsa.Text;
                wom.fs_cityState            = txtcs.Text;
                wom.fs_deliverToName        = txtDelName.Text;
                wom.fs_deliverPhone         = txtDelPhone.Text;
                wom.fs_deliverCompany       = txtDelCom.Text;
                wom.fs_deliverStreetAddress = txtDelSA.Text;
                wom.fs_deliverCityState     = txtDelCS.Text;
                try { wom.fd_weightLbs = double.Parse(txtWeight.Text); } catch { wom.fd_weightLbs = 0.00; }
                try { wom.fd_dimentionalWeight = double.Parse(txtDimentional.Text); } catch { wom.fd_dimentionalWeight = 0.00; }
                try { wom.fd_largePackage = double.Parse(txtLarge.Text); } catch { wom.fd_largePackage = 0.00; }
                wom.fs_shipperRelease = txtShipper.Text;
                try { wom.fd_groundSdpShippingCharges = decimal.Parse(txtGroud.Text); } catch { wom.fd_groundSdpShippingCharges = decimal.Parse("0.00"); }
                try { wom.fd_declareValueCarriage = decimal.Parse(txtDeclare.Text); } catch { wom.fd_declareValueCarriage = decimal.Parse("0.00"); }
                try { wom.fd_amount = decimal.Parse(txtAmount.Text); } catch { wom.fd_amount = decimal.Parse("0.00"); }
                try { wom.fd_aditionalHandlingCharge = decimal.Parse(txtAditional.Text); } catch { wom.fd_aditionalHandlingCharge = decimal.Parse("0.00"); }
                try { wom.fd_totalCharges = decimal.Parse(txtTotal.Text); } catch { wom.fd_totalCharges = decimal.Parse("0.00"); }
                wom.fb_billShipperAccountNumber = rbtn_shipAcc.Checked;
                wom.fb_billShipperAccountNumber = rbtn_billReceiver.Checked;
                wom.fb_billThirdParty           = rbtn_billThirdParty.Checked;
                wom.fb_billCreditCard           = rbtn_CreditCard.Checked;

                wom.fs_receiversThirdPartyUpsAcct = txtUpsAcct.Text;
                wom.fs_thirdPartCompanyName       = txtThirdCN.Text;
                wom.fs_thirdCityState             = txtThirdCS.Text;
                wom.fs_thirdStreetAddress         = txtThirdSA.Text;

                context.cqf_WorkOrderMaster.Add(wom);
                context.SaveChanges();


                List <cqf_workOrder> SBs = new List <cqf_workOrder>();
                using (var stream = File.Open(Server.MapPath("~/WorkOrders/" + txtWorkOrder.Text + ".xls"), FileMode.Open, FileAccess.Read))
                {
                    using (var reader = ExcelDataReader.ExcelReaderFactory.CreateReader(stream))
                    {
                        while (reader.Read())
                        {
                            if (reader.Depth >= 1)
                            {
                                //reader.NextResult();
                                try
                                {
                                    string[]      ShipDate = txtWorkOrderDate.Text.Split('-');
                                    cqf_workOrder s        = new cqf_workOrder();
                                    s.fc_status    = "A";
                                    s.fs_workOrder = txtWorkOrder.Text;
                                    try { s.fs_sku = reader.GetDouble(0).ToString(); } catch { s.fs_sku = reader.GetString(0).ToString(); }
                                    try { s.fs_paintCode = reader.GetDouble(1).ToString(); } catch { s.fs_paintCode = reader.GetString(1).ToString(); }
                                    s.fs_engraving = reader.GetString(2);
                                    s.fdt_date     = new DateTime(int.Parse(ShipDate[0]), int.Parse(ShipDate[1]), int.Parse(ShipDate[2]));
                                    s.fi_qty       = int.Parse(reader.GetDouble(3).ToString());

                                    if (s.fs_sku == null)
                                    {
                                        reader.NextResult();
                                    }
                                    else
                                    {
                                        using (var context = new YETIEntities())
                                        {
                                            context.cqf_workOrder.Add(s);
                                            context.SaveChanges();
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.Write(ex.Message);
                                }
                            }
                        }
                        using (var context = new YETIEntities())
                        {
                            cqf_logActividad log = new cqf_logActividad();
                            log.fdt_fecha    = DateTime.Now;
                            log.fi_idUsuario = int.Parse(Session["UserID"].ToString());
                            log.fs_actividad = "Add Work Order: " + txtWorkOrder.Text;

                            context.cqf_logActividad.Add(log);
                            context.SaveChanges();
                        }

                        Response.Redirect("Inicio.aspx");
                    }
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal2();", true);
            }
        }
Ejemplo n.º 5
0
        protected void lnkInsertar_Click(object sender, EventArgs e)
        {
            List <SouthBound> SBs = new List <SouthBound>();

            using (var stream = File.Open(Server.MapPath("~/Southbound/" + txtPO.Text + ".xls"), FileMode.Open, FileAccess.Read))
            {
                using (var reader = ExcelDataReader.ExcelReaderFactory.CreateReader(stream))
                {
                    while (reader.Read())
                    {
                        if (reader.Depth >= 1)
                        {
                            //reader.NextResult();

                            try
                            {
                                string[]   date     = txtDate.Text.Split('-');
                                string[]   ShipDate = txtShipDate.Text.Split('-');
                                SouthBound s        = new SouthBound();
                                s.fc_status          = "A";
                                s.fs_invoice         = txtInvoice.Text;
                                s.fs_trucker         = txtTrucker.Text;
                                s.fd_date            = new DateTime(int.Parse(date[0]), int.Parse(date[1]), int.Parse(date[2]));
                                s.fs_tracking        = txtTracking.Text;
                                s.fs_productionOrder = txtPO.Text;
                                s.fs_reference       = txtReference.Text;
                                s.fi_exportRecords   = int.Parse(ddlsexport.SelectedItem.Value);
                                s.fs_exportRecords   = ddlsexport.SelectedItem.Text;
                                s.fi_importRecords   = int.Parse(ddlsimport.SelectedItem.Value);
                                s.fs_importRecords   = ddlsimport.SelectedItem.Text;
                                s.fi_shipper         = int.Parse(ddlsShippers.SelectedItem.Value);
                                s.fs_shipper         = ddlsShippers.SelectedItem.Text;
                                s.fi_shipTo          = int.Parse(ddlsShipTo.SelectedItem.Value);
                                s.fs_shipTo          = ddlsShipTo.SelectedItem.Text;
                                s.fs_moneda          = ddlsCurrency.SelectedItem.Text;
                                s.fs_incoterms       = ddlsIncoterms.SelectedItem.Text;
                                s.fd_shipDate        = new DateTime(int.Parse(ShipDate[0]), int.Parse(ShipDate[1]), int.Parse(ShipDate[2]));
                                try { s.fs_partNumber = reader.GetString(0); } catch { s.fs_partNumber = reader.GetDouble(0).ToString(); }
                                s.fs_description    = reader.GetString(1);
                                s.fs_scheduleHsCode = reader.GetString(2);
                                s.fs_coo            = reader.GetString(3);
                                s.fi_qty            = int.Parse(reader.GetDouble(4).ToString());
                                s.fd_totalWeightLbs = reader.GetDouble(5);
                                s.fd_totalWeightKgs = reader.GetDouble(6);
                                s.fd_unitPrice      = decimal.Parse(reader.GetDouble(7).ToString());
                                s.fd_exitPrice      = decimal.Parse(reader.GetDouble(8).ToString());
                                if (s.fs_partNumber == null)
                                {
                                    reader.NextResult();
                                }
                                else
                                {
                                    using (var context = new YETIEntities())
                                    {
                                        context.SouthBounds.Add(s);
                                        context.SaveChanges();
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.Write(ex.Message);
                            }
                        }
                    }
                    using (var context = new YETIEntities())
                    {
                        cqf_logActividad log = new cqf_logActividad();
                        log.fdt_fecha    = DateTime.Now;
                        log.fi_idUsuario = int.Parse(Session["UserID"].ToString());
                        log.fs_actividad = "Add Production Order: " + txtPO.Text;

                        context.cqf_logActividad.Add(log);
                        context.SaveChanges();
                    }
                }
            }

            Response.Redirect("SouthBoundList.aspx");
        }