Пример #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();
            }
        }
Пример #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
                }
            }
        }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (var context = new YETIEntities())
     {
         rgNombres.DataSource = context.cqc_imports.ToList();
         rgNombres.DataBind();
     }
 }
Пример #4
0
 protected void rgSouthBoundList_PageIndexChanged(object sender, Telerik.Web.UI.GridPageChangedEventArgs e)
 {
     using (var context = new YETIEntities())
     {
         var list = context.cqf_immexTransfer.ToList();
         rgSouthBoundList.DataSource = list.OrderByDescending(o => o.fi_id).ToList();
         rgSouthBoundList.DataBind();
     }
 }
Пример #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (var context = new YETIEntities())
     {
         rgSKUs.DataSource = context.cqc_skus.ToList();
         rgSKUs.DataBind();
         //ddlsexport.DataSource = context.cqc_exports.Where(c => c.ci_id >= 1).ToList();
         //ddlsexport.DataBind();
     }
 }
Пример #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         using (var context = new YETIEntities())
         {
             rgMails.DataSource = context.cqc_usuarios.ToList();
             rgMails.DataBind();
         }
     }
 }
Пример #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         using (var context = new YETIEntities())
         {
             var list = context.cqf_immexTransfer.ToList();
             rgSouthBoundList.DataSource = list.OrderByDescending(o => o.fi_id).ToList();
             rgSouthBoundList.DataBind();
         }
     }
 }
Пример #8
0
 protected void rgSouthBoundList_PageIndexChanged(object sender, Telerik.Web.UI.GridPageChangedEventArgs e)
 {
     using (var context = new YETIEntities())
     {
         var list = from g in context.SouthBounds
                    where g.fc_status == "A"
                    group g by new { g.fs_productionOrder, g.fs_reference, g.fs_trucker, g.fs_invoice, g.fs_tracking, g.fd_date } into gr
             select new { gr.Key.fs_productionOrder, gr.Key.fs_reference, gr.Key.fs_trucker, gr.Key.fs_invoice, gr.Key.fs_tracking, gr.Key.fd_date };
         rgSouthBoundList.DataSource = list.OrderByDescending(o => o.fd_date).ToList();
         rgSouthBoundList.DataBind();
     }
 }
Пример #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         using (var context = new YETIEntities())
         {
             var list = from g in context.cqf_workOrder where g.fc_status == "A"
                        group g by new { g.fs_workOrder, g.fdt_date } into gr
    select new { gr.Key.fs_workOrder
                 , gr.Key.fdt_date };
             rgSouthBoundList.DataSource = list.OrderByDescending(o => o.fdt_date).ToList();
             rgSouthBoundList.DataBind();
         }
     }
 }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                using (var context = new YETIEntities())
                {
                    var list = from g in context.NorthBounds
                               where g.fc_status == "A"
                               group g by new { g.fs_invoiceNumber, g.fs_upsTracking, g.fdt_invoiceDate, g.fs_trailerNumber, g.fs_sealNumber, g.fi_exportOfRecord, g.fi_importer, g.fi_shipper, g.fi_shipTo, g.fs_incoterm, g.fs_shipVia, g.fdt_shipDate, g.fd_totalWeight, g.fd_totalAmount } into gr
           select new { gr.Key.fs_invoiceNumber, gr.Key.fs_upsTracking, gr.Key.fdt_invoiceDate, gr.Key.fs_trailerNumber, gr.Key.fs_sealNumber, gr.Key.fi_exportOfRecord, gr.Key.fi_importer, gr.Key.fi_shipper, gr.Key.fi_shipTo, gr.Key.fs_incoterm, gr.Key.fs_shipVia, gr.Key.fdt_shipDate, gr.Key.fd_totalWeight, gr.Key.fd_totalAmount };

                    rgSouthBoundList.DataSource = list.OrderByDescending(o => o.fdt_invoiceDate).ToList();
                    rgSouthBoundList.DataBind();
                }
            }
        }
Пример #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         using (var context = new YETIEntities())
         {
             ddlsexport.DataSource = context.cqc_exports.Where(c => c.ci_id >= 1).ToList();
             ddlsexport.DataBind();
             ddlsimport.DataSource = context.cqc_imports.ToList();
             ddlsimport.DataBind();
             ddlsShippers.DataSource = context.cqc_shippers.ToList();
             ddlsShippers.DataBind();
             ddlsShipTo.DataSource = context.cqc_shipto.ToList();
             ddlsShipTo.DataBind();
         }
     }
 }
