Esempio n. 1
0
 public void ValidateXmlFormat()
 {
     if (XMLDoc == null)
     {
         XMLData = GenXmlFunctions.GetGenXml(new RepeaterItem(0, ListItemType.Item));                 // if we don;t have anything, create an empty default to stop errors.
     }
     if (XMLDoc.SelectSingleNode("genxml/hidden") == null)
     {
         SetXmlProperty("genxml/hidden", "");
     }
     if (XMLDoc.SelectSingleNode("genxml/textbox") == null)
     {
         SetXmlProperty("genxml/textbox", "");
     }
     if (XMLDoc.SelectSingleNode("genxml/checkbox") == null)
     {
         SetXmlProperty("genxml/checkbox", "");
     }
     if (XMLDoc.SelectSingleNode("genxml/dropdownlist") == null)
     {
         SetXmlProperty("genxml/dropdownlist", "");
     }
     if (XMLDoc.SelectSingleNode("genxml/radiobuttonlist") == null)
     {
         SetXmlProperty("genxml/radiobuttonlist", "");
     }
 }
Esempio n. 2
0
        private void Update(int productid)
        {
            if (productid > 0)
            {
                var prodData = ProductUtils.GetProductData(productid, StoreSettings.Current.EditLanguage);
                var strXml   = GenXmlFunctions.GetGenXml(rpData);
                var updInfo  = new NBrightInfo(true);
                updInfo.XMLData = strXml;

                GenXmlFunctions.UploadFile(rpData, "document", StoreSettings.Current.FolderDocumentsMapPath);
                var ctrl = ((HtmlGenericControl)rpData.Items[0].FindControl("hiddocument"));
                if (ctrl != null)
                {
                    var fName = ctrl.Attributes["value"];
                    updInfo.SetXmlProperty("genxml/hidden/hiddocument", fName);

                    var docCtrl = (FileUpload)rpData.Items[0].FindControl("document");
                    updInfo.SetXmlProperty("genxml/hidden/posteddocumentname", docCtrl.PostedFile.FileName);
                }

                prodData.Update(updInfo.XMLData);
                prodData.Save();
                prodData.FillEmptyLanguageFields();

                if (StoreSettings.Current.DebugModeFileOut)
                {
                    prodData.OutputDebugFile(PortalSettings.HomeDirectoryMapPath + "debug_productupdate.xml");
                }

                NBrightBuyUtils.RemoveModCachePortalWide(PortalId);
                ProductUtils.RemoveProductDataCache(prodData);
            }
        }
Esempio n. 3
0
        public static NBrightInfo InsertEntityLangData(NBrightInfo objLangInfo, Repeater rpEntity, Repeater rpEntityLang, String entityName, String folderMapPath = "")
        {
            var strModelXML = "<" + entityName + ">";

            foreach (RepeaterItem i in rpEntityLang.Items)
            {
                if (GenXmlFunctions.GetField(rpEntity, "chkDelete", i.ItemIndex) != "True")
                {
                    GenXmlFunctions.SetField(rpEntityLang, "entityindex", i.ItemIndex.ToString(CultureInfo.InvariantCulture), i.ItemIndex);
                    strModelXML += GenXmlFunctions.GetGenXml(i, "", folderMapPath);
                }
            }
            strModelXML += "</" + entityName + ">";

            // Create a document fragment to contain the XML to be inserted.
            var docFrag = objLangInfo.XMLDoc.CreateDocumentFragment();

            // Set the contents of the document fragment.
            docFrag.InnerXml = strModelXML;
            //Add new model data
            if (objLangInfo.XMLDoc.DocumentElement != null)
            {
                objLangInfo.XMLDoc.DocumentElement.AppendChild(docFrag);
            }
            objLangInfo.XMLData = objLangInfo.XMLDoc.OuterXml;

            return(objLangInfo);
        }
Esempio n. 4
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var param = new string[3];

            switch (e.CommandName.ToLower())
            {
            case "import":
                param[0] = "";
                var importXML = GenXmlFunctions.GetGenXml(rpData, "", StoreSettings.Current.FolderUploadsMapPath);
                var nbi       = new NBrightInfo(false);
                nbi.XMLData  = importXML;
                _recordXref  = new Dictionary <int, int>();
                _productList = new Dictionary <int, string>();
                DoImport(nbi);
                DoImportImages(nbi);
                DoImportDocs(nbi);

                /*
                 * Validation removed as it impact the performance of the import.
                 * A validation can be done by the store manager through the UI Admin Tools after the import.
                 */
//                    Validate();

                NBrightBuyUtils.RemoveModCachePortalWide(PortalId);
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, "completed", NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "cancel":
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Create new NBrightInfo class for generic XML data in NBright
 /// </summary>
 /// <param name="populate">Create the basic XML structure</param>
 public NBrightInfo(Boolean populate)
 {
     if (populate)
     {
         XMLData = GenXmlFunctions.GetGenXml(new RepeaterItem(0, ListItemType.Item));
     }
 }
Esempio n. 6
0
        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 "pay":
                if (_cartInfo != null)
                {
                    _cartInfo.SaveModelTransQty();     // move qty into trans
                    _cartInfo.ConvertToOrder(DebugMode);
                    var orderData = new OrderData(_cartInfo.PurchaseInfo.ItemID);

                    orderData.payselectionXml = GenXmlFunctions.GetGenXml(rpPaymentGateways, "", "");

                    orderData.PaymentProviderKey = cArg.ToLower();     // provider keys should always be lowecase
                    orderData.SavePurchaseData();
                    var redirecturl = PaymentsInterface.Instance(orderData.PaymentProviderKey).RedirectForPayment(orderData);
                    if (redirecturl != "")
                    {
                        Response.Redirect(redirecturl, true);
                    }
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;
            }
        }
        protected void UpdateData()
        {
            if (CtrlTypeCode != "")
            {
                // read any existing data or create new.
                var objInfo = NBrightBuyUtils.GetSettings(PortalId, ModuleId, CtrlTypeCode, false);

                // populate changed data
                objInfo.ModifiedDate = DateTime.Now;

                //rebuild xml
                objInfo.XMLData = GenXmlFunctions.GetGenXml(RpData);

                objInfo = EventBeforeUpdate(RpData, objInfo);

                objInfo.ItemID = ModCtrl.Update(objInfo);


                EventAfterUpdate(RpData, objInfo);

                // clear any store level cache, might be overkill to clear ALL Store cache,
                // but editing of settings should only happen when changes are being made.
                NBrightBuyUtils.RemoveModCache(-1);
                NBrightBuyUtils.RemoveModCache(ModuleId);
            }
        }
Esempio n. 8
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;
            }
        }
Esempio n. 9
0
 public void UpdateAddress(Repeater rpData, int index)
 {
     if (_addressList.Count > index)
     {
         var strXml = GenXmlFunctions.GetGenXml(rpData);
         UpdateAddress(strXml, index);
     }
 }
Esempio n. 10
0
 public void UpdatePlugin(Repeater rpData, int index)
 {
     if (_pluginList.Count > index)
     {
         var strXml = GenXmlFunctions.GetGenXml(rpData);
         UpdatePlugin(strXml, index);
     }
 }
Esempio n. 11
0
        public void UpdateProfile(Repeater rpData, Boolean debugMode = false)
        {
            const string profileupload = "NBStore\\profileupload";

            Utils.CreateFolder(PortalSettings.Current.HomeDirectoryMapPath + profileupload);
            var strXml = GenXmlFunctions.GetGenXml(rpData, "", PortalSettings.Current.HomeDirectoryMapPath + profileupload);

            Save(strXml, debugMode);
        }
Esempio n. 12
0
        public String UpdateRule(RepeaterItem rpItem, Boolean debugMode = false)
        {
            var strXml = GenXmlFunctions.GetGenXml(rpItem);
            // load into NBrigthInfo class, so it's easier to get at xml values.
            var objInfoIn = new NBrightInfo();

            objInfoIn.XMLData = strXml;
            UpdateRule(objInfoIn, debugMode);
            return(""); // if everything is OK, don't send a message back.
        }
Esempio n. 13
0
 public void UpdateRule(Repeater rpData)
 {
     foreach (RepeaterItem i in rpData.Items)
     {
         var strXml = GenXmlFunctions.GetGenXml(i);
         var nbi    = new NBrightInfo(true);
         nbi.XMLData = strXml;
         UpdateRule(i);
     }
 }
Esempio n. 14
0
        /// <summary>
        /// Add Adddress
        /// </summary>
        /// <param name="rpData"></param>
        public String AddPlugin(Repeater rpData)
        {
            var strXml = GenXmlFunctions.GetGenXml(rpData);
            // load into NBrigthInfo class, so it's easier to get at xml values.
            var objInfoIn = new NBrightInfo();

            objInfoIn.XMLData = strXml;
            AddPlugin(objInfoIn);
            return(""); // if everything is OK, don't send a message back.
        }
Esempio n. 15
0
        private void Update()
        {
            var modCtrl = new NBrightBuyController();
            var strXml  = GenXmlFunctions.GetGenXml(rpDataH);

            _info.XMLData = strXml;
            modCtrl.Update(_info);

            //remove current setting from cache for reload
            Utils.RemoveCache("TaxProvider" + PortalSettings.Current.PortalId.ToString(""));
        }
Esempio n. 16
0
        private void RemoveLogo()
        {
            var modCtrl = new NBrightBuyController();
            var strXml  = GenXmlFunctions.GetGenXml(rpDataH, "", StoreSettings.Current.FolderImagesMapPath);

            _info.XMLData = strXml;
            _info.SetXmlProperty("genxml/hidden/hidmanualpaymentlogo", "");
            modCtrl.Update(_info);

            //remove current setting from cache for reload
            Utils.RemoveCache("ManualPaymentProvider" + PortalSettings.Current.PortalId.ToString(""));
        }
        private void Update()
        {
            var modCtrl = new NBrightBuyController();
            var strXml  = GenXmlFunctions.GetGenXml(rpDataH);

            _info.XMLData = strXml;
            _info.SetXmlProperty("genxml/debugmsg", "");
            modCtrl.Update(_info);

            //remove current setting from cache for reload
            Utils.RemoveCache("NBrightPxPayPaymentProvider" + PortalSettings.Current.PortalId.ToString(""));
        }
Esempio n. 18
0
 public void UpdateRule(Repeater rpData)
 {
     foreach (RepeaterItem i in rpData.Items)
     {
         var strXml = GenXmlFunctions.GetGenXml(i);
         var nbi    = new NBrightInfo(true);
         nbi.XMLData = strXml;
         if (nbi.GetXmlPropertyBool("genxml/hidden/isdirty"))
         {
             UpdateRule(i);
         }
     }
 }
Esempio n. 19
0
 private void UpdateCartInfo()
 {
     //update items
     foreach (RepeaterItem i in rpData.Items)
     {
         var strXml = GenXmlFunctions.GetGenXml(i);
         var cInfo  = new NBrightInfo();
         cInfo.XMLData = strXml;
         _cartInfo.MergeCartInputData(cInfo.GetXmlProperty("genxml/hidden/itemcode"), cInfo);
     }
     //update data
     _cartInfo.AddExtraInfo(rpExtra);
     _cartInfo.AddShipData(rpShip);
 }
Esempio n. 20
0
        public object UpdateDetailNoValidate(Repeater rp1, string typeCode, string uploadFolderMapPath, string itemId = "0", string selUserId = "", string GUIDKey = "")
        {
            var objInfo = (NBrightInfo)UpdateDetailData(rp1, typeCode, uploadFolderMapPath, itemId, selUserId, GUIDKey);

            if (Convert.ToString(objInfo.ItemID) != ItemId)
            {
                ItemId = Convert.ToString(objInfo.ItemID); // make sure base class has correct ID
                GenXmlFunctions.SetHiddenField(rp1, "itemid", ItemId);
                //rebuild xml
                objInfo.XMLData = GenXmlFunctions.GetGenXml(rp1);
                objInfo.ItemID  = ((DataCtrlInterface)ObjCtrl).Update(objInfo);
            }
            return(objInfo);
        }
Esempio n. 21
0
        private void AlterCost()
        {
            var info     = new NBrightInfo();
            var shipping = new ShippingData(_ctrlkey);

            info.XMLData = GenXmlFunctions.GetGenXml(rpDataH);
            var percentValue = info.GetXmlPropertyDouble("genxml/textbox/alterpercent");

            shipping.UpdateCost(percentValue);
            shipping.Save();

            //remove current setting from cache for reload
            Utils.RemoveCache("NBrightBuyShipping" + PortalSettings.Current.PortalId.ToString(""));
        }
Esempio n. 22
0
        private object UpdateDetailData(Repeater rp1, string typeCode, string uploadFolderMapPath, string itemId = "0", string selUserId = "", string GUIDKey = "")
        {
            if (!Utils.IsNumeric(selUserId))
            {
                selUserId = UserId.ToString("");
            }

            var objInfo = new NBrightInfo();

            if (Utils.IsNumeric(GenXmlFunctions.GetHiddenField(rp1, "ItemID")))
            {
                itemId = GenXmlFunctions.GetHiddenField(rp1, "ItemID");
            }

            if (Utils.IsNumeric(itemId))
            {
                // read any existing data or create new.
                objInfo = ObjCtrl.Get(Convert.ToInt32(itemId));
                if (objInfo == null)
                {
                    objInfo = new NBrightInfo();
                    // populate data
                    objInfo.PortalId = PortalId;
                    objInfo.ModuleId = ModuleId;
                    objInfo.ItemID   = Convert.ToInt32(itemId);
                    objInfo.TypeCode = typeCode;
                    objInfo.UserId   = Convert.ToInt32(selUserId);
                    objInfo.GUIDKey  = GUIDKey;
                }

                // populate changed data
                GenXmlFunctions.SetHiddenField(rp1, "dteModifiedDate", Convert.ToString(DateTime.Now));
                objInfo.ModifiedDate = DateTime.Now;

                objInfo.UserId = Convert.ToInt32(selUserId);

                //rebuild xml
                objInfo.XMLData = GenXmlFunctions.GetGenXml(rp1, "", uploadFolderMapPath);

                //update GUIDKey
                if (GUIDKey != "")
                {
                    objInfo.GUIDKey = GUIDKey;
                }

                objInfo.ItemID = ((DataCtrlInterface)ObjCtrl).Update(objInfo);
            }
            return(objInfo);
        }
Esempio n. 23
0
        private NotifyCode Update(String emailoption = "")
        {
            // we don;t have the full field set on this form, so only update the fields we know are there.
            var trackingcode = GenXmlFunctions.GetField(rpDataF, "trackingcode");
            var shippingdate = GenXmlFunctions.GetField(rpDataF, "shippingdate");
            var orderstatus  = GenXmlFunctions.GetField(rpDataF, "orderstatus");
            var showtouser   = GenXmlFunctions.GetField(rpDataF, "showtouser");
            var notes        = GenXmlFunctions.GetField(rpDataF, "notes");
            var emailmsg     = GenXmlFunctions.GetField(rpDataF, "emailmsg");

            var strUpd = GenXmlFunctions.GetGenXml(rpDataF, "", StoreSettings.Current.FolderUploadsMapPath);
            var nbi    = new NBrightInfo(true);

            nbi.XMLData = strUpd;


            if (!Utils.IsNumeric(_entryid))
            {
                return(NotifyCode.error);
            }
            var ordData = new OrderData(PortalId, Convert.ToInt32(_entryid));

            if (ordData.PurchaseInfo.ItemID == -1)
            {
                return(NotifyCode.fail);
            }
            ordData.ShippedDate     = shippingdate;
            ordData.OrderStatus     = orderstatus;
            ordData.TrackingCode    = trackingcode;
            ordData.InvoiceFileName = nbi.GetXmlProperty("genxml/hidden/hidinvoicedoc");
            ordData.InvoiceFileExt  = Path.GetExtension(ordData.InvoiceFileName);
            ordData.InvoiceFilePath = StoreSettings.Current.FolderUploadsMapPath + "\\" + ordData.InvoiceFileName;
            ordData.AddAuditMessage(notes, "msg", UserInfo.Username, showtouser);
            if (emailoption != "")
            {
                ordData.AddAuditMessage(emailmsg, "email", UserInfo.Username, showtouser, emailoption);
            }

            if (ordData.OrderNumber == "")
            {
                ordData.OrderNumber = StoreSettings.Current.Get("orderprefix") + ordData.PurchaseInfo.ModifiedDate.Year.ToString("").Substring(2, 2) + ordData.PurchaseInfo.ModifiedDate.Month.ToString("00") + ordData.PurchaseInfo.ModifiedDate.Day.ToString("00") + _entryid;
            }

            ordData.InvoiceDownloadName = ordData.OrderNumber + ordData.InvoiceFileExt;

            ordData.Save();
            return(NotifyCode.ok);
        }
Esempio n. 24
0
        public object UpdateDetailLangNoValidate(Repeater rp1, string typeCode, string uploadFolderMapPath, string itemIdLang = "0", string selUserId = "", string GUIDKey = "")
        {
            var objInfo = (NBrightInfo)UpdateDetailData(rp1, typeCode, uploadFolderMapPath, itemIdLang, selUserId, GUIDKey);

            if ((Convert.ToString(objInfo.ItemID) != ItemIdLang) | (String.IsNullOrEmpty(objInfo.Lang))) //update lang field if enpty.
            {
                ItemIdLang = Convert.ToString(objInfo.ItemID);                                           // make sure base class has correct ID
                GenXmlFunctions.SetHiddenField(rp1, "itemid", ItemIdLang);
                GenXmlFunctions.SetHiddenField(rp1, "lang", EntityLangauge);
                //rebuild xml
                objInfo.XMLData      = GenXmlFunctions.GetGenXml(rp1);
                objInfo.ParentItemId = Convert.ToInt32(ItemId);
                objInfo.Lang         = EntityLangauge;
                objInfo.ItemID       = ((DataCtrlInterface)ObjCtrl).Update(objInfo);
            }
            return(objInfo);
        }
        private void Update()
        {
            var modCtrl = new NBrightBuyController();
            var strXml  = GenXmlFunctions.GetGenXml(rpDataH);

            _info.XMLData = strXml;
            _info.SetXmlProperty("genxml/debugmsg", "");
            modCtrl.Update(_info);

            var resxDic     = GenXmlFunctions.GetGenXmlResx(rpDataH);
            var genTempl    = (GenXmlTemplate)rpDataH.ItemTemplate;
            var resxfolders = genTempl.GetResxFolders();
            var resxUpdate  = NBrightBuyUtils.UpdateResxFields(resxDic, resxfolders, StoreSettings.Current.EditLanguage, true);

            //remove current setting from cache for reload
            Utils.RemoveCache("NBrightPayPalPaymentProvider" + PortalSettings.Current.PortalId.ToString(""));
        }
Esempio n. 26
0
        private void Update()
        {
            var modCtrl = new NBrightBuyController();
            var strXml  = GenXmlFunctions.GetGenXml(rpDataH, "", StoreSettings.Current.FolderImagesMapPath);

            _info.XMLData = strXml;
            modCtrl.Update(_info);

            var resxDic     = GenXmlFunctions.GetGenXmlResx(rpDataH);
            var genTempl    = (GenXmlTemplate)rpDataH.ItemTemplate;
            var resxfolders = genTempl.GetResxFolders();
            var resxUpdate  = NBrightBuyUtils.UpdateResxFields(resxDic, resxfolders, StoreSettings.Current.EditLanguage, true);

            // NOTE: For some reason this action restarts the application, not sure why, but it's a side effect that helps display the new resx change. So I'm leaving it for now!
            //  This restart doesn;t happen with the update of the settings page???

            //remove current setting from cache for reload
            Utils.RemoveCache("ManualPaymentProvider" + PortalSettings.Current.PortalId.ToString(""));
        }
Esempio n. 27
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var param = new string[3];

            switch (e.CommandName.ToLower())
            {
            case "import":
                param[0] = "";
                var importXML = GenXmlFunctions.GetGenXml(rpData, "", StoreSettings.Current.FolderTempMapPath);
                var nbi       = new NBrightInfo(false);
                nbi.XMLData = importXML;

                // we're going to loop the records 2 times.
                // This is becuase the order of import could mean the xrefitemid and parentitemid cannot be updated on first pass.
                // doing this import 2 times ensures we get all records existing and hence we can create valid  xrefitemid and parentitemid fields.

                for (int i = 0; i < 2; i++)
                {
                    DoImport(nbi);
                }

                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "update":
                param[0] = "";
                var importXML2 = GenXmlFunctions.GetGenXml(rpData, "", StoreSettings.Current.FolderTempMapPath);
                var nbi2       = new NBrightInfo(false);
                nbi2.XMLData = importXML2;

                // this is a update to existsing data, so only need run once.
                DoImport(nbi2);

                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "cancel":
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Esempio n. 28
0
        public void UpdateUserData()
        {
            if (UserInfo.UserID >= 0 && !DisableUserInfo) // only save this to DB if it's a registered user.  We don;t want robots creating records in DB.
            {
                UInfo.UserId         = UserInfo.UserID;
                UInfo.TabId          = TabId;
                UInfo.SkinSrc        = Globals.QueryStringEncode(Utils.RequestQueryStringParam(Context, "SkinSrc"));
                UInfo.EntityTypeCode = EntityTypeCode;
                UInfo.CtrlTypeCode   = CtrlTypeCode;

                // set these returns independantly, to allow return to previous pages & ajax called over paging.
                //UInfo.RtnSelUrl = EditUrl("itemid", ItemId, CtrlTypeCode);
                //UInfo.RtnUrl = EditUrl("itemid", ItemId, CtrlTypeCode);
                //UInfo.FromItemId = ItemId;

                if (CtrlSearch.Visible)
                {
                    UInfo.SearchGenXml = GenXmlFunctions.GetGenXml(CtrlSearch);
                }
                UInfo.Save();
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Add Adddress
        /// </summary>
        /// <param name="rpData"></param>
        /// <param name="debugMode"></param>
        public String AddAddress(Repeater rpData, Boolean debugMode = false)
        {
            var strXml = GenXmlFunctions.GetGenXml(rpData, "", "");
            // load into NBrigthInfo class, so it's easier to get at xml values.
            var objInfoIn = new NBrightInfo();

            objInfoIn.XMLData = strXml;
            var addIndex = objInfoIn.GetXmlProperty("genxml/hidden/index"); // addresses updated from manager should have a index hidden field.

            if (addIndex == "")
            {
                addIndex = objInfoIn.GetXmlProperty("genxml/dropdownlist/selectaddress");                 // updated from cart should have a selected address
            }
            if (!Utils.IsNumeric(addIndex))
            {
                addIndex = "-1";                             // assume new address.
            }
            var addressIndex = Convert.ToInt32(addIndex);

            AddAddress(objInfoIn, addressIndex);
            return(""); // if everything is OK, don't send a message back.
        }
Esempio n. 30
0
        private void Update()
        {
            var settings = ModCtrl.GetByGuidKey(PortalSettings.Current.PortalId, 0, "SETTINGS", "NBrightBuySettings");

            if (settings == null)
            {
                settings          = new NBrightInfo(true);
                settings.PortalId = PortalId;
                // use zero as moduleid so it's not picked up by the modules for their settings.
                // The normal GetList will get all moduleid OR moduleid=-1
                settings.ModuleId = 0;
                settings.ItemID   = -1;
                settings.TypeCode = "SETTINGS";
                settings.GUIDKey  = "NBrightBuySettings";
            }

            var sharedflag = settings.GetXmlProperty("genxml/checkbox/sharedproductsflag"); //maintain shared flag

            settings.XMLData = GenXmlFunctions.GetGenXml(rpData, "", StoreSettings.Current.FolderImagesMapPath);

            if (settings.GetXmlProperty("genxml/hidden/hidemaillogo") != "")
            {
                settings.SetXmlProperty("genxml/hidden/emaillogourl", StoreSettings.Current.FolderImages + "/" + settings.GetXmlProperty("genxml/hidden/hidemaillogo"));
                settings.SetXmlProperty("genxml/hidden/emaillogopath", StoreSettings.Current.FolderImagesMapPath + "\\" + settings.GetXmlProperty("genxml/hidden/hidemaillogo"));
            }


            settings.SetXmlProperty("genxml/hidden/backofficetabid", PortalSettings.Current.ActiveTab.TabID.ToString(""));

            settings.SetXmlProperty("genxml/checkbox/sharedproductsflag", sharedflag); //maintain shared flag

            ModCtrl.Update(settings);

            if (StoreSettings.Current.DebugModeFileOut)
            {
                settings.XMLDoc.Save(PortalSettings.HomeDirectoryMapPath + "\\debug_Settings.xml");
            }

            // create upload folders
            var folder = StoreSettings.Current.FolderNBStoreMapPath;

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }
            folder = StoreSettings.Current.FolderImagesMapPath;
            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }
            folder = StoreSettings.Current.FolderDocumentsMapPath;
            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }
            folder = StoreSettings.Current.FolderUploadsMapPath;
            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }
            folder = StoreSettings.Current.FolderClientUploadsMapPath;
            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }
            folder = StoreSettings.Current.FolderTempMapPath;
            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }

            //Create default category grouptype
            var l = NBrightBuyUtils.GetCategoryGroups(EditLanguage, true);
            var g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "cat" select i;

            if (!g.Any())
            {
                CreateGroup("cat", "Categories", "2");
            }
            if (l.Count == 0)
            {
                g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "promo" select i;
                if (!g.Any())
                {
                    CreateGroup("promo", "Promotions", "1");
                }
                g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "man" select i;
                if (!g.Any())
                {
                    CreateGroup("man", "Manufacturer", "1");
                }
                g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "supp" select i;
                if (!g.Any())
                {
                    CreateGroup("supp", "Supplier", "1");
                }
                g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "fea" select i;
                if (!g.Any())
                {
                    CreateGroup("fea", "Features", "1");
                }
                g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "spec" select i;
                if (!g.Any())
                {
                    CreateGroup("spec", "Specifications", "1");
                }
                g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "temp" select i;
                if (!g.Any())
                {
                    CreateGroup("temp", "Temp", "1");
                }
                g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "searchfilter" select i;
                if (!g.Any())
                {
                    CreateGroup("searchfilter", "Display Search Filter", "3");
                }
            }

            //update resx fields
            var resxDic     = GenXmlFunctions.GetGenXmlResx(rpData);
            var genTempl    = (GenXmlTemplate)rpData.ItemTemplate;
            var resxfolders = genTempl.GetResxFolders();  // ideally we'd create the settings resx at the portal level, but can't easily get that to work.
            var resxUpdate  = NBrightBuyUtils.UpdateResxFields(resxDic, resxfolders, StoreSettings.Current.EditLanguage, true);

            //remove all cahce setting from cache for reload
            //DNN is sticky with some stuff (had some issues with email addresses not updating), so to be sure clear it all.
            DataCache.ClearCache();
        }