protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e) { var cArg = e.CommandArgument.ToString(); var param = new string[3]; switch (e.CommandName.ToLower()) { case "updateaddress": _addressData.AddAddress(rpAddr); param[0] = "addressid=" + Utils.RequestParam(Context, "addressid"); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "saveaddress": _addressData.AddAddress(rpAddr); var addrid = Utils.RequestParam(Context, "addressid"); if (Utils.IsNumeric(addrid) && ModSettings.Get("emailmanager") == "True") { var ad = _addressData.GetAddress(Convert.ToInt32(addrid)); if (ad != null) { var emailtemplate = ModSettings.Get("emailtemplate"); if (ModSettings.Get("emailmanageropt") == "2") { NBrightBuyUtils.SendEmailToManager(emailtemplate, ad, "profileupdated_emailsubject.Text"); } else { if (ad.GetXmlPropertyBool("genxml/hidden/default")) { NBrightBuyUtils.SendEmailToManager(emailtemplate, ad, "profileupdated_emailsubject.Text"); } } } } NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef, NotifyCode.ok); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "deleteaddress": _addressData.RemoveAddress(e.Item.ItemIndex); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "editaddress": param[0] = "addressid=" + e.Item.ItemIndex.ToString(""); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "newaddress": param[0] = "addressid=-1"; Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "cancel": Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; } }
private static String NewAddress(HttpContext context) { var addressData = new AddressData(); var dummyaddr = new NBrightInfo(true); dummyaddr.SetXmlProperty("genxml/textbox/dummy", "XXXXXXX"); // set dummy value so we activate a unknown address. addressData.AddAddress(dummyaddr, -1); return(""); }
public int AddAddress(Address address) { AddressData data = new AddressData(); try { data.AddAddress(address); } catch (Exception ex) { log.Write(ex.Message, "AddAddress"); throw (ex); } finally { data = null; } return(address.AddressID); }
protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e) { var cArg = e.CommandArgument.ToString(); var param = new string[3]; if (_uid != "") { param[0] = "uid=" + _uid; } switch (e.CommandName.ToLower()) { case "saveaddress": _addressData.AddAddress(rpAddr); Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "deleteaddress": _addressData.RemoveAddress(e.Item.ItemIndex); Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "editaddress": param[1] = "addressid=" + e.Item.ItemIndex.ToString(""); Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "newaddress": param[1] = "addressid=-1"; Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "viewclient": param[1] = "ctrl=clients"; Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "cancel": Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; } }
protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e) { var cArg = e.CommandArgument.ToString(); var param = new string[3]; if (Utils.RequestParam(Context, "eid") != "") { param[0] = "eid=" + Utils.RequestParam(Context, "eid"); } switch (e.CommandName.ToLower()) { case "additems": // save before add UpdateCartAddresses(); UpdateCartInfo(); SaveCart(); // add item _cartInfo.AddItem(rpData, StoreSettings.Current.SettingsInfo, e.Item.ItemIndex, DebugMode); _cartInfo.Save(); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "addqty": if (!Utils.IsNumeric(cArg)) { cArg = "1"; } if (Utils.IsNumeric(cArg)) { _cartInfo.UpdateItemQty(e.Item.ItemIndex, Convert.ToInt32(cArg)); _cartInfo.Save(); } Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "removeqty": if (!Utils.IsNumeric(cArg)) { cArg = "-1"; } if (Utils.IsNumeric(cArg)) { _cartInfo.UpdateItemQty(e.Item.ItemIndex, Convert.ToInt32(cArg)); _cartInfo.Save(); } Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "deletecartitem": UpdateCartAddresses(); UpdateCartInfo(); SaveCart(); if (cArg == "") { _cartInfo.RemoveItem(e.Item.ItemIndex); } else { _cartInfo.RemoveItem(cArg); } _cartInfo.Save(); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "deletecart": _cartInfo.DeleteCart(); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "updatecart": UpdateCartAddresses(); UpdateCartInfo(); SaveCart(); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "confirm": UpdateCartAddresses(); UpdateCartInfo(); SaveCart(); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "gotocart": if (_cartInfo.GetCartItemList().Count > 0) { UpdateCartInfo(); SaveCart(); var paytabid = ModSettings.Get("paymenttab"); if (!Utils.IsNumeric(paytabid)) { paytabid = TabId.ToString(""); } Response.Redirect(Globals.NavigateURL(Convert.ToInt32(paytabid), "", param), true); } Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "order": if (_cartInfo.GetCartItemList().Count > 0) { _cartInfo.SetValidated(true); _cartInfo.Lang = Utils.GetCurrentCulture(); // set lang so we can send emails in same language the order was made in. UpdateCartAddresses(); UpdateCartInfo(); SaveCart(true); // remove zero qty items on order, so they don;t appear in BO or on order. _addressData.AddAddress(rpAddrS); _addressData.AddAddress(rpAddrB); var paytabid = ModSettings.Get("paymenttab"); if (!Utils.IsNumeric(paytabid)) { paytabid = TabId.ToString(""); } Response.Redirect(Globals.NavigateURL(Convert.ToInt32(paytabid), "", param), true); } Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "saveshipaddress": UpdateCartAddresses(); _cartInfo.Save(); _addressData.AddAddress(rpAddrS); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; case "savebilladdress": UpdateCartAddresses(); _cartInfo.Save(); _addressData.AddAddress(rpAddrB); Response.Redirect(Globals.NavigateURL(TabId, "", param), true); break; } }