Пример #12
0
        protected void rgSouthBoundList_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "Download")
            {
                string PO = e.CommandArgument.ToString();
                using (var context = new YETIEntities())
                {
                    ReportDocument cryRpt = new ReportDocument();
                    cryRpt.Load(Server.MapPath("~/Reports/RNB.rpt"));

                    var t = context.NorthBounds.Where(w => w.fs_invoiceNumber == PO & w.fc_status == "A").Select(c => new { c.fs_SKU, c.fs_descYeti, c.fs_hsCodeYeti, c.fs_COOYeti, c.fi_qtyYeti, c.fd_unitPriceYeti, c.fd_extPriceYeti, c.fs_descSP, c.fs_hsCodeSP, c.fs_COOSP, c.fd_unitPriceSP, c.fd_extPriceSP, c.fd_totalEnteredValue }).ToList();

                    var list = (from g in context.NorthBounds
                                where g.fc_status == "A" && g.fs_invoiceNumber == PO
                                group g by new { g.fs_invoiceNumber, g.fs_upsTracking, g.fdt_invoiceDate, g.fs_trailerNumber, g.fs_sealNumber, g.fi_exportOfRecord, g.fi_importer, g.fi_shipper, g.fi_shipTo, g.fs_incoterm, g.fs_shipVia, g.fdt_shipDate, g.fd_totalWeight, g.fd_totalAmount } into gr
                                select new { gr.Key.fs_invoiceNumber, gr.Key.fs_upsTracking, gr.Key.fdt_invoiceDate, gr.Key.fs_trailerNumber, gr.Key.fs_sealNumber, gr.Key.fi_exportOfRecord, gr.Key.fi_importer, gr.Key.fi_shipper, gr.Key.fi_shipTo, gr.Key.fs_incoterm, gr.Key.fs_shipVia, gr.Key.fdt_shipDate, gr.Key.fd_totalWeight, gr.Key.fd_totalAmount }).ToList();

                    var exportid  = context.NorthBounds.Where(w => w.fs_invoiceNumber == PO & w.fc_status == "A").Select(s => s.fi_exportOfRecord).FirstOrDefault();
                    var importid  = context.NorthBounds.Where(w => w.fs_invoiceNumber == PO & w.fc_status == "A").Select(s => s.fi_importer).FirstOrDefault();
                    var shipperid = context.NorthBounds.Where(w => w.fs_invoiceNumber == PO & w.fc_status == "A").Select(s => s.fi_shipper).FirstOrDefault();
                    var shiptoid  = context.NorthBounds.Where(w => w.fs_invoiceNumber == PO & w.fc_status == "A").Select(s => s.fi_shipTo).FirstOrDefault();

                    var ex = context.cqc_exports.Where(w => w.ci_id == importid).ToList();
                    var im = context.cqc_imports.Where(w => w.ci_id == exportid).ToList();
                    var sp = context.cqc_shippers.Where(w => w.ci_id == shiptoid).ToList();
                    var st = context.cqc_shipto.Where(w => w.ci_id == shipperid).ToList();


                    cryRpt.Database.Tables["DataTable3"].SetDataSource(ex);
                    cryRpt.Database.Tables["DataTable4"].SetDataSource(im);
                    cryRpt.Database.Tables["DataTable5"].SetDataSource(sp);
                    cryRpt.Database.Tables["DataTable6"].SetDataSource(st);
                    cryRpt.Database.Tables["DataTable7"].SetDataSource(t);
                    cryRpt.Database.Tables["DataTable8"].SetDataSource(list);


                    crystalReportViewer1.ReportSource = cryRpt;

                    crystalReportViewer1.RefreshReport();
                    cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Server.MapPath("~/Reports/RNorthBound" + PO + ".pdf"));
                    cryRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, HttpContext.Current.Response, true, "RNorthBound" + PO);
                    Response.Redirect("NorthBoundList.aspx");
                }
            }
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int usuario;

            if (!IsPostBack)
            {
                try
                {
                    usuario = int.Parse(Session["UserID"].ToString());
                    using (var context = new YETIEntities())
                    {
                        var user = context.cqc_usuarios.Where(c => c.ci_id == usuario).First();

                        if (!user.cb_southBound)
                        {
                            sb.Visible = false;
                        }
                        if (!user.cb_northBount)
                        {
                            nb.Visible = false;
                        }
                        if (!user.cb_masters)
                        {
                            ms.Visible = false;
                        }
                        if (!user.cb_workOrder)
                        {
                            work.Visible = false;
                        }
                        if (!user.cb_scrap)
                        {
                            scraping.Visible = false;
                        }
                        if (!user.cb_balance)
                        {
                            balance.Visible = false;
                        }
                    }
                }
                catch { Response.Redirect("Login.aspx"); }
            }
        }
