private void RenderContents() { if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) // do update { string outstr = ShippingImportCls.ProcessOrderNoticeEmail(EntityHelpers, GetParser); sql.Append(outstr); } else // show items to update { string outstr = ShippingImportCls.CheckOrderNoticeEmail(); sql.Append(outstr); sql.Append("<script type=\"text/javascript\">\n"); sql.Append("function Form_Validator(theForm)\n"); sql.Append(" {\n"); sql.Append(" return (true);\n"); sql.Append(" }\n"); sql.Append("</script>\n"); sql.Append("<form action=\"\" method=\"post\" onsubmit=\"return (validateForm(this) && Form_Validator(this))\" onReset=\"return confirm('Do you want to reset all fields to their starting values?');\">\n"); sql.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n"); sql.Append("<input type=\"submit\" class=\"normalButtons\" value=\"Send All Email Notices\" name=\"submit\">\n"); sql.Append("</form>\n"); ltContent.Text = sql.ToString(); } }
private void RenderMarkup() { System.Text.StringBuilder output = new System.Text.StringBuilder(); if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) // do something { string ordnum = CommonLogic.FormCanBeDangerousContent("sendemail"); output.Append(ShippingImportCls.ProcessOrderNoticeEmail(ordnum, EntityHelpers, GetParser)); } else // Show Status { bool twostage = true; int s = CommonLogic.QueryStringUSInt("s"); if (s == 4) { twostage = false; } if (twostage) { output.Append("<h3>New Orders:</h3>"); output.Append(GetRTS(false)); output.Append("<hr/>"); } else { output.Append("<h3>New Orders - Waiting on payment:</h3>"); output.Append(GetWOP()); output.Append("<hr/>"); output.Append("<h3>New Orders - Ready to Ship:</h3>"); output.Append(GetRTS(true)); output.Append("<hr/>"); output.Append("<h3>Shipped Orders (Shipping Notice Not Sent):</h3>"); output.Append(GetSWN()); output.Append("<hr/>"); } output.Append("<h3>Shipped:</h3>"); output.Append(GetRSO(!twostage)); } ltContent.Text = output.ToString(); }
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); } }
private void RenderContent() { StringBuilder sql = new StringBuilder(); sql.Append("<p><b>Please review the log status shown below, and then test your store web site, to double check that the import worked properly</b></p>"); sql.Append("<hr size=1>"); sql.Append("<p><b>IMPORT LOG:</b></p>"); string LogFileName = CommonLogic.QueryStringCanBeDangerousContent("LogFile"); string LogFormat = CommonLogic.QueryStringCanBeDangerousContent("LogFormat"); bool SendEmail = CommonLogic.QueryStringBool("SendEmail"); bool tffDebug = CommonLogic.QueryStringBool("debug"); string LogFile = CommonLogic.SafeMapPath("../download" + "/" + LogFileName + ".txt"); string FmtPath = CommonLogic.SafeMapPath("ShippingImportFormats.xml"); Int16 fmtNo = 0; if (LogFormat.Length > 0) { fmtNo = short.Parse(LogFormat); string outstr = ShippingImportCls.ProcessShippingLog(LogFile, fmtNo, SendEmail, tffDebug, EntityHelpers, GetParser); sql.Append(outstr); } ltContent.Text = sql.ToString(); }
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> "); } 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()); }
private void RenderContent() { string FileName = "Import_" + Localization.ToThreadCultureShortDateString(System.DateTime.Now).Replace(" ", "").Replace("/", "").Replace(":", "").Replace(".", ""); FileName = "PostageImport_" + DateTime.Now.ToString("MMddyyyyHHmmss"); bool DataUpdated = false; string ErrorMsg = string.Empty; string FmtPath = CommonLogic.SafeMapPath("ShippingImportFormats.xml"); DataTable FmtDt = ShippingImportCls.GetImportFormatList(); if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) { string PostedFormat = Request.Form["LogFormat"]; try { string LogFile = string.Empty; HttpPostedFile PostedFile = Request.Files["LogFile"]; sql.Append("<p><b><font color=red>" + "</font></b></p>\n"); if (PostedFile.ContentLength != 0) { string TargetFile = CommonLogic.SafeMapPath("../download/" + FileName + ".txt"); PostedFile.SaveAs(TargetFile); } DataUpdated = true; } catch (Exception ex) { ErrorMsg = CommonLogic.GetExceptionDetail(ex, "<br/>"); } if (DataUpdated) { sql.Append("<p align=\"left\"><font size=3 color=blue><b><a href=\"" + AppLogic.AdminLinkUrl("shippingimport.aspx") + "?LogFile=" + FileName + "&LogFormat=" + PostedFormat + "\">Shipping Log Upload successful. Click here to go to begin processing...</a></b></font></p><p></p>\n"); } } if (ErrorMsg.Length != 0) { sql.Append("<p><b><font color=red>" + ErrorMsg + "</font></b></p>\n"); } if (ErrorMsg.Length == 0) { sql.Append("<p><big><b><font color=red>Import Postage Log (Step 1: Upload File)</font></b></big></p>"); sql.Append("<p>This is still a experimental function...</p>"); sql.Append("<hr size=1>"); sql.Append("<p align=\"left\"><b>Import Shipping Data</b></p>\n"); sql.Append("<script type=\"text/javascript\">\n"); sql.Append("function Form_Validator(theForm)\n"); sql.Append(" {\n"); sql.Append(" return (true);\n"); sql.Append(" }\n"); sql.Append("</script>\n"); sql.Append("<p align=\"left\">Select the local Postage Log file that you want to upload. This file must conform to our Shipping Import File Format Specifications defined in the manual!<br/><br/>This file should be on your own computer. Click 'browse' to select the file on your computer:</p>\n"); sql.Append("<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\">\n"); sql.Append("<form enctype=\"multipart/form-data\" action=\"?LogFile=" + FileName + "\" method=\"post\" id=\"Form1\" name=\"Form1\" onsubmit=\"return (validateForm(this) && Form_Validator(this))\" onReset=\"return confirm('Do you want to reset all fields to their starting values?');\">\n"); sql.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n"); sql.Append("<tr>\n"); sql.Append("<td valign=\"top\" align=\"right\">*File:\n"); sql.Append("</td>\n"); sql.Append("<td valign=\"top\" align=\"left\">"); sql.Append("<input type=\"file\" name=\"LogFile\" size=\"50\" value=\"\">\n"); sql.Append("</td>\n"); sql.Append(" </tr>\n"); sql.Append("<tr>\n"); sql.Append("<td valign=\"top\" align=\"right\">*Format:\n"); sql.Append("</td>\n"); sql.Append("<td valign=\"top\" align=\"left\">"); sql.Append("<select size=\"1\" name=\"LogFormat\">\n"); sql.Append("<option selected>select format:</option>\n"); foreach (DataRow r in FmtDt.Rows) { sql.AppendFormat("<option value=\"{0}\">{1}</option>\n", r["ID"], r["Name"]); } sql.Append("</select>\n"); sql.Append("</td>\n"); sql.Append(" </tr>\n"); sql.Append("<tr>\n"); sql.Append("<td valign=\"top\" align=\"right\">Send Notice Email:\n"); sql.Append("</td>\n"); sql.Append("<td valign=\"top\" align=\"left\">"); sql.Append("<input type=\"checkbox\" name=\"SendEmail\" value=\"true\">\n"); sql.Append("</td>\n"); sql.Append(" </tr>\n"); sql.Append("<tr>\n"); sql.Append("<td></td><td align=\"left\"><br/>\n"); sql.Append("<input type=\"submit\" class=\"normalButtons\" value=\"Upload\" name=\"submit\">\n"); sql.Append("</td>\n"); sql.Append("</tr>\n"); sql.Append("</form>\n"); sql.Append("</table>\n"); ltContent.Text = sql.ToString(); } }