protected void Button4_Click(object sender, EventArgs e) { if (Session["NCIPL_DONE"].ToString() == "true") { Response.Redirect("default.aspx"); } steps1.Activate("cell5"); Transaction t = new Transaction(this.shipto, this.billto, this.cc, this.shoppingcartV2); //Begin HITT 8329 (CR 21) Save The Raw Order ############################### //Save the Raw Order Details before credit card and before order upload call try { string Fax = ""; string Province = ""; //Only for International Exhibit Order string Country = ""; //Only for International Exhibit Order string interfacename = "ROO"; //"NCIPL"; //NCIPL, ROO or EXHIBIT string international = ""; //Pass "1" for International Order (Currently only for Exhibit) string Zip = t.ShipTo.Zip5; //Zip5 for NCIPL, ROO and Exhibit Domestic Orders. International Zip for Exhibit International Order. string rawpubids = ""; string rawpubqtys = ""; string[] rawpubs = Session["NCIPL_Pubs"].ToString().Split(new Char[] { ',' }); for (var i = 0; i < rawpubs.Length; i++) { //if (pubs[i].Trim() != "") if (string.Compare(rawpubs[i].Trim(), "", true) != 0) { rawpubids += rawpubs[i].Trim() + ","; } } string[] rawqtys = Session["NCIPL_Qtys"].ToString().Split(new Char[] { ',' }); for (var i = 0; i < rawqtys.Length; i++) { //if (qtys[i].Trim() != "") if (string.Compare(rawqtys[i].Trim(), "", true) != 0) { rawpubqtys += rawqtys[i].Trim() + ","; } } if (rawpubids.Length > 1) { rawpubids = rawpubids.TrimEnd(','); } if (rawpubqtys.Length > 1) { rawpubqtys = rawpubqtys.TrimEnd(','); } string CostRecoveryInd = ""; if (t.CC.Cost > 0) { CostRecoveryInd = "1"; } DAL.DAL.SaveRawOrder(t.ShipTo.Organization, t.ShipTo.Fullname, t.ShipTo.Addr1, t.ShipTo.Addr2, t.ShipTo.City, t.ShipTo.State, Zip, t.ShipTo.Zip4, t.ShipTo.Phone, Fax, t.ShipTo.Email, Province, Country, CostRecoveryInd, rawpubids, rawpubqtys, PubEnt.GlobalUtils.Utils.UserIPAddrress(), interfacename, international); } catch (Exception Ex) { //Write to log Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry logEnt = new Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry(); logEnt.Message = "\r\n" + "Unable to invoke SaveRawOrder()." + "\r\n" + "Source: " + Ex.Source + "\r\n" + "Description: " + Ex.Message + "\r\n" + "Stack Trace: " + Ex.StackTrace; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(logEnt, "Logs"); } //End HITT 8329(CR 21) ##################################################### //***EAC SOP---swipe first before creating order if (true) //EAC This used to be Swipe(cc) { int returnvalue = 0; int returnordernum = 0; string pubids = ""; string pubqtys = ""; string[] pubs = Session["NCIPL_Pubs"].ToString().Split(new Char[] { ',' }); for (var i = 0; i < pubs.Length; i++) { //if (pubs[i].Trim() != "") if (string.Compare(pubs[i].Trim(), "", true) != 0) { pubids += pubs[i].Trim() + ","; } } string[] qtys = Session["NCIPL_Qtys"].ToString().Split(new Char[] { ',' }); for (var i = 0; i < qtys.Length; i++) { //if (qtys[i].Trim() != "") if (string.Compare(qtys[i].Trim(), "", true) != 0) { pubqtys += qtys[i].Trim() + ","; } } if (pubids.Length > 1) { pubids = pubids.TrimEnd(','); } if (pubqtys.Length > 1) { pubqtys = pubqtys.TrimEnd(','); } //bool bSaveOrderFlag = false; //if (Session["SEARCHORDER_CUSTID"] != null) //{ //if (Session["SEARCHORDER_CUSTID"].ToString() != "") //{ //bSaveOrderFlag = t.Update(Request.UserHostAddress, Session["SEARCHORDER_CUSTID"].ToString(), pubids, pubqtys, out returnvalue, out returnordernum); //} //else //{ //bSaveOrderFlag = t.Save(Request.UserHostAddress, pubids, pubqtys, out returnvalue, out returnordernum); //} //} //else //{ //bSaveOrderFlag = t.Save(Request.UserHostAddress, pubids, pubqtys, out returnvalue, out returnordernum); //} if (t.Save(PubEnt.GlobalUtils.Utils.UserIPAddrress(), pubids, pubqtys, out returnvalue, out returnordernum)) { //JPJ TO DO: Display returnordernum on Screen. //***EAC Everything looks good at this point Session["NCIPL_DONE"] = "true"; lblAVS_Shipping.Visible = false; //NCIPLCC Label1.Text = "Confirmation"; //Label1.Visible = false; //NCIPLCC steps1.Visible = false; //HITT 8716 Label2.Text = ""; btn2Shipping.Visible = false; btn2Cart.Visible = false; btn2Cancel.Visible = false; btn2Submit.Visible = false; LinkButton1.Visible = false; pnlConfirm1.Visible = true; pnlConfirm2.Visible = true; pnlConfirm3.Visible = true; LblThank.Visible = true; lblorderdt.Text = System.DateTime.Today.ToShortDateString(); lblOrderNum.Text = returnordernum.ToString(); //***EAC The if-then section below is now obsolete 20130109 if (false && shipto.Email.Length > 0 && HasCover(this.shoppingcartV2))//if we have a valid shipto.email address { StringWriter sw = new StringWriter(); HtmlTextWriter writer = new HtmlTextWriter(sw); string s; //pnlConfirm1.RenderControl(writer); Panel1.RenderControl(writer); pnlBillingInfo.RenderControl(writer); //pnlPaymentInfo.RenderControl(writer); grdItems.RenderControl(writer); ListNerdos.RenderControl(writer); s = sw.ToString(); PubEnt.DAL2.DAL.SaveEmail(shipto.Email, s); try { //SYSTEM.WEB.MAIL -- i know its becoming obsolete MailMessage msg = new MailMessage(); msg.From = ConfigurationManager.AppSettings["PubEntEmailAddress"]; msg.To = shipto.Email; msg.Subject = "Order Confirmation"; msg.Body = s; msg.BodyFormat = MailFormat.Html; SmtpMail.Send(msg); } catch (Exception) { } } //Code for HITT 8716 string printertext = ""; //Used like a flag, will not hold any value string printerShipping = "", printerBilling = "", printerPayment = ""; //Begin - NCIPLCC string printerSplitOrder = ""; if (shoppingcartV2.SplitOrder == "1") { StringWriter swSplitOrder = new StringWriter(); HtmlTextWriter writerSplitOrder = new HtmlTextWriter(swSplitOrder); pnlSplitOrder.RenderControl(writerSplitOrder); printerSplitOrder = swSplitOrder.ToString(); Session["NCIPLCC_PrinterSplitOrder"] = printerSplitOrder; } string printerdtandordnum = ""; StringWriter swDtandOrdnum = new StringWriter(); HtmlTextWriter writerDtandOrdnum = new HtmlTextWriter(swDtandOrdnum); pnlConfirm3.RenderControl(writerDtandOrdnum); printerdtandordnum = swDtandOrdnum.ToString(); swDtandOrdnum.Dispose(); writerDtandOrdnum.Dispose(); Session["NCIPLCC_PrinterOrderDtandOrderNum"] = printerdtandordnum; //End - NCIPLCC StringWriter swShipping = new StringWriter(); HtmlTextWriter writerShipping = new HtmlTextWriter(swShipping); Panel1.RenderControl(writerShipping); printerShipping = swShipping.ToString(); StringWriter swBilling = new StringWriter(); HtmlTextWriter writerBilling = new HtmlTextWriter(swBilling); pnlBillingInfo.RenderControl(writerBilling); printerBilling = swBilling.ToString(); //StringWriter swPayment = new StringWriter(); //HtmlTextWriter writerPayment = new HtmlTextWriter(swPayment); //pnlPaymentInfo.RenderControl(writerPayment); //printerPayment = swPayment.ToString(); Session["NCIPL_PrinterFriendly"] = printertext; Session["NCIPL_PrinterGrid"] = this.shoppingcartV2; Session["NCIPL_PrinterShipping"] = printerShipping; Session["NCIPL_PrinterBilling"] = printerBilling; Session["NCIPL_PrinterPayment"] = printerPayment; if (!shoppingcartV2.isFree2Order(shipto != null ? shipto.State : "")) { Session["NCIPL_PrinterCostRecovery"] = "True"; } else { Session["NCIPL_PrinterCostRecovery"] = "False"; } //End code ResetSessions(); } else { throw (new ApplicationException("Cannot save order.")); } } }
protected void Page_Load(object sender, EventArgs e) { if (shoppingcartV2 == null || shoppingcartV2.Count < 1) //***EAC I need a shopping cart at this point { GlobalUtils.Utils.ClearAllSessions(); Response.Redirect("~/login.aspx", true); } if (!GlobalUtils.Utils.isLoggedin()) { //***EAC I need a logged in user at this point GlobalUtils.Utils.ClearAllSessions(); Response.Redirect("~/login.aspx", true); } string role = GlobalUtils.Utils.LoggedinRole(); if (role != "NCIPL_LM") { throw (new ArgumentException("Your role is not allowed at this point.")); } if (!IsPostBack) { //NCIPL_CC if (GlobalUtils.UserRoles.getLoggedInUserId().Length == 0 || GlobalUtils.UserRoles.getLoggedInUserRole() < 1) { string currASPXfilename = System.IO.Path.GetFileName(Request.Path).ToString(); Session["NCIPL_REGISTERREFERRER"] = currASPXfilename; Response.Redirect("~/login.aspx?msg=invaliduser&redir=" + currASPXfilename); } Session["NCIPL_DONE"] = "false"; steps1.Activate("cell4"); cc = new CreditCard(); //***EAC Create a dummy credit card object lblname.Text = this.shipto.Fullname; lblOrg.Text = this.shipto.Organization; lbladdr1.Text = this.shipto.Addr1; lbladdr2.Text = this.shipto.Addr2; lblcity.Text = this.shipto.City; lblst.Text = this.shipto.State; lblzip.Text = this.shipto.Zip5 + ((this.shipto.Zip4.Trim() == "") ? "" : "-" + this.shipto.Zip4); lblemail.Text = "E-mail: " + this.shipto.Email; lblphone.Text = "Phone: " + this.shipto.Phone; lblcountry.Text = DAL2.DAL.GetCountryByID(shipto.Country); lbl2name.Text = this.billto.Fullname; lbl2addr1.Text = this.billto.Addr1; lbl2addr2.Text = this.billto.Addr2; lbl2city.Text = this.billto.City; lbl2st.Text = this.billto.State; lbl2zip.Text = this.billto.Zip5 + ((this.billto.Zip4.Trim() == "") ? "" : "-" + this.billto.Zip4); lbl2email.Text = "E-mail: " + this.billto.Email; lbl2phone.Text = "Phone: " + this.billto.Phone; lbl2org.Text = this.billto.Organization; lbl2country.Text = DAL2.DAL.GetCountryByID(billto.Country); if (this.shipto.Organization.Trim().Length < 1) { lblOrg.Visible = false; } if (this.shipto.Addr2.Trim().Length < 1) { lbladdr2.Visible = false; } if (this.shipto.Email.Trim().Length < 1) { lblemail.Visible = false; } if (this.shipto.Phone.Trim().Length < 1) { lblphone.Visible = false; } pnlSplitOrder.Visible = (shoppingcartV2.SplitOrder == "1") ? true : false; if (this.billto.Organization.Trim().Length < 1) { lbl2org.Visible = false; } if (this.billto.Addr2.Trim().Length < 1) { lbl2addr2.Visible = false; } if (this.billto.Email.Trim().Length < 1) { lbl2email.Visible = false; } if (this.billto.Phone.Trim().Length < 1) { lbl2phone.Visible = false; } grdItems.DataSource = this.shoppingcartV2; grdItems.DataBind(); lblTotalItems.Text = this.shoppingcartV2.TotalQty.ToString(); lblCost.Text = this.shoppingcartV2.ShipCost.ToString("c"); if (Nerdos.Count > 0) { ListNerdos.DataSource = Nerdos; ListNerdos.DataBind(); pnlContentDownload.Visible = true; } //***EAC test the address if (shoppingcartV2.ShipMethod == "") { USPS(this.shipto); } else if (shoppingcartV2.ShipMethod[0] == 'F') { FEDEX(shipto); } else if (shoppingcartV2.ShipMethod[0] == 'U') { UPS(shipto); } if (shoppingcartV2.isFree2Order(shipto != null ? shipto.State : "")) { //lblCCText.Visible = false; divCost.Visible = false; divCCExplanation.Visible = false; pnlBillingInfo.Visible = false; pnlPaymentInfo.Visible = false; btn2Shipping.Text = "Change Address"; divCCPrompt.Visible = false; } else { //lblCCText.Visible = true; divCost.Visible = true; divCCExplanation.Visible = true; pnlBillingInfo.Visible = true; pnlPaymentInfo.Visible = false; lblCost.Text = shoppingcartV2.ShipCost.ToString("c"); btn2Shipping.Text = "Change Addresses or Payment Information"; divCCPrompt.Visible = true; } //***EAC check if order within the last 30 days if (btn2Submit.Enabled == true && ConfigurationManager.AppSettings["AllowCheckRecentOrder"] == "1") //NCIPLCC - Check only if other validations are okay and if web config setting value is 1 { CheckRecentOrders(this.shipto); } if (btn2Submit.Enabled == true) //NCIPLCC - Check for No Ship flag, only if other validations are okay { CheckNoShipFlag(this.shipto); } } //Display the master page tabs GlobalUtils.Utils UtilMethod = new GlobalUtils.Utils(); if (Session["NCIPL_Pubs"] != null) { Master.LiteralText = UtilMethod.GetTabHtmlMarkUp(Session["NCIPL_Qtys"].ToString(), ""); } else { Master.LiteralText = UtilMethod.GetTabHtmlMarkUp("", ""); } UtilMethod = null; }
protected void Page_Load(object sender, EventArgs e) { //foreach (object item in Request.Form) //{ // Response.Write(item.ToString() + "=" + Request.Form[item.ToString()] + "<br>"); //} if (this.shoppingcartV2 == null || this.shoppingcartV2.Count < 1) //***EAC I need a shopping cart at this point { ResetSessions(); Response.Redirect("default.aspx?missingsession=true", true); } if (!IsPostBack) { Session["NCIPL_DONE"] = "false"; steps1.Activate("cell4"); #region Omniture enable the Submit Order button btn2Submit.Attributes.Add("onclick", "NCIAnalytics.CartCompleted();"); #endregion cc = new CreditCard(); //***EAC Create a dummy credit card object lblorderdt.Text = System.DateTime.Today.ToShortDateString(); lblname.Text = this.shipto.Fullname; lblOrg.Text = this.shipto.Organization; lbladdr1.Text = this.shipto.Addr1; lbladdr2.Text = this.shipto.Addr2; lblcity.Text = this.shipto.City; lblst.Text = this.shipto.State; lblzip.Text = this.shipto.Zip5 + ((this.shipto.Zip4.Trim() == "") ? "" : "-" + this.shipto.Zip4); lblemail.Text = "E-mail: " + this.shipto.Email; lblphone.Text = "Phone: " + this.shipto.Phone; lbl2name.Text = this.billto.Fullname; lbl2addr1.Text = this.billto.Addr1; lbl2addr2.Text = this.billto.Addr2; lbl2city.Text = this.billto.City; lbl2st.Text = this.billto.State; lbl2zip.Text = this.billto.Zip5 + ((this.billto.Zip4.Trim() == "") ? "" : "-" + this.billto.Zip4); lbl2email.Text = "E-mail: " + this.billto.Email; lbl2phone.Text = "Phone: " + this.billto.Phone; lbl2org.Text = this.billto.Organization; if (this.shipto.Organization.Trim().Length < 1) { lblOrg.Visible = false; } if (this.shipto.Addr2.Trim().Length < 1) { lbladdr2.Visible = false; } if (this.shipto.Email.Trim().Length < 1) { lblemail.Visible = false; } if (this.shipto.Phone.Trim().Length < 1) { lblphone.Visible = false; } if (this.billto.Organization.Trim().Length < 1) { lbl2org.Visible = false; } if (this.billto.Addr2.Trim().Length < 1) { lbl2addr2.Visible = false; } if (this.billto.Email.Trim().Length < 1) { lbl2email.Visible = false; } if (this.billto.Phone.Trim().Length < 1) { lbl2phone.Visible = false; } if (!shoppingcartV2.isFree2Order(shipto != null ? shipto.State : "")) { pnlPaymentInfo.Visible = true; lblCost.Text = shoppingcartV2.ShipCost.ToString("c"); btn2Shipping.Text = "Change Addresses or Payment Information"; CostRecoveryInd = "1"; //HITT 8716 divCCPrompt.Visible = true; } else { pnlPaymentInfo.Visible = false; pnlBillingInfo.Visible = false; btn2Shipping.Text = "Change Address"; divCCPrompt.Visible = false; } grdItems.DataSource = this.shoppingcartV2; grdItems.DataBind(); lblTotalItems.Text = this.shoppingcartV2.TotalQty.ToString(); lblCost.Text = this.shoppingcartV2.ShipCost.ToString("c"); if (Nerdos.Count > 0) { ListNerdos.DataSource = Nerdos; ListNerdos.DataBind(); pnlContentDownload.Visible = true; } //***EAC test the address if (shoppingcartV2.ShipMethod == "") { USPS(this.shipto); } else if (shoppingcartV2.ShipMethod[0] == 'F') { FEDEX(shipto); } else if (shoppingcartV2.ShipMethod[0] == 'U') { UPS(shipto); } //***EAC check if order within the last 30 days if (ConfigurationManager.AppSettings["AllowCheckRecentOrder"] == "1") { CheckRecentOrders(this.shipto); //***EAC TODO: Enable this line when we go live in SOLAS } /*Begin HITT 8716*/ if (string.Compare(CostRecoveryInd, "") == 0) { //lblCCText.Visible = false; divCost.Visible = false; divCCExplanation.Visible = false; } /*End HITT 8716*/ } //Display the master page tabs GlobalUtils.Utils UtilMethod = new GlobalUtils.Utils(); if (Session["NCIPL_Pubs"] != null) { Master.LiteralText = UtilMethod.GetTabHtmlMarkUp(Session["NCIPL_Qtys"].ToString(), ""); } else { Master.LiteralText = UtilMethod.GetTabHtmlMarkUp("", ""); } UtilMethod = null; }