Пример #14
0
        protected void rgSouthBoundList_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "Download")
            {
                string PO = e.CommandArgument.ToString();
                using (var context = new YETIEntities())
                {
                    ReportDocument cryRpt = new ReportDocument();
                    cryRpt.Load(Server.MapPath("~/Reports/RSB.rpt"));

                    var t = context.SouthBounds.Where(w => w.fs_productionOrder == PO & w.fc_status == "A").Select(c => new { c.fs_partNumber, c.fs_description, c.fs_scheduleHsCode, c.fs_coo, c.fi_qty, c.fd_totalWeightKgs, c.fd_totalWeightLbs, c.fd_unitPrice, c.fd_exitPrice }).ToList();


                    var master    = context.MasterInvoiceSBs.Where(w => w.fs_productionOrder == PO).Select(c => new { c.fc_status, c.fs_invoice, c.fs_trucker, c.fs_tracking, c.fd_date, c.fs_productionOrder, c.fs_reference, c.fs_moneda, c.fd_totalWeightKgs, c.fs_totalWightLbs, c.fd_exitPrice }).ToList();
                    var exportid  = context.SouthBounds.Where(w => w.fs_productionOrder == PO & w.fc_status == "A").Select(s => s.fi_exportRecords).FirstOrDefault();
                    var importid  = context.SouthBounds.Where(w => w.fs_productionOrder == PO & w.fc_status == "A").Select(s => s.fi_importRecords).FirstOrDefault();
                    var shipperid = context.SouthBounds.Where(w => w.fs_productionOrder == PO & w.fc_status == "A").Select(s => s.fi_shipper).FirstOrDefault();
                    var shiptoid  = context.SouthBounds.Where(w => w.fs_productionOrder == PO & w.fc_status == "A").Select(s => s.fi_shipTo).FirstOrDefault();

                    var ex = context.cqc_exports.Where(w => w.ci_id == exportid).ToList();
                    var im = context.cqc_imports.Where(w => w.ci_id == importid).ToList();
                    var sp = context.cqc_shippers.Where(w => w.ci_id == shipperid).ToList();
                    var st = context.cqc_shipto.Where(w => w.ci_id == shiptoid).ToList();

                    cryRpt.Database.Tables["DataTable1"].SetDataSource(t);
                    cryRpt.Database.Tables["DataTable2"].SetDataSource(master);
                    cryRpt.Database.Tables["DataTable3"].SetDataSource(ex);
                    cryRpt.Database.Tables["DataTable4"].SetDataSource(im);
                    cryRpt.Database.Tables["DataTable5"].SetDataSource(sp);
                    cryRpt.Database.Tables["DataTable6"].SetDataSource(st);


                    crystalReportViewer1.ReportSource = cryRpt;

                    crystalReportViewer1.RefreshReport();
                    cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Server.MapPath("~/Reports/RSouthBound" + PO + ".pdf"));
                    cryRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, HttpContext.Current.Response, true, "RSouthBound" + PO + ".pdf");
                    Response.Redirect("Inicio.aspx");
                }
            }
        }
Пример #15
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();
                    }
                }
            }
        }
Пример #16
0
        protected void rgSouthBoundList_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "Download")
            {
                string WO = e.CommandArgument.ToString();
                using (var context = new YETIEntities())
                {
                    ReportDocument cryRpt = new ReportDocument();
                    cryRpt.Load(Server.MapPath("~/Reports/RWO.rpt"));

                    //   var t = context.cqf_workOrder.Where(w => w.fs_workOrder == WO & w.fc_status=="A").Select(c=> new { c.fs_sku, c.fs_paintCode, c.fs_engraving, c.fi_qty}).ToList();


                    var master = from w in context.cqf_WorkOrderMaster
                                 where w.fc_status == "A" && w.fs_workOrder == WO

                                 select new
                    {
                        w.fs_workOrder,
                        w.fdt_date,
                        w.fs_shipperUpsAccount,
                        w.fs_reference,
                        w.fs_name,
                        w.fs_telephone,
                        w.fs_company,
                        w.fs_streetAddress,
                        w.fs_cityState,
                        w.fs_deliverToName,
                        w.fs_deliverPhone,
                        w.fs_deliverCompany,
                        w.fs_deliverStreetAddress,
                        w.fs_deliverCityState,
                        w.fd_weightLbs,
                        w.fd_dimentionalWeight,
                        w.fd_largePackage,
                        w.fs_shipperRelease,
                        w.fd_groundSdpShippingCharges,
                        w.fd_declareValueCarriage,
                        w.fd_amount,
                        w.fd_aditionalHandlingCharge,
                        w.fd_totalCharges,
                        w.fb_billShipperAccountNumber,
                        w.fb_billReceiver,
                        w.fb_billThirdParty,
                        w.fb_billCreditCard,
                        w.fs_receiversThirdPartyUpsAcct,
                        w.fs_thirdPartCompanyName,
                        w.fs_thirdStreetAddress,
                        w.fs_thirdCityState
                    };

                    var content = context.cqf_workOrder.Where(w => w.fs_workOrder == WO && w.fc_status == "A").Select(c => new { c.fs_sku, c.fs_paintCode, c.fs_engraving, c.fi_qty }).ToList();


                    cryRpt.Database.Tables["DataTable1"].SetDataSource(master);
                    cryRpt.Database.Tables["DataTable2"].SetDataSource(content);


                    crystalReportViewer1.ReportSource = cryRpt;

                    crystalReportViewer1.RefreshReport();
                    cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Server.MapPath("~/Reports/RWO" + WO + ".pdf"));
                    cryRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, HttpContext.Current.Response, true, "RWO" + WO);
                    Response.Redirect("Inicio.aspx");
                }
            }
        }
