示例#1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            /****************************************************************************/
            // * WARNING TO DEVELOPERS
            // * The redirect below is a SAFETY feature.  Removing the redirect will not
            // * enable ML-only features on a lower version of AspDotNetStorefront.
            // * Attempting to do so can very easily result in a partially implemented
            // * feature, invalid or incomplete data in your DB, and other serious
            // * conditions that will cause your store to be non-functional.
            // *
            // * If you break your store attempting to enable ML-only features in PRO or
            // * Standard, our staff cannot help you fix it, and it will also invalidate
            // * your AspDotNetStorefront License.
            /***************************************************************************/

            if (!AppLogic.m_ProductIsML())
            {
                Response.Redirect(AppLogic.AdminLinkUrl("restrictedfeature.aspx"));
            }

            Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;
            string   PostedFormat = Request.Form["Format"];

            if (!IsNum(PostedFormat))
            {
                PostedFormat = Request.QueryString["Format"];
            }
            if (!IsNum(PostedFormat))
            {
                DataTable efl = ShippingImportCls.GetExportFormatList();
                ShowList(efl);
                efl.Dispose();
                return;
            }
            else
            {
                Int16  fmtID    = Int16.Parse(PostedFormat);
                string exp      = ShippingImportCls.ExportShippingString(fmtID);
                string filename = ShippingImportCls.GetExportFilename(fmtID);
                Response.ContentType     = "text/csv";
                Response.ContentEncoding = Encoding.UTF8;
                Response.AddHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
                Response.Write(exp);
            }
        }
示例#2
0
        string GetRTS(bool filterunpaid) // Show All New Orders Ready to Ship
        {
            StringBuilder outsb = new StringBuilder(4096);

            string sqltxt = "select * from Orders  with (NOLOCK)  where ShippedOn IS NULL and IsNew=1 and TransactionState=" + DB.SQuote(AppLogic.ro_TXStateCaptured) + " ";

            if (filterunpaid)
            {
                sqltxt += " AND (TransactionState = " + DB.SQuote(AppLogic.ro_TXStateCaptured) + ")";
            }

            using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
            {
                con.Open();
                using (IDataReader rsOrders = DB.GetRS(sqltxt, con))
                {
                    outsb.Append("<table border=\"0\" cellpadding=\"2\" border=\"0\" cellspacing=\"1\" width=\"100%\">");
                    outsb.Append("<tr class=\"gridHeader\">");
                    outsb.Append("<td><b>OrderNumber</b></td>");
                    outsb.Append("<td><b>OrderTotal</b></td>");
                    outsb.Append("<td><b>Transaction State</b></td>");
                    outsb.Append("<td><b>Shipping Method</b></td>");
                    outsb.Append("</tr>");

                    int recordcount = 0;

                    StringBuilder orderRow = new StringBuilder(4096);

                    while (rsOrders.Read())
                    {
                        recordcount += 1;

                        orderRow.Append("<tr>");
                        orderRow.Append("<td><a href=\"" + AppLogic.AdminLinkUrl("orderframe.aspx") + "?ordernumber=" + rsOrders["OrderNumber"].ToString() + "\">" + rsOrders["OrderNumber"].ToString() + "</td>");
                        orderRow.Append("<td>" + String.Format("{0:c}", rsOrders["OrderTotal"]) + "</td>");
                        orderRow.Append("<td>" + rsOrders["TransactionState"].ToString() + "</td>");
                        orderRow.Append("<td>" + rsOrders["ShippingMethod"].ToString() + "</td>");
                        orderRow.Append("</tr>\n");
                    }


                    if (recordcount > 0)
                    {
                        //exists
                        outsb.Append(orderRow.ToString());
                        outsb.Append("<tr>");
                        outsb.Append("<td colspan=4><b>" + recordcount.ToString() + " Orders<b></td>");
                        outsb.Append("</tr>\n");
                        outsb.Append("</table>");
                    }
                    else
                    {
                        //nothing
                        outsb.Append("<tr>");
                        outsb.Append("<td colspan=4><b>No Orders</b></td>");
                        outsb.Append("</tr>");
                        outsb.Append("</table>");
                    }

                    outsb.Append("<p>Export New Orders: ");
                    DataTable efl = ShippingImportCls.GetExportFormatList();
                    foreach (DataRow ef in efl.Rows)
                    {
                        outsb.Append("<a href=\"" + AppLogic.AdminLinkUrl("shippingexport.aspx") + "?format=" + ef["id"] + "\">" + ef["Name"] + "</a> &nbsp;");
                    }
                    outsb.Append("<br/>");

                    outsb.Append("<p>Import Shipped Orders: ");
                    outsb.Append("<a href=\"" + AppLogic.AdminLinkUrl("shippingupload.aspx") + "\">Upload Shipping Log</a><br/>");
                }
            }

            return(outsb.ToString());
        }