示例#1
0
        //
        // GET: CreateEdit
        public ActionResult CreateEdit(string iid)
        {
            UItem item = new UItem();

            item.ItemCatSelect =
                new SelectList(itemService.ItemCatObj.GetItemCategories(), "Id", "CategoryName");

            item.ItemClassSelect = new SelectList(itemService.ItemClassObj.GetItemClassifications(countryProg.Id), "Id", "Name");

            item.ItemUnitsSelect = new SelectList(itemService.ItemClassObj.GetUnitOfMessures(countryProg.Id), "Id", "Code");

            Guid iId;

            if (Guid.TryParse(iid, out iId))
            {
                ViewBag.Action = Resources.Global_String_Edit;
                item._item     = itemService.GetItem(iId);
            }

            ViewBag.Inventory = false;
            if (Request["Inventory"] != null)
            {
                ViewBag.Inventory = true;
            }

            return(View(item));
        }
示例#2
0
 public ActionResult CreateEdit(UItem item, string Action = "")
 {
     if (ModelState.IsValid)
     {
         if (Action.Equals("Edit"))
         {
             item._item.CountryProgrammeId = countryProg.Id;
             if (itemService.EditItem(item._item))
             {
                 ModelState.Clear();
                 item = new UItem();
             }
         }
         else
         {
             item._item.CountryProgrammeId = countryProg.Id;
             if (itemService.AddItem(item._item))
             {
                 ModelState.Clear();
                 item = new UItem();
             }
         }
     }
     return(RedirectToAction("ListView"));
 }
示例#3
0
        public void UpdateShareLinkModelTest()
        {
            UItem uItem = new UItem()
            {
                perm = 25
            };
            var perm = uItem.perm;

            Assert.IsTrue(perm == 25);

            UpdateShareLinkModel updateShareLinkModel = new UpdateShareLinkModel()
            {
                item          = uItem,
                expires_at    = "expires_at",
                limited_times = 10,
                link_id       = "link_id",
                password      = "******",
                title         = "title",
            };
            var item          = updateShareLinkModel.item;
            var expires_at    = updateShareLinkModel.expires_at;
            var limited_times = updateShareLinkModel.limited_times;
            var link_id       = updateShareLinkModel.link_id;
            var password      = updateShareLinkModel.password;
            var title         = updateShareLinkModel.title;

            Assert.IsTrue(item == uItem);
            Assert.IsTrue(limited_times == 10);
            Assert.IsTrue(expires_at == "expires_at");
            Assert.IsTrue(link_id == "link_id");
            Assert.IsTrue(password == "password");
            Assert.IsTrue(title == "title");
        }
示例#4
0
        public ActionResult AddNewItem(UItem model, Guid orId, bool editMode)
        {
            //maintain session OR variable if not null
            if (UserSession.CurrentSession.NewOR != null)
            {
                var or = UserSession.CurrentSession.NewOR;
            }
            Item item = itemService.GetItemByName(model.Name, countryProg.Id);

            if (item == null)
            {
                item                      = new Item();
                item.Name                 = model.Name;
                item.ItemCategoryId       = model.ItemCategoryId;
                item.ItemClassificationId = model.ItemClassificationId;
                item.UnitOfMessureId      = model.UnitId;
                item.CountryProgrammeId   = countryProg.Id;
                item.IsApproved           = false;
                itemService.AddItem(item);
            }
            if (editMode)
            {
                return(AddItemInEditMode(orId));
            }
            return(PopulateCreateItem(orId, "", item.Id));
        }
示例#5
0
 protected override void Parse(EndianBinaryReader r)
 {
     int columnCount = r.ReadInt16();
     int compressedLength = r.ReadInt32();
     Unknown = r.ReadBoolean();
     CompressedChunkColumns = r.ReadBytesOrThrow(compressedLength);
     ColumnMeta = new UItem[columnCount];
     for (int n = 0; n < columnCount; n++)
     {
         ColumnMeta [n] = new UItem(r);
     }
 }
示例#6
0
        protected override void Parse(EndianBinaryReader r)
        {
            int columnCount      = r.ReadInt16();
            int compressedLength = r.ReadInt32();

            Unknown = r.ReadBoolean();
            CompressedChunkColumns = r.ReadBytesOrThrow(compressedLength);
            ColumnMeta             = new UItem[columnCount];
            for (int n = 0; n < columnCount; n++)
            {
                ColumnMeta [n] = new UItem(r);
            }
        }
示例#7
0
        public ActionResult AddNewItem(Guid ppId, bool editMode = false)
        {
            UItem model = new UItem
            {
                ItemCatSelect   = new SelectList(itemService.ItemCatObj.GetItemCategories(), "Id", "CategoryName"),
                ItemClassSelect = new SelectList(itemService.ItemClassObj.GetItemClassifications(countryProg.Id), "Id", "Name"),
                ItemUnitsSelect = new SelectList(itemService.ItemClassObj.GetUnitOfMessures(countryProg.Id), "Id", "Code"),
                EditMode        = editMode
            };

            ViewBag.PPId = ppId;
            return(View("AddNewItem4PP", model));
        }
示例#8
0
        public ActionResult AddNewItem(Guid id, bool editMode = false)
        {
            //maintain session OR variable if not null
            if (UserSession.CurrentSession.NewOR != null)
            {
                var or = UserSession.CurrentSession.NewOR;
            }
            UItem model = new UItem
            {
                ItemCatSelect   = new SelectList(itemService.ItemCatObj.GetItemCategories(), "Id", "CategoryName"),
                ItemClassSelect = new SelectList(itemService.ItemClassObj.GetItemClassifications(countryProg.Id), "Id", "Name"),
                ItemUnitsSelect = new SelectList(itemService.ItemClassObj.GetUnitOfMessures(countryProg.Id), "Id", "Code"),
                EditMode        = editMode
            };

            ViewBag.OrId = id;
            return(View("AddNewItem4OR", model));
        }
示例#9
0
    private void OnGUI()
    {
        EditorGUILayout.Space();

        item = (UItem)EditorGUILayout.EnumPopup(new GUIContent("Select UI element:"), item);

        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, EditorStyles.helpBox, GUILayout.Width(150), GUILayout.Height(200));

        // Show a list of UI Elements
        ShowUIElement();

        EditorGUILayout.EndScrollView();

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();
    }
示例#10
0
        public ActionResult AddNewItem(UItem model, Guid ppId, bool editMode)
        {
            Item item = itemService.GetItemByName(model.Name, countryProg.Id);

            if (item == null)
            {
                item                      = new Item();
                item.Name                 = model.Name;
                item.ItemCategoryId       = model.ItemCategoryId;
                item.ItemClassificationId = model.ItemClassificationId;
                item.UnitOfMessureId      = model.UnitId;
                item.CountryProgrammeId   = countryProg.Id;
                item.IsApproved           = false;
                itemService.AddItem(item);
            }
            if (editMode)
            {
                return(EditPPItem(ppId));
            }
            return(CreatePPItem(ppId));
        }