Пример #17
0
        protected void uploadinformation_Click(object sender, EventArgs e)
        {
            List <NorthBound> SBs = new List <NorthBound>();

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

                            try
                            {
                                NorthBound s = new NorthBound();
                                s.fc_status        = "A";
                                s.fdt_invoiceDate  = reader.GetDateTime(0);
                                s.fs_invoiceNumber = reader.GetString(1);
                                try { s.fs_trailerNumber = reader.GetString(2); } catch { s.fs_trailerNumber = reader.GetDouble(2).ToString(); }
                                s.fs_sealNumber     = reader.GetString(3);
                                s.fi_exportOfRecord = 1;
                                s.fs_exportOfRecord = "Maquila Solutions Mexico SA de CV";
                                s.fi_importer       = 1;
                                s.fs_importer       = "YETI Coolers, LLC";
                                s.fi_shipper        = 1;
                                s.fs_shipper        = "Maquila Solutions c/o Scanpaint SA de CV";
                                s.fi_shipTo         = 1;
                                s.fs_shipTo         = reader.GetString(7);
                                s.fs_incoterm       = "EXW";
                                s.fdt_shipDate      = reader.GetDateTime(9);
                                s.fs_shipVia        = reader.GetString(10);
                                try { s.fs_SKU = reader.GetString(11); } catch { s.fs_SKU = reader.GetDouble(11).ToString(); }
                                s.fs_descYeti      = reader.GetString(12);
                                s.fs_hsCodeYeti    = reader.GetString(13);
                                s.fs_COOYeti       = "CN";
                                s.fi_qtyYeti       = int.Parse(reader.GetDouble(15).ToString());
                                s.fd_unitPriceYeti = decimal.Parse(reader.GetDouble(16).ToString());
                                s.fd_extPriceYeti  = decimal.Parse(reader.GetDouble(17).ToString());
                                s.fs_descSP        = reader.GetString(18);
                                s.fs_hsCodeSP      = reader.GetString(19);
                                s.fs_COOSP         = "CN";
                                s.fd_unitPriceSP   = decimal.Parse(reader.GetDouble(21).ToString());
                                try { s.fs_WONumber = reader.GetString(22); } catch { s.fs_WONumber = reader.GetDouble(22).ToString(); }
                                try { s.fs_upsTracking = reader.GetString(23); } catch { s.fs_upsTracking = reader.GetDouble(23).ToString(); }
                                s.fd_extPriceSP        = decimal.Parse(reader.GetDouble(24).ToString());
                                s.fd_totalEnteredValue = decimal.Parse(reader.GetDouble(25).ToString());
                                s.fd_totalWeight       = reader.GetDouble(26);
                                s.fd_totalAmount       = decimal.Parse(reader.GetDouble(27).ToString());

                                if (s.fs_descSP == null)
                                {
                                    reader.NextResult();
                                }
                                else
                                {
                                    SBs.Add(s);

                                    /*using (var context = new YETIEntities())
                                     * {
                                     *
                                     *  context.NorthBounds.Add(s);
                                     *  context.SaveChanges();
                                     * }
                                     *
                                     * Response.Redirect("Inicio.aspx");*/
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.Write(ex.Message);
                            }
                        }
                    }
                }
            }

            if (SBs.Count > 0)
            {
                foreach (NorthBound n in SBs)
                {
                    using (var context = new YETIEntities())
                    {
                        context.NorthBounds.Add(n);
                        context.SaveChanges();
                    }
                }

                context.cqf_logActividad.Add(new cqf_logActividad
                {
                    fdt_fecha    = DateTime.Now,
                    fi_idUsuario = int.Parse(Session["UserID"].ToString()),
                    fs_actividad = "Add North Bound"
                });
                context.SaveChanges();

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

            //ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalMensajes2();", true);/
        }
Пример #18
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");
        }
Пример #19
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);
            }
        }