Returns the item stored in the group at the specified index
Inheritance: Method
Beispiel #1
0
        public void GetItemTest()
        {
            var     itemId  = "282782889148";
            Context context = new Context();

            context.Gateway = Gateway.Production;
            var tokenFilename = "Token.txt";

            Assert.True(
                File.Exists(tokenFilename),
                $"The {tokenFilename} file not found."
                );
            using (StreamReader tokenFile = new StreamReader(tokenFilename))
            {
                context.Token = tokenFile.ReadLine();
            }

            var getItem = new GetItem(context, itemId);

            Assert.True(getItem.exec(), getItem.ErrorMessage);
            Assert.True(getItem.ItemId == itemId);
            var timeDiff = getItem.StandardFields.Timestamp - DateTime.Now;

            Assert.True(Math.Abs(timeDiff.Seconds) < 2);
        }
Beispiel #2
0
        public ActionResult ImgEdit(string[] imgs)
        {
            if (imgs == null || imgs.Length == 0)
            {
                ViewBag.Exit = true;
                return(View());
            }


            List <ClickImgModel> model = new List <ClickImgModel>();
            int index = 0;

            foreach (var img in imgs)
            {
                ClickImgModel data = JsonConvert.DeserializeObject <ClickImgModel>(img);
                if (data.ID == 0)
                {
                    data.ID = GetItem.NewSN();
                }

                model.Add(data);
                index++;
            }

            ViewBag.Data = JsonConvert.SerializeObject(model);
            ViewBag.Exit = true;

            return(View());
        }
 internal ArrayEntries(MemorySnapshotFileReader reader, EntryType entryType,
                       GetItem <T> getItemFunc)
 {
     m_Reader      = reader;
     m_EntryType   = entryType;
     m_GetItemFunc = getItemFunc;
 }
        public ActionResult Edit(PlainTextModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.IsValid = false;
                return(View(model));
            }

            DateTime now = DateTime.Now;

            if (model.ID == 0)
            {
                model.ID         = GetItem.NewSN();
                model.Creator    = MemberDAO.SysCurrent.Id;
                model.CreateTime = now;
            }

            model.Modifier   = MemberDAO.SysCurrent.Id;
            model.ModifyTime = now;

            int result = PlainTextDAO.Instance.Update(model);

            if (result == 0)
            {
                ViewBag.EditResult = "儲存發生錯誤";
            }
            else
            {
                ViewBag.EditResult = "儲存成功";
            }

            return(View(model));
        }
Beispiel #5
0
        public ManagerUsersPage()
        {
            this.InitializeComponent();

            LoadMembers();
            getMembers = new GetItem();
        }
Beispiel #6
0
        public JsonResult UploadPersonPhotoFile(HttpPostedFileBase File, long memberId)
        {
            if (File != null && File.ContentLength > 0)
            {
                string Path = string.Format("{0}/{1}", GetItem.UpdPath(), "Manager");
                if (!System.IO.Directory.Exists(Path))
                {
                    System.IO.Directory.CreateDirectory(Path);
                }
                string saveName = WorkV3.Golbal.UpdFileInfo.SaveFiles(File, Path);

                if (memberId != 0)
                {
                    MemberModels mem = MemberDAO.GetItem(memberId);
                    string       sql = "UPDATE Member  SET Img=@Img WHERE LoginID=@ID";

                    SQLData.Database            db       = new SQLData.Database(WebInfo.Conn);
                    SQLData.ParameterCollection paraList = new SQLData.ParameterCollection();
                    paraList.Add("@ID", mem.LoginID);
                    paraList.Add("@Img", saveName);
                    int exeCount = db.ExecuteNonQuery(sql, paraList);
                }
            }
            return(Json("success"));
        }
Beispiel #7
0
        public override void OnOpen()
        {
            base.OnOpen();
            text.text = content;
            if (fun == Function.CloseDialog)
            {
                btn.onClick.AddListener(ClosePanel);
            }
            else if (fun == Function.Quit)
            {
                btn.onClick.AddListener(OnQuit);
            }
            else if (fun == Function.Tip)
            {
                //                btn.gameObject.SetActive(false);
                btn.onClick.AddListener(ClosePanel);

                MTRunner.Instance.StartRunner(wait());
            }
            else if (fun == Function.OpenDialog)
            {
                Cancelbtn.gameObject.SetActive(true);
                Cancelbtn.onClick.AddListener(ClosePanel);
                Vector3 pos = btn.GetComponent <RectTransform>().position;
                btn.GetComponent <RectTransform>().anchoredPosition = new Vector3(-85.35f, -86f, pos.z);
                btn.onClick.AddListener((() =>
                {
                    ClosePanel();

                    if (viewNames != null)
                    {
                        Open(viewNames);
                    }
                    if (click != null)
                    {
                        click();
                    }
                }
                                         ));
            }
            else if (fun == Function.GetDialog)
            {
                btn.onClick.AddListener(ClosePanel);

                MTRunner.Instance.StartRunner(wait());
                ResourceMgr.Instance.LoadResource("Prefab/GetItem", ((resource, b) =>
                {
                    GameObject go = resource.UnityObj as GameObject;

                    for (int i = 0; i < ids.Count; i++)
                    {
                        GameObject item = GameObject.Instantiate(go);
                        GetItem getItem = item.AddComponent <GetItem>();
                        getItem.SetData(ids[i]);
                        item.transform.SetParent(gridLayout.transform);
                    }
                }));
            }
        }
Beispiel #8
0
 protected override void Awake()
 {
     base.Awake();
     currentSpeed   = walkSpeed;
     playerRb       = GetComponent <Rigidbody2D>();
     spriteRenderer = GetComponent <SpriteRenderer>();
     playerAnimator = GetComponent <Animator>();
     getItem        = GetComponent <GetItem>();
 }
Beispiel #9
0
 public SignUpVM()
 {
     _getMembers      = new GetItem();
     AddNewCustomer   = new Customer();
     AddItemCommand   = new RelayCommand(DoAddItem);
     Collection       = new LoginViewVM();
     _frameNavigation = new FrameNavigationClass();
     LoadCustomers();
 }
Beispiel #10
0
        public string GetFileLink()
        {
            string desc = String.IsNullOrEmpty(Descriptions) ? Descriptions : FileInfo;

            return(string.Format(
                       "<a href=\"{0}\" target=\"_blank\" title=\"{1}\"><img src=\"{2}\" alt=\"\" />{1}</a>",
                       GetItem.UpdPath().TrimEnd('/') + "/" + FileInfo,
                       desc,
                       PubFunc.GetFileIcon(FileInfo)));
        }
Beispiel #11
0
        /// <summary>
        /// 取得實體上傳目錄by SiteID
        /// </summary>
        /// <param name="MenuID"></param>
        /// <param name="SiteID"></param>
        /// <returns></returns>
        public static string GetUPathByMenuID(long SiteID, long MenuID)
        {
            string      Path  = GetItem.UpdPath();
            MenusModels datas = MenusDAO.GetInfo(SiteID, MenuID);

            if (datas != null)
            {
                Path += "\\" + datas.SiteSN + "\\" + datas.SN + "\\";
            }

            return(Path);
        }
Beispiel #12
0
        /// <summary>
        /// 取得瀏覽目錄by SiteID
        /// </summary>
        /// <param name="SiteID"></param>
        /// <param name="MenuID"></param>
        /// <returns></returns>
        public static string GetVPathByMenuID(long SiteID, long MenuID)
        {
            string      Path  = GetItem.ViewUpdUrl().TrimEnd('/');
            MenusModels datas = MenusDAO.GetInfo(SiteID, MenuID);

            if (datas != null)
            {
                Path += "/" + datas.SiteSN + "/" + datas.SN + "/";
            }

            return(Path);
        }
 public void GetItemTest()
 {
     var array = new int[] { 1, 2, 3 };
     var value1 = new GetItem { Context = array, Index = 1 }.Get(new Engine());
     Assert.Equal(2, value1);
     var list = new List<int> { 1, 2, 3 };
     var value2 = new GetItem { Context = list, Index = 1 }.Get(new Engine());
     Assert.Equal(2, value2);
     var dictionary = new Dictionary<string, int> { { "a", 1 }, { "b", 2 } };
     var value3 = new GetItem { Context = dictionary, Index = "b" }.Get(new Engine());
     Assert.Equal(2, value2);
 }
Beispiel #14
0
 public void Destroy(Item item1, Item item2)
 {
     GetItem.square.DestroyBlock();
     if (GetItem.square.type == SquareTypes.WireBlock)
     {
         GetItem.StopDestroy();
     }
     SoundBase.Instance
     .PlayOneShot(SoundBase.Instance.explosion);
     Instantiate(explosion, transform.position, Quaternion.identity);
     DestroyBehaviour();
 }
Beispiel #15
0
        public VaultCLI()
        {
            Double version = Misc.GetOSVersion();

            Console.WriteLine("[*] Detected Windows {0}", version);
            if (6.1 < version)
            {
                getItem = GetItem8;
            }
            else
            {
                getItem = GetItem7;
            }
        }
Beispiel #16
0
    public void ShowRewardVideo(GetItem _getitem)
    {
        if (rewardAdFailToLoad)
        {
            MakeNewRewardAds();
        }
        getItem = _getitem;
        Debug.Log("Show RW");
        if (rewardAds.IsLoaded())
        {
            rewardAds.Show();
        }

//		Advertisement.Show (UnityZoneID, options);
    }
Beispiel #17
0
        public void MenuEdit_Sort()
        {
            string items = Request.Form["items"];

            if (string.IsNullOrWhiteSpace(items))
            {
                return;
            }
            long SiteID = GetItem.SiteID();
            JavaScriptSerializer json     = new JavaScriptSerializer();
            List <MenusModels>   menuList = json.Deserialize <List <MenusModels> >(items);

            MenusDAO.UpdateSort(menuList);
            SysLog.SaveLog(SysActions.Sort, SysMgrNo.Menu, "", SiteID, null, null);
        }
Beispiel #18
0
 public ActionResult MenuEdit_Folder(long?id)
 {
     ViewBag.HasChildren = false;
     if (uCheck.IsNumeric(id))
     {
         MenusModels mm        = MenusDAO.GetInfo(GetItem.SiteID(), (long)id);
         var         childList = MenusDAO.GetChildren(id.Value);
         if (childList != null && childList.Count() > 0)
         {
             ViewBag.HasChildren = true;
         }
         return(View(mm));
     }
     return(View());
 }
Beispiel #19
0
        public void CheckMenuSNisExist()
        {
            long   SiteID    = GetItem.SiteID();
            string SN        = Request["VSN"];
            bool   isExistSN = MenusDAO.isExistSN(SiteID, SN);

            if (isExistSN)
            {
                Response.Write("NO");
            }
            else
            {
                Response.Write("OK");
            }
        }
Beispiel #20
0
        /// <summary>
        /// 取得實體上傳目錄by SiteID
        /// </summary>
        /// <param name="SiteID"></param>
        /// <returns></returns>
        public static string GetUPathBySiteID(long SiteID, string CustomFolder = "")
        {
            string      Path  = GetItem.UpdPath();
            SitesModels datas = SitesDAO.GetInfo(SiteID);

            if (datas != null)
            {
                Path += "\\" + datas.SN + "\\";
            }

            if (CustomFolder != "")
            {
                Path += CustomFolder + "\\";
            }

            return(Path);
        }
Beispiel #21
0
        public void Should_fetch_item_by_id()
        {
            new ItemBuilder().With(i => i.Id, 77)
            .With(cr => cr.Owner, null)
            .With(cr => cr.ItemSource, new ItemSourceBuilder().With(i => i.Id, 35).BuildAndSave())
            .BuildAndSave();

            var cmd = new GetItem {
                ItemId = 77
            };

            var item = DomainRegistry.Repository.FindSingle(cmd);

            Assert.That(item.Id, Is.EqualTo(77));
            Assert.That(item.Owner, Is.Null);
            Assert.That(item.ItemSource.Id, Is.EqualTo(35));
        }
Beispiel #22
0
        public ActionResult VideoEdit(ClickVideoModel model, string customVideo)
        {
            if (model.Type == "custom")
            {
                model.Link = customVideo;
            }

            if (model.ID == 0)
            {
                model.ID = GetItem.NewSN();
            }

            ViewBag.Data = JsonConvert.SerializeObject(model);
            ViewBag.Exit = true;

            return(View());
        }
Beispiel #23
0
        // Token: 0x06001BA5 RID: 7077 RVA: 0x00069FE4 File Offset: 0x000681E4
        private MessageType GetMessage()
        {
            Stopwatch      stopwatch = Stopwatch.StartNew();
            GetItemRequest request   = this.MakeGetItemRequest();
            GetItem        getItem   = new GetItem(base.CallContext, request);

            getItem.PreExecute();
            ServiceResult <ItemType[]> serviceResult = getItem.Execute();

            getItem.SetCurrentStepResult(serviceResult);
            getItem.PostExecute();
            this.Logger.LogInfo("GetMessage() took {0} seconds.", new object[]
            {
                stopwatch.Elapsed.TotalSeconds
            });
            return(serviceResult.Value[0] as MessageType);
        }
Beispiel #24
0
        /// <summary>
        /// 取得瀏覽目錄by SiteID
        /// </summary>
        /// <param name="SiteID"></param>
        /// <returns></returns>
        public static string GetVPathBySiteID(long SiteID, string CustomFolder = "")
        {
            string      Path  = GetItem.ViewUpdUrl().TrimEnd('/');
            SitesModels datas = SitesDAO.GetInfo(SiteID);

            if (datas != null)
            {
                Path += "/" + datas.SN + "/";
            }

            if (CustomFolder != "")
            {
                Path += CustomFolder + "/";
            }

            return(Path);
        }
Beispiel #25
0
        public static void SaveInfo(SysLogModels data)
        {
            SQLData.Database db = new SQLData.Database(WebInfo.Conn);

            SQLData.TableObject TableObj = db.GetTableObject("Syslog");
            TableObj.Add("ID", GetItem.NewSN());

            if (MemberDAO.SysCurrent != null)
            {
                TableObj.Add("MemberID", MemberDAO.SysCurrent.Id);
            }

            if (data.MgrNo != null)
            {
                TableObj.Add("MgrNo", data.MgrNo);
            }

            TableObj.Add("Actions", data.Actions);

            if (data.SiteID != null)
            {
                TableObj.Add("SiteID", data.SiteID);
            }

            if (data.MenuID != null)
            {
                TableObj.Add("MenuID", data.MenuID);
            }

            if (data.SourceID != null)
            {
                TableObj.Add("SourceID", data.SourceID);
            }

            TableObj.Add("ReMark", data.ReMark);
            TableObj.Add("AddTime", DateTime.Now.ToString(WebInfo.DateTimeFmt));

            string IP = GetItem.IPAddr();

            TableObj.Add("IP", IP);
            TableObj.Add("IPNum", GetItem.GetIPNum(IP));

            TableObj.Insert();
        }
        public T GetDataSingle <T>(FileFormat.EntryType entryType, GetItem <T> getItemFunc)
        {
            Chapter chapter = GetChapter(entryType);

            if (!(chapter is SingleValueChapter))
            {
                throw new IOException("Chapter is not a single value chapter");
            }

            uint  blockIndex  = chapter.GetBlockIndex();
            ulong blockOffset = chapter.GetBlockOffsetForEntryIndex(0);
            uint  dataSize    = chapter.GetSizeForEntryIndex(0);

            byte[] data = GetDataCache(dataSize);

            m_Blocks[blockIndex].GetData(blockOffset, dataSize, ref data, m_Reader);

            return(getItemFunc(data, 0, dataSize));
        }
Beispiel #27
0
        public void Should_fetch_item_by_id_with_player()
        {
            var player = new PlayerBuilder()
                         .With(p => p.Id, 99)
                         .With(p => p.FirstName, "Antony")
                         .BuildAndSave();

            new ItemBuilder().With(i => i.Id, 77)
            .With(cr => cr.Owner, player)
            .With(cr => cr.ItemSource, new ItemSourceBuilder().With(i => i.Id, 35).BuildAndSave())
            .BuildAndSave();

            var cmd = new GetItem {
                ItemId = 77
            };
            var item = DomainRegistry.Repository.FindSingle(cmd);

            Assert.That(item.Id, Is.EqualTo(77));
            Assert.That(item.Owner.FirstName, Is.EqualTo("Antony"));
        }
Beispiel #28
0
        public ActionResult MenuAdd()
        {
            ViewBag.SiteID = GetItem.SiteID();
            int AreaID = 1;

            if (uCheck.IsNumeric(Request["AreaID"]))
            {
                AreaID = int.Parse(Request["AreaID"].ToString());
            }
            ViewBag.AreaID = AreaID;


            List <CardsTypeModels> CList = CardsTypeDAO.GetData();

            ViewBag.CardsTypeList   = CList.Where(dr => dr.isOpenCreate == true).ToList();
            ViewBag.CardsTypeListD1 = CList.Where(dr => (dr.Types == (int)CardType.Card || dr.Types == (int)CardType.CardSet) && dr.isOpenCreate == true).ToList();
            ViewBag.CardsTypeListD2 = CList.Where(dr => (dr.Types == (int)CardType.ClassMenu) && dr.isOpenCreate == true).ToList();

            return(View());
        }
Beispiel #29
0
        public void LoginCheck()
        {
            string IP      = GetItem.IPAddr();
            bool   isAllow = IntraIPlimitDAO.isAllowIP(IP);

            if (!isAllow)
            {
                //                WriteLog.Write(true, "LoginCheck is Not Allow IP:" + IP);
                Response.Redirect(Url.Action("Login"));
                TempData["message"] = "您沒有權限登入,請洽詢相關人員";
                return;
            }
            if (Request["txtLoginID"] != null && Request["txtPwd"] != null)
            {
                string sessionId = MemberDAO.LoginCheck(Request["txtLoginID"], Request["txtPwd"]);
                if (sessionId == "isSuspension")
                {
                    TempData["message"] = "該帳號已停權,有任何問題請聯繫系統管理員";
                    Response.Redirect(Url.Action("Login"));
                    return;
                }
                if (sessionId != null)
                {
                    SysLog.SaveLog(SysActions.Login, SysMgrNo.Site, "", null, null, null);
                    HttpCookie cookie = new HttpCookie("sessionId");
                    cookie.Value = sessionId;
                    Response.Cookies.Add(cookie);
                    //Response.Write("Cookie创建完毕");
                    Response.Redirect(Url.Action("Sites"));
                }
                else
                {
                    TempData["message"] = "帳號或密碼錯誤";
                    Response.Redirect(Url.Action("Login"));
                }
            }
            else
            {
                TempData["message"] = "帳號及密碼圴不可空白";
            }
        }
Beispiel #30
0
        public void GetAddMenuTag(long?id)
        {
            long SiteID = GetItem.SiteID();

            if (uCheck.IsNumeric(id))
            {
                MenusModels mm  = MenusDAO.GetInfo(SiteID, (long)id);
                string      Fmt =
                    "<li class=\"dd-item\" data-id=\"" + mm.ID + "\">" +
                    "<div class=\"dd-handle\">" +
                    "    <i class=\"\"></i>" +
                    "    <span class=\"menu-title\">" + mm.Title + "</span>" +
                    "    <span class=\"icons-box\">" +
                    "	 <i class=\""+ mm.GetShowStatusClass() + "\"></i>" +
                    "	 <a class=\"openEdit\" href=\""+ Url.Action(mm.MenuURLAction, "Menus", new { id = mm.ID, SiteID = mm.SiteID }) + "\" data-height=\"" + mm.MenuiFrameH + "\" data-width=\"" + mm.MenuiFrameW + "\"><i class=\"cc cc-settings\"></i></a>" +
                    "    </span>" +
                    "</div>" +
                    "</li>";
                Response.Write(Fmt);
            }
        }
Beispiel #31
0
        public ActionResult VoiceEdit(string[] voices)
        {
            if (voices == null || voices.Length == 0)
            {
                ViewBag.Exit = true;
                return(View());
            }

            ClickVoiceModel model = JsonConvert.DeserializeObject <ClickVoiceModel>(voices[0]);

            if (model.ID == 0)
            {
                model.ID       = GetItem.NewSN();
                model.MimeType = uMimeType.GetMimeType(model.Path);
            }

            ViewBag.Data = JsonConvert.SerializeObject(model);
            ViewBag.Exit = true;

            return(View());
        }
Beispiel #32
0
        private bool DoOpenPath(List<string> candidates, int line, int col)
        {
            Contract.Requires(candidates.Count > 0);

            var paths = new List<string>(candidates);
            if (paths.Count > 2)
            {
                paths.Sort();

                var getter = new GetItem<string>{Title = "Choose Files", Items = paths.ToArray(), AllowsMultiple = true};
                paths = new List<string>(getter.Run(i => i));

                // If the user canceled then we don't want to proceed so we'll say we opened it.
                if (paths.Count == 0)
                    return true;
            }

            bool opened = false;
            if (paths.Count > 0)
            {
                Boss boss = ObjectModel.Create("Application");
                var launcher = boss.Get<ILaunch>();

                var bad = new List<string>();
                foreach (string p in paths)
                {
                    try
                    {
                        launcher.Launch(p, line, col, 1);
                        opened = true;
                    }
                    catch
                    {
                        bad.Add(p);
                    }
                }

                if (bad.Count > 0)
                {
                    NSString title = NSString.Create("Couldn't open.");
                    NSString message = NSString.Create(string.Join("\n", bad.ToArray()));
                    Unused.Value = Functions.NSRunAlertPanel(title, message);
                }
            }

            return opened;
        }
        private string DoGetNamespace(Boss windowBoss, string type)
        {
            if (type.Length == 0)
                throw new InvalidOperationException("Expected a selection with a type name.");

            // Get the namespaces the type is within.
            string[] candidates = DoFindFullNames(windowBoss, type, 12);

            var names = new List<string>();
            foreach (string candidate in candidates)
            {
                string temp = candidate;

                int i = temp.IndexOf('/');	// strip off the nested type
                if (i > 0)
                    temp = temp.Substring(0, i);

                i = temp.LastIndexOf('.');				// strip off the type name
                if (i > 0)
                    names.Add(temp.Substring(0, i));
            }

            // Figure out which namespace we want to add.
            string name = null;
            if (names.Count == 0)
            {
                throw new InvalidOperationException("Couldn't find a type named '" + type + "'.");
            }
            else if (names.Count == 1)
            {
                name = names[0];
            }
            else
            {
                var picker = new GetItem<string>{
                    Title = "Select Namespace",
                    Items = names.ToArray(),
                    AllowsMultiple = false};

                string[] result = picker.Run(s => s);
                if (result.Length == 1)
                    name = result[0];
            }

            return name;
        }
Beispiel #34
0
 void Start()
 {
     aText = GetComponentInChildren<ActivateTextAtLine>();
     gItem = GetComponentInChildren<GetItem>();
     entered = false;
 }