Exemplo n.º 1
0
        private string GetNavigationValue(bool ignoreCache)
        {
            CSBooster_DataContext csb = new CSBooster_DataContext(Helper.GetSiemeConnectionString());

            string CacheKey = string.Format("{0}_{1}_{2}_{3}", NavigationID, CultureHandler.GetCurrentNeutralLanguageCode().ToLower(), udc.UserRole.ToLower(), (int)NavType);
            string navXml   = Cache[CacheKey] as string;

            if (navXml == null || ignoreCache)
            {
                navXml = "<Tree/>";
                var Navi = csb.hisp_Navigation_GetPreChache(NavigationID.ToGuid(), CultureHandler.GetCurrentNeutralLanguageCode(), udc.UserRole).FirstOrDefault();
                if (Navi != null)
                {
                    navXml = Navi.NPC_PreCacheXML;
                }
                navXml = DataAccess.Business.Navigation.TranformXML(navXml, NavType);
                Cache.Insert(CacheKey, navXml);
            }
            UserDataInfo udi = Cache["UID_" + udc.UserID] as UserDataInfo;

            if (udi == null || ignoreCache)
            {
                udi = new UserDataInfo(udc.UserID);
                Cache.Insert("UID_" + udc.UserID, udi, null, DateTime.Now.AddMinutes(5), System.Web.Caching.Cache.NoSlidingExpiration);
            }
            navXml = navXml.Replace("##NEW_MAIL_COUNT##", udi.UnreadMessagesCount.ToString()).Replace("##FRIEND_REQUEST_COUNT##", udi.FriendRequestCount.ToString()).Replace("##ALERT_COUNT##", udi.AlertCount.ToString());
            navXml = navXml.Replace("##CURRENT_PAGE##", Server.UrlEncode(Request.Url.PathAndQuery));
            return(navXml);
        }
Exemplo n.º 2
0
        public void SendGameData(UserDataInfo player, MsgType messageType, bool messageState, GameDataType gameDataType, string gameDataObject = "")
        {
            var log = new MessageLog
            {
                Type           = messageType,
                State          = messageState,
                GameDataType   = gameDataType,
                GameDataObject = gameDataObject
            };

            player.Logs.Push(log);
            //Log.Debug($"Server sent {log} to {player.AccountName}");

            try
            {
                player.ResponseStream.WriteAsync(new GameServerStream()
                {
                    MessageType  = messageType,
                    MessageState = messageState,
                    Message      = JsonConvert.SerializeObject(new GameData()
                    {
                        GameId         = GameId,
                        PlayerId       = player.PlayerId,
                        GameDataType   = gameDataType,
                        GameDataObject = gameDataObject
                    })
                }).Wait();
            }
            catch
            {
                ;
            }
        }
Exemplo n.º 3
0
        public UserDataInfo SaveWeiXinUser(UserDataInfo userDataInfo)
        {
            UserDataInfo newUserDataInfo = null;

            try
            {
                User user = db.User.FirstOrDefault(n => n.OpenID == userDataInfo.OpenID);
                if (user == null)
                {
                    user                         = new User();
                    user.OpenID                  = userDataInfo.OpenID;
                    user.AttentionDateTime       = userDataInfo.AttentionDateTime;
                    user.CanAttention            = userDataInfo.CanAttention;
                    user.City                    = userDataInfo.City;
                    user.Country                 = userDataInfo.Country;
                    user.CreationDateTime        = userDataInfo.CreationDateTime;
                    user.DisplayName             = userDataInfo.DisplayName;
                    user.IsUse                   = userDataInfo.IsUse;
                    user.Province                = userDataInfo.Province;
                    user.Remark                  = userDataInfo.Remark;
                    user.Sex                     = userDataInfo.Sex;
                    user.SourceProductID         = userDataInfo.SourceProductID;
                    user.UserFace                = userDataInfo.UserFace;
                    user.CancelAttentionDateTime = null;
                    ServerLogger.Info("SaveWeiXinUser :"******"User",
                        Remark         = string.Format("{0}关注了公众号,用户微信数据为:{1}", userDataInfo.DisplayName, Newtonsoft.Json.JsonConvert.SerializeObject(userDataInfo)),
                        CreationDate   = DateTime.Now,
                        CreationUserID = null
                    });
                }
                else
                {
                    if (!user.CanAttention)
                    {
                        user.CanAttention      = true;
                        user.AttentionDateTime = DateTime.Now;
                        db.SaveChanges();
                        AddSystemLog(new SystemLogDataInfo()
                        {
                            ModulePage     = "User",
                            Remark         = string.Format("{0}重新关注了公众号,用户微信数据为:{1}", userDataInfo.DisplayName, Newtonsoft.Json.JsonConvert.SerializeObject(userDataInfo)),
                            CreationDate   = DateTime.Now,
                            CreationUserID = null
                        });
                    }
                }
                newUserDataInfo = SimpleObjectMapper.CreateTargetObject <User, UserDataInfo>(user);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(newUserDataInfo);
        }
Exemplo n.º 4
0
 void InitUserDataInfo()
 {
     userDataInfo = new UserDataInfo()
     {
         programRunTime = "",
         programEndTime = "",
         userScore      = ""
     };
 }
Exemplo n.º 5
0
        private void addButton_Click(object sender, EventArgs e)
        {
            UserDataInfo dataInfo = new UserDataInfo(this.hostTextBox.Text
                                                     , this.emailTextBox.Text, this.usernameTextBox.Text, this.passwordTextBox.Text);

            this.User.AddData(dataInfo);
            DataTranslator.Compose(this.User.Data, this.User.Username, this.User.Key);

            this.hostTextBox.Clear();
            this.emailTextBox.Clear();
            this.usernameTextBox.Clear();
            this.passwordTextBox.Clear();
        }
Exemplo n.º 6
0
        private void doneButton_Click(object sender, EventArgs e)
        {
            this.User.RemoveData(selectedRowIndex);
            UserDataInfo dataInfo = new UserDataInfo(this.hostNameTextBox.Text
                                                     , this.emailTextBox.Text, this.usernameTextBox.Text, this.passwordTextBox.Text);

            this.User.InsertData(selectedRowIndex, dataInfo);

            DataTranslator.Compose(this.User.Data, this.User.Username, this.User.Key);

            this.dataGrid.Enabled = true;
            this.Swipe(false);
        }
Exemplo n.º 7
0
        public static BindingSource Parse(string username, byte[] key)
        {
            BindingSource parsedData = new BindingSource();

            string encryptedData = RegistryData.GetUserData(username);
            string decrypedData  = CryptographicUtilities.Decrypt(encryptedData, key);

            var splitedByHost = decrypedData.Split(new[] { Constants.HostsSplitChar }
                                                   , StringSplitOptions.RemoveEmptyEntries);

            foreach (var info in splitedByHost)
            {
                string[]     splitedInfo = info.Split(Constants.InfoSplitChar);
                UserDataInfo dataInfo    = new UserDataInfo(
                    splitedInfo[0], splitedInfo[1], splitedInfo[2], splitedInfo[3]);
                parsedData.Add(dataInfo);
            }

            return(parsedData);
        }
Exemplo n.º 8
0
        public MatchGameService(GameServerServiceImpl gameServerService, int index, UserDataInfo player1, UserDataInfo player2)
        {
            _gameServerService = gameServerService;
            _random            = new Random();
            GameId             = index;

            Player1             = player1;
            Player1.GameId      = GameId;
            Player1.PlayerId    = 1;
            Player1.PlayerState = PlayerState.None;

            Player2             = player2;
            Player2.GameId      = GameId;
            Player2.PlayerId    = 2;
            Player2.PlayerState = PlayerState.None;

            _id    = 2;
            _token = $"matchgame{GameId}";

            _game = null;
        }
Exemplo n.º 9
0
        public void ProcessRequest(HttpContext context)
        {
            #region "Initialize"

            var strOut = "";

            var paramCmd = Utils.RequestQueryStringParam(context, "cmd");
            var itemId = Utils.RequestQueryStringParam(context, "itemid");
            var ctlType = Utils.RequestQueryStringParam(context, "ctltype");
            var idXref = Utils.RequestQueryStringParam(context, "idxref");
            var xpathpdf = Utils.RequestQueryStringParam(context, "pdf");
            var xpathref = Utils.RequestQueryStringParam(context, "pdfref");
            var lang = Utils.RequestQueryStringParam(context, "lang");
            var language = Utils.RequestQueryStringParam(context, "language");
            var moduleId = Utils.RequestQueryStringParam(context, "mid");
            var moduleKey = Utils.RequestQueryStringParam(context, "mkey");
            var parentid = Utils.RequestQueryStringParam(context, "parentid");
            var entryid = Utils.RequestQueryStringParam(context, "entryid");
            var entryxid = Utils.RequestQueryStringParam(context, "entryxid");
            var catid = Utils.RequestQueryStringParam(context, "catid");
            var catxid = Utils.RequestQueryStringParam(context, "catxid");
            var templatePrefix = Utils.RequestQueryStringParam(context, "tprefix");
            var value = Utils.RequestQueryStringParam(context, "value");
            var itemListName = Utils.RequestQueryStringParam(context, "listname");
            if (itemListName == "") itemListName = "ItemList";
            if (itemListName == "*") itemListName = "ItemList";

            #region "setup language"

            // because we are using a webservice the system current thread culture might not be set correctly,
            //  so use the lang/lanaguge param to set it.
            if (lang == "") lang = language;
            if (!string.IsNullOrEmpty(lang)) _lang = lang;
            // default to current thread if we have no language.
            if (_lang == "") _lang = System.Threading.Thread.CurrentThread.CurrentCulture.ToString();

            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(_lang);

            #endregion

            #endregion

            #region "Do processing of command"

            var intModuleId = 0;
            if (Utils.IsNumeric(moduleId)) intModuleId = Convert.ToInt32(moduleId);

            var objCtrl = new NBrightBuyController();

            var uInfo = new UserDataInfo(UserController.GetCurrentUserInfo().PortalID, intModuleId, objCtrl, ctlType);
            strOut = "ERROR!! - No Security rights for current user!";
            switch (paramCmd)
            {
                case "test":
                    strOut = "<root>" + UserController.GetCurrentUserInfo().Username + "</root>";
                    break;
                case "setdata":
                    break;
                case "deldata":
                    break;
                //case "setcategoryadminform":
                //    if (CheckRights()) strOut = SetCategoryForm(context);
                //    break;
                case "getdata":
                    strOut = GetReturnData(context);
                    break;
                case "additemlist":
                    if (Utils.IsNumeric(itemId))
                    {
                        var cw = new ItemListData(itemListName);
                        cw.Add(itemId);
                        strOut = cw.ItemList;
                    }
                    break;
                case "removeitemlist":
                    if (Utils.IsNumeric(itemId))
                    {
                        var cw1 = new ItemListData(itemListName);
                        cw1.Remove(itemId);
                        strOut = cw1.ItemList;
                    }
                    break;
                case "deleteitemlist":
                        var cw2 = new ItemListData(itemListName);
                        cw2.Delete();
                        strOut = "deleted";
                    break;
                case "getproductselectlist":
                    strOut = GetProductList(context);
                    break;
                case "getproductlist":
                    strOut = GetProductList(context);
                    break;
                case "getcategoryproductlist":
                    strOut = GetCategoryProductList(context);
                    break;
                case "setdefaultcategory":
                    if (CheckRights()) strOut = SetDefaultCategory(context);
                    break;
                case "deletecatxref":
                    if (CheckRights()) strOut = DeleteCatXref(context);
                    break;
                case "selectcatxref":
                    if (CheckRights()) strOut = SelectCatXref(context);
                    break;
                case "deleteallcatxref":
                    if (CheckRights()) strOut = DeleteAllCatXref(context);
                    break;
                case "copyallcatxref":
                    if (CheckRights()) strOut = CopyAllCatXref(context);
                    break;
                case "moveallcatxref":
                    if (CheckRights()) strOut = CopyAllCatXref(context,true);
                    break;
                case "editproduct":
                    if (CheckRights()) strOut = GetProductGeneralData(context);
                    break;
                case "productdescription":
                    if (CheckRights()) strOut = GetProductDescription(context);
                    break;
                case "productmodels":
                    if (CheckRights()) strOut = GetProductModels(context);
                    break;
                case "productoptions":
                    if (CheckRights()) strOut = GetProductOptions(context);
                    break;
                case "productoptionvalues":
                    if (CheckRights()) strOut = GetProductOptionValues(context);
                    break;
                case "productimages":
                    if (CheckRights()) strOut = GetProductImages(context);
                    break;
                case "productdocs":
                    if (CheckRights()) strOut = GetProductDocs(context);
                    break;
                case "productrelatedproducts":
                    if (CheckRights()) strOut = GetProductModels(context);
                    break;
                case "productcategories":
                    if (CheckRights()) strOut = GetProductCategories(context);
                    break;
                case "productisincategory":
                    if (CheckRights()) strOut = ProductIsInCategory(context).ToString();
                    break;
                case "productgroupcategories":
                    if (CheckRights()) strOut = GetProductGroupCategories(context);
                    break;
                case "productrelated":
                    if (CheckRights()) strOut = GetProductRelated(context);
                    break;
                case "addproductmodels":
                    if (CheckRights()) strOut = AddProductModels(context);
                    break;
                case "addproductoptions":
                    if (CheckRights()) strOut = AddProductOptions(context);
                    break;
                case "addproductoptionvalues":
                    if (CheckRights()) strOut = AddProductOptionValues(context);
                    break;
                case "addproductcategory":
                    if (CheckRights()) strOut = AddProductCategory(context);
                    break;
                case "addproductgroupcategory":
                    if (CheckRights()) strOut = AddProductGroupCategory(context);
                    break;
                case "removeproductcategory":
                    if (CheckRights()) strOut = RemoveProductCategory(context);
                    break;
                case "removeproductgroupcategory":
                    if (CheckRights()) strOut = RemoveProductGroupCategory(context);
                    break;
                case "populatecategorylist":
                    if (CheckRights()) strOut = GetGroupCategoryListBox(context);
                    break;
                case "addrelatedproduct":
                    if (CheckRights()) strOut = AddRelatedProduct(context);
                    break;
                case "removerelatedproduct":
                    if (CheckRights()) strOut = RemoveRelatedProduct(context);
                    break;
                case "clientdiscountcodes":
                    if (CheckRights()) strOut = GetClientDiscountCodes(context);
                    break;
                case "addclientdiscountcode":
                    if (CheckRights()) strOut = AddClientDiscountCodes(context);
                    break;
                case "clientvouchercodes":
                    if (CheckRights()) strOut = GetClientVoucherCodes(context);
                    break;
                case "addclientvouchercode":
                    if (CheckRights()) strOut = AddClientVoucherCodes(context);
                    break;
                case "moveproductadmin":
                    if (CheckRights()) strOut = MoveProductAdmin(context);
                    break;
                case "fileupload":
                    if (CheckRights() && Utils.IsNumeric(itemId))
                    {
                        strOut = FileUpload(context);
                    }
                    break;
                case "updateproductimages":
                    if (CheckRights())
                    {
                        UpdateProductImages(context);
                        strOut = GetProductImages(context);
                    }
                    break;
            }

            #endregion

            #region "return results"

                //send back xml as plain text
                context.Response.Clear();
                context.Response.ContentType = "text/plain";
                context.Response.Write(strOut);
                context.Response.End();

            #endregion
        }
Exemplo n.º 10
0
        public override Task <AuthReply> Authentication(AuthRequest request, ServerCallContext context)
        {
            // invalid accountname
            if (request.AccountName == null || request.AccountName.Length < 3)
            {
                Log.Warn($"{request.AccountName} is invalid!");
                return(Task.FromResult(new AuthReply()
                {
                    RequestState = false
                }));
            }

            var user = _registredUsers.Values.ToList().Find(p => p.AccountName == request.AccountName);

            // already authentificated accounts
            if (user != null)
            {
                if (user.Peer.Equals(context.Peer))
                {
                    Log.Warn($"{request.AccountName} is already registred, with the same peer!");
                    return(Task.FromResult(new AuthReply {
                        RequestState = false
                    }));
                }

                // TODO same account with a new connection
                Log.Warn($"{request.AccountName} is already registred, with a different peer!");
                return(Task.FromResult(new AuthReply {
                    RequestState = false
                }));
            }

            var sessionId = NextSessionIndex;
            var userInfo  = new UserDataInfo
            {
                Peer        = context.Peer,
                Token       = Helper.ComputeSha256Hash(sessionId + request.AccountName + context.Peer),
                SessionId   = sessionId,
                AccountName = request.AccountName,
                UserState   = UserState.None,
                GameId      = -1,
                DeckType    = DeckType.None,
                DeckData    = string.Empty,
                PlayerState = PlayerState.None,
                PlayerId    = -1
            };


            // failed registration
            if (!_registredUsers.TryAdd(userInfo.Token, userInfo))
            {
                Log.Warn($"failed to register user with account {request.AccountName}!");
                return(Task.FromResult(new AuthReply {
                    RequestState = false
                }));
            }

            Log.Info($"Successfully registred user with account {request.AccountName}!");

            var reply = new AuthReply
            {
                RequestState   = true,
                RequestMessage = string.Empty,
                SessionId      = userInfo.SessionId,
                SessionToken   = userInfo.Token
            };

            return(Task.FromResult(reply));
        }
Exemplo n.º 11
0
        protected override void OnInit(EventArgs e)
        {
            //// Debug code for cache improvement timing: REMOVE FOR BUILD
            //NBrightLogTrace = NBrightCore.common.Utils.ReadFile(PortalSettings.HomeDirectoryMapPath + "\\NBrightLogTrace.txt");
            //NBrightLogStartTick = DateTime.Now.Ticks;
            //// Debug code for cache improvement timing: REMOVE FOR BUILD

            base.OnInit(e);


            // Attach events
            //NOTE: this event has been removed to stop memory leak (hold on memory) DO NOT PUT IT BACK!!!!
            //GenXmlFunctions.FileHasBeenUploaded += new UploadFileCompleted(OnFileUploaded);

            OverRideInfoList = null;

            if (String.IsNullOrEmpty(ControlAdminPath))
            {
                ControlAdminPath = ControlPath;
            }

            UInfo = new UserDataInfo(PortalId, ModuleId, ObjCtrl, CtrlTypeCode);

            EntityLangauge = Utils.RequestQueryStringParam(Context, "lang");
            if (EntityLangauge.Length != 5)
            {
                EntityLangauge = Utils.GetCurrentCulture();
            }
            //make sure we have a valid culture code in upper and lower case. (url re-writers can make all url lowercase) (none is the default editing langauge for templates/admin content)
            if (EntityLangauge != "none")
            {
                EntityLangauge = EntityLangauge.Substring(0, 2).ToLower() + "-" + EntityLangauge.Substring(3, 2).ToUpper();
            }

            //get the ItemId
            ItemId = Utils.RequestQueryStringParam(Context, "itemid");

            //get the langauge ItemId
            ItemIdLang = Utils.RequestQueryStringParam(Context, "itemidlang");
            if (ItemIdLang == "" && ItemId != "")
            {
                ItemIdLang = "0";
                var obj = GetDataLang();
                if (obj != null)
                {
                    ItemIdLang = obj.ItemID.ToString();
                }
            }

            CtrlSearch = new Repeater();
            this.Controls.Add(CtrlSearch);

            CtrlListMsg = new LiteralControl();
            this.Controls.Add(CtrlListMsg);
            CtrlListMsg.Visible = false;

            CtrlList = new Repeater();
            this.Controls.Add(CtrlList);

            if (!DisablePaging)
            {
                CtrlPaging = new NBrightCore.controls.PagingCtrl();
                this.Controls.Add(CtrlPaging);

                CtrlList.ItemCommand   += new RepeaterCommandEventHandler(CtrlListItemCommand);
                CtrlSearch.ItemCommand += new RepeaterCommandEventHandler(CtrlSearchItemCommand);
                CtrlPaging.PageChanged += new RepeaterCommandEventHandler(PagingClick);
            }


            if (String.IsNullOrEmpty(PrimaryTemplateMapPath))
            {
                PrimaryTemplateMapPath = PortalSettings.HomeDirectoryMapPath;
            }
            if (String.IsNullOrEmpty(SecondaryTemplateMapPath))
            {
                SecondaryTemplateMapPath = MapPath(ControlAdminPath);
            }
            if (String.IsNullOrEmpty(TemplateThemeFolder))
            {
                TemplateThemeFolder = "";                                            // we need a valid value, even if empty
            }
            TemplCtrl = new NBrightCore.TemplateEngine.TemplateGetter(PrimaryTemplateMapPath, SecondaryTemplateMapPath, "NBrightTemplates", TemplateThemeFolder);
        }
Exemplo n.º 12
0
        public void ProcessRequest(HttpContext context)
        {
            #region "Initialize"

            var strOut = "";

            var paramCmd = Utils.RequestQueryStringParam(context, "cmd");
            var itemId = Utils.RequestQueryStringParam(context, "itemid");
            var ctlType = Utils.RequestQueryStringParam(context, "ctltype");
            var idXref = Utils.RequestQueryStringParam(context, "idxref");
            var xpathpdf = Utils.RequestQueryStringParam(context, "pdf");
            var xpathref = Utils.RequestQueryStringParam(context, "pdfref");
            var lang = Utils.RequestQueryStringParam(context, "lang");
            var language = Utils.RequestQueryStringParam(context, "language");
            var moduleId = Utils.RequestQueryStringParam(context, "mid");
            var moduleKey = Utils.RequestQueryStringParam(context, "mkey");
            var parentid = Utils.RequestQueryStringParam(context, "parentid");
            var entryid = Utils.RequestQueryStringParam(context, "entryid");
            var entryxid = Utils.RequestQueryStringParam(context, "entryxid");
            var catid = Utils.RequestQueryStringParam(context, "catid");
            var catxid = Utils.RequestQueryStringParam(context, "catxid");
            var templatePrefix = Utils.RequestQueryStringParam(context, "tprefix");
            var value = Utils.RequestQueryStringParam(context, "value");
            var itemListName = Utils.RequestQueryStringParam(context, "listname");
            if (itemListName == "") itemListName = "ItemList";
            if (itemListName == "*") itemListName = "ItemList";

            #region "setup language"

            // because we are using a webservice the system current thread culture might not be set correctly,
            SetContextLangauge(context);

            #endregion

            #endregion

            try
            {

                #region "Do processing of command"

                var intModuleId = 0;
                if (Utils.IsNumeric(moduleId)) intModuleId = Convert.ToInt32(moduleId);

                var objCtrl = new NBrightBuyController();

                var uInfo = new UserDataInfo(UserController.Instance.GetCurrentUserInfo().PortalID, intModuleId, objCtrl,
                    ctlType);
                strOut = "ERROR!! - No Security rights for current user!";
                switch (paramCmd)
                {
                    case "test":
                        strOut = "<root>" + UserController.Instance.GetCurrentUserInfo().Username + "</root>";
                        break;
                    case "setdata":
                        break;
                    case "deldata":
                        break;
                    //case "setcategoryadminform":
                    //    if (NBrightBuyUtils.CheckRights()) strOut = SetCategoryForm(context);
                    //    break;
                    case "getdata":
                        strOut = GetReturnData(context);
                        break;
                    case "additemlist":
                        if (Utils.IsNumeric(itemId))
                        {
                            var cw = new ItemListData(itemListName);
                            cw.Add(itemId);
                            strOut = cw.ItemList;
                        }
                        break;
                    case "removeitemlist":
                        if (Utils.IsNumeric(itemId))
                        {
                            var cw1 = new ItemListData(itemListName);
                            cw1.Remove(itemId);
                            strOut = cw1.ItemList;
                        }
                        break;
                    case "deleteitemlist":
                        var cw2 = new ItemListData(itemListName);
                        cw2.Delete();
                        strOut = "deleted";
                        break;
                    case "getproductselectlist":
                        strOut = GetProductList(context);
                        break;
                    case "getproductlist":
                        strOut = GetProductList(context);
                        break;
                    case "getcategoryproductlist":
                        strOut = GetCategoryProductList(context);
                        break;
                    case "setdefaultcategory":
                        if (NBrightBuyUtils.CheckRights()) strOut = SetDefaultCategory(context);
                        break;
                    case "deletecatxref":
                        if (NBrightBuyUtils.CheckRights()) strOut = DeleteCatXref(context);
                        break;
                    case "selectcatxref":
                        if (NBrightBuyUtils.CheckRights()) strOut = SelectCatXref(context);
                        break;
                    case "deleteallcatxref":
                        if (NBrightBuyUtils.CheckRights()) strOut = DeleteAllCatXref(context);
                        break;
                    case "copyallcatxref":
                        if (NBrightBuyUtils.CheckRights()) strOut = CopyAllCatXref(context);
                        break;
                    case "moveallcatxref":
                        if (NBrightBuyUtils.CheckRights()) strOut = CopyAllCatXref(context, true);
                        break;
                    case "editproduct":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductGeneralData(context);
                        break;
                    case "productdescription":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductDescription(context);
                        break;
                    case "productmodels":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductModels(context);
                        break;
                    case "productoptions":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductOptions(context);
                        break;
                    case "productoptionvalues":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductOptionValues(context);
                        break;
                    case "productimages":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductImages(context);
                        break;
                    case "productdocs":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductDocs(context);
                        break;
                    case "productrelatedproducts":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductModels(context);
                        break;
                    case "productcategories":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductCategories(context);
                        break;
                    case "productisincategory":
                        if (NBrightBuyUtils.CheckRights()) strOut = ProductIsInCategory(context).ToString();
                        break;
                    case "productgroupcategories":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductGroupCategories(context);
                        break;
                    case "productrelated":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductRelated(context);
                        break;
                    case "productclients":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetProductClients(context);
                        break;
                    case "getclientselectlist":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetClientSelectList(context);
                        break;
                    case "addproductmodels":
                        if (NBrightBuyUtils.CheckRights()) strOut = AddProductModels(context);
                        break;
                    case "addproductoptions":
                        if (NBrightBuyUtils.CheckRights()) strOut = AddProductOptions(context);
                        break;
                    case "addproductoptionvalues":
                        if (NBrightBuyUtils.CheckRights()) strOut = AddProductOptionValues(context);
                        break;
                    case "addproductcategory":
                        if (NBrightBuyUtils.CheckRights()) strOut = AddProductCategory(context);
                        break;
                    case "addproductgroupcategory":
                        if (NBrightBuyUtils.CheckRights()) strOut = AddProductGroupCategory(context);
                        break;
                    case "removeproductcategory":
                        if (NBrightBuyUtils.CheckRights()) strOut = RemoveProductCategory(context);
                        break;
                    case "removeproductgroupcategory":
                        if (NBrightBuyUtils.CheckRights()) strOut = RemoveProductGroupCategory(context);
                        break;
                    case "populatecategorylist":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetGroupCategoryListBox(context);
                        break;
                    case "addrelatedproduct":
                        if (NBrightBuyUtils.CheckRights()) strOut = AddRelatedProduct(context);
                        break;
                    case "removerelatedproduct":
                        if (NBrightBuyUtils.CheckRights()) strOut = RemoveRelatedProduct(context);
                        break;
                    case "addproductclient":
                        if (NBrightBuyUtils.CheckRights()) strOut = AddProductClient(context);
                        break;
                    case "removeproductclient":
                        if (NBrightBuyUtils.CheckRights()) strOut = RemoveProductClient(context);
                        break;
                    case "clientdiscountcodes":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetClientDiscountCodes(context);
                        break;
                    case "addclientdiscountcode":
                        if (NBrightBuyUtils.CheckRights()) strOut = AddClientDiscountCodes(context);
                        break;
                    case "clientvouchercodes":
                        if (NBrightBuyUtils.CheckRights()) strOut = GetClientVoucherCodes(context);
                        break;
                    case "addclientvouchercode":
                        if (NBrightBuyUtils.CheckRights()) strOut = AddClientVoucherCodes(context);
                        break;
                    case "moveproductadmin":
                        if (NBrightBuyUtils.CheckRights()) strOut = MoveProductAdmin(context);
                        break;
                    case "fileupload":
                        if (NBrightBuyUtils.CheckRights() && Utils.IsNumeric(itemId))
                        {
                            strOut = FileUpload(context);
                        }
                        break;
                    case "fileclientupload":
                        if (StoreSettings.Current.GetBool("allowupload"))
                        {
                            strOut = FileUpload(context, itemId);
                        }
                        break;
                    case "updateproductimages":
                        if (NBrightBuyUtils.CheckRights())
                        {
                            UpdateProductImages(context);
                            strOut = GetProductImages(context);
                        }
                        break;
                    case "updateproductdocs":
                        if (NBrightBuyUtils.CheckRights())
                        {
                            UpdateProductDocs(context);
                            strOut = GetProductDocs(context);
                        }
                        break;
                    case "addtobasket":
                        strOut = AddToBasket(context);
                        break;
                    case "addalltobasket":
                        strOut = AddAllToBasket(context);
                        break;
                    case "addcookietobasket":
                        break;
                    case "docdownload":
                        var fname = Utils.RequestQueryStringParam(context, "filename");
                        strOut = fname; // return this is error.
                        var downloadname = Utils.RequestQueryStringParam(context, "downloadname");
                        var fpath = HttpContext.Current.Server.MapPath(fname);
                        if (downloadname == "") downloadname = Path.GetFileName(fname);
                        Utils.ForceDocDownload(fpath, downloadname, context.Response);
                        break;
                    case "printproduct":
                        break;
                    case "removefromcart":
                        RemoveFromCart(context);
                        strOut = "removefromcart";
                        break;
                    case "recalculatecart":
                        RecalculateCart(context);
                        strOut = "recalculatecart";
                        break;
                    case "recalculatesummary":
                        RecalculateSummary(context);
                        strOut = "recalculatecart";
                        break;
                    case "redirecttopayment":
                        strOut = RedirectToPayment(context);
                        break;
                    case "updatebilladdress":
                        strOut = UpdateCartAddress(context, "bill");
                        break;
                    case "updateshipaddress":
                        strOut = UpdateCartAddress(context, "ship");
                        break;
                    case "updateshipoption":
                        strOut = UpdateCartAddress(context, "shipoption");
                        break;
                    case "rendercart":
                        strOut = RenderCart(context);
                        break;
                    case "renderpostdata":
                        strOut = RenderPostData(context);
                        break;
                    case "clearcart":
                        var currentcart = new CartData(PortalSettings.Current.PortalId);
                        currentcart.DeleteCart();
                        strOut = "clearcart";
                        break;
                    case "shippingprovidertemplate":
                        strOut = GetShippingProviderTemplates(context);
                        break;
                    case "getsettings":
                        strOut = GetSettings(context);
                        break;
                    case "savesettings":
                        if (NBrightBuyUtils.CheckRights()) strOut = SaveSettings(context);
                        break;
                    case "updateprofile":
                        strOut = UpdateProfile(context);
                        break;
                    case "dosearch":
                        strOut = DoSearch(context);
                        break;
                    case "resetsearch":
                        strOut = ResetSearch(context);
                        break;
                    case "orderby":
                        strOut = DoOrderBy(context);
                        break;
                    case "orderadmin_getlist":
                        strOut = OrderAdminList(context);
                        break;
                    case "orderadmin_getdetail":
                        strOut = OrderAdminDetail(context);
                        break;
                    case "orderadmin_reorder":
                        strOut = OrderAdminReOrder(context);
                        break;
                    case "orderadmin_edit":
                        strOut = OrderAdminEdit(context);
                        break;
                    case "orderadmin_save":
                        strOut = OrderAdminSave(context);
                        break;
                    case "orderadmin_removeinvoice":
                        strOut = OrderAdminRemoveInvoice(context);
                        break;
                    case "orderadmin_sendemail":
                        strOut = OrderAdminEmail(context);
                        break;
                }

                #endregion

            }
            catch (Exception ex)
            {
                strOut = ex.ToString();
                Exceptions.LogException(ex);
            }

            #region "return results"

            //send back xml as plain text
            context.Response.Clear();
            context.Response.ContentType = "text/plain";
            context.Response.Write(strOut);
            context.Response.End();

            #endregion
        }