예제 #1
0
 private static String OrderAdminReOrder(HttpContext context)
 {
     try
     {
         if (UserController.Instance.GetCurrentUserInfo().UserID > 0)
         {
             var settings = NBrightBuyUtils.GetAjaxDictionary(context);
             if (!settings.ContainsKey("selecteditemid"))
             {
                 settings.Add("selecteditemid", "");
             }
             var selecteditemid = settings["selecteditemid"];
             if (Utils.IsNumeric(selecteditemid))
             {
                 var orderData = new OrderData(PortalSettings.Current.PortalId, Convert.ToInt32(selecteditemid));
                 if (orderData.UserId == UserController.Instance.GetCurrentUserInfo().UserID || NBrightBuyUtils.CheckRights())
                 {
                     orderData.CopyToCart(false);
                 }
             }
             return("");
         }
         return("");
     }
     catch (Exception ex)
     {
         return(ex.ToString());
     }
 }
예제 #2
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg           = e.CommandArgument.ToString();
            var param          = new string[3];
            var navigationData = new NavigationData(PortalId, "OrderAdmin");

            switch (e.CommandName.ToLower())
            {
            case "entrydetail":
                param[0] = "eid=" + cArg;
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "reorder":
                if (Utils.IsNumeric(cArg))
                {
                    var orderData = new OrderData(PortalId, Convert.ToInt32(cArg));
                    orderData.CopyToCart(DebugMode);
                }
                Response.Redirect(Globals.NavigateURL(StoreSettings.Current.CartTabId, "", param), true);
                break;

            case "return":
                param[0] = "";
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "search":
                var strXml = GenXmlFunctions.GetGenXml(rpSearch, "", "");
                navigationData.Build(strXml, _templSearch);
                navigationData.OrderBy = GenXmlFunctions.GetSqlOrderBy(rpSearch);
                navigationData.XmlData = GenXmlFunctions.GetGenXml(rpSearch);
                navigationData.Save();
                if (StoreSettings.Current.DebugModeFileOut)
                {
                    strXml = "<root><sql><![CDATA[" + navigationData.Criteria + "]]></sql>" + strXml + "</root>";
                    var xmlDoc = new System.Xml.XmlDocument();
                    xmlDoc.LoadXml(strXml);
                    xmlDoc.Save(PortalSettings.HomeDirectoryMapPath + "debug_search.xml");
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "resetsearch":
                // clear cookie info
                navigationData.Delete();
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "downloadinvoice":
                DownloadInvoice(Convert.ToInt32(cArg));
                break;

            case "orderby":
                navigationData.OrderBy = GenXmlFunctions.GetSqlOrderBy(rpData);
                navigationData.Save();
                break;
            }
        }
예제 #3
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var tabId = TabId;
            var param = new string[4];

            if (_uid != "")
            {
                param[0] = "uid=" + _uid;
            }
            var navigationData = new NavigationData(PortalId, "AdminOrders");
            var cmd            = e.CommandName.ToLower();
            var resxpath       = StoreSettings.NBrightBuyPath() + "/App_LocalResources/Notification.ascx.resx";
            var emailoption    = "";

            switch (cmd)
            {
            case "entrydetail":
                param[0] = "eid=" + cArg;
                if (_page != "")
                {
                    param[1] = "page=" + _page;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "reorder":
                param[0] = "";
                if (Utils.IsNumeric(cArg))
                {
                    var orderData = new OrderData(PortalId, Convert.ToInt32(cArg));
                    orderData.CopyToCart(DebugMode);
                    tabId = StoreSettings.Current.GetInt("carttab");
                    if (tabId == 0)
                    {
                        tabId = TabId;
                    }
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(tabId, param), true);
                break;

            case "editorder":
                param[0] = "";
                if (Utils.IsNumeric(cArg))
                {
                    var orderData = new OrderData(PortalId, Convert.ToInt32(cArg));
                    orderData.ConvertToCart(DebugMode);
                    tabId = StoreSettings.Current.GetInt("carttab");
                    if (tabId == 0)
                    {
                        tabId = TabId;
                    }
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(tabId, param), true);
                break;

            case "return":
                param[0] = "";
                if (_page != "")
                {
                    param[1] = "page=" + _page;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "search":
                var strXml = GenXmlFunctions.GetGenXml(rpSearch, "", "");
                navigationData.Build(strXml, _templSearch);
                navigationData.OrderBy = GenXmlFunctions.GetSqlOrderBy(rpSearch);
                navigationData.XmlData = GenXmlFunctions.GetGenXml(rpSearch);
                navigationData.Save();
                if (StoreSettings.Current.DebugModeFileOut)
                {
                    strXml = "<root><sql><![CDATA[" + navigationData.Criteria + "]]></sql>" + strXml + "</root>";
                    var xmlDoc = new System.Xml.XmlDocument();
                    xmlDoc.LoadXml(strXml);
                    xmlDoc.Save(PortalSettings.HomeDirectoryMapPath + "debug_search.xml");
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "resetsearch":
                // clear cookie info
                navigationData.Delete();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "orderby":
                navigationData.OrderBy = GenXmlFunctions.GetSqlOrderBy(rpData);
                navigationData.Save();
                break;

            case "viewclient":
                param[1] = "ctrl=clients";
                if (Utils.IsNumeric(cArg))
                {
                    var orderData = new OrderData(PortalId, Convert.ToInt32(cArg));
                    param[0] = "uid=" + orderData.UserId.ToString("");
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "save":
                param[0] = "eid=" + _entryid;
                var result = Update();
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + cmd, result);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "printorder":
                param[0] = "eid=" + _entryid;
                param[1] = "print=printorder";
                param[2] = "template=printorder.html";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "printreceipt":
                param[0] = "eid=" + _entryid;
                param[1] = "print=printorder";
                param[2] = "template=printreceipt.html";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "printdeliverylabel":
                param[0] = "eid=" + _entryid;
                param[1] = "print=printorder";
                param[2] = "template=printdeliverylabel.html";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "emailamended":
                param[0]    = "eid=" + _entryid;
                emailoption = DnnUtils.GetLocalizedString("orderamended_emailsubject.Text", resxpath, Utils.GetCurrentCulture());
                Update(emailoption);
                SendOrderEmail(Convert.ToInt32(_entryid), "orderamendedemail.html", "orderamended_emailsubject.Text");
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + cmd, NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "emailreceipt":
                param[0]    = "eid=" + _entryid;
                emailoption = DnnUtils.GetLocalizedString("orderreceipt_emailsubject.Text", resxpath, Utils.GetCurrentCulture());
                Update(emailoption);
                SendOrderEmail(Convert.ToInt32(_entryid), "orderreceiptemail.html", "orderreceipt_emailsubject.Text");
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + cmd, NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "emailshipped":
                param[0]    = "eid=" + _entryid;
                emailoption = DnnUtils.GetLocalizedString("ordershipped_emailsubject.Text", resxpath, Utils.GetCurrentCulture());
                Update(emailoption);
                SendOrderEmail(Convert.ToInt32(_entryid), "ordershippedemail.html", "ordershipped_emailsubject.Text");
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + cmd, NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "emailvalidated":
                param[0]    = "eid=" + _entryid;
                emailoption = DnnUtils.GetLocalizedString("ordervalidated_emailsubject.Text", resxpath, Utils.GetCurrentCulture());
                Update(emailoption);
                SendOrderEmail(Convert.ToInt32(_entryid), "ordervalidatedemail.html", "ordervalidated_emailsubject.Text");
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + cmd, NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "downloadinvoice":
                DownloadInvoice(Convert.ToInt32(cArg));
                break;

            case "deleteinvoice":
                DeleteInvoice(Convert.ToInt32(cArg));
                param[0] = "eid=" + _entryid;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "export":
                DoExport();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }