Exemple #1
0
        public void RefreshNewAddedRows(ChatMessageViewModel chatModel, ChatMessage savedMessages)
        {
            DateItem dateItem = new DateItem();

            dateItem.setDate(chatModel.MessageTime.ToShortDateString());
            var  listofDates = consolidatedList.Where(a => a.getType() == 0).ToList();
            bool dateExist   = false;

            for (int i = 0; i < listofDates.Count; i++)
            {
                ListItem msg      = listofDates[i];
                DateItem DateItem = (DateItem)msg;
                if (DateItem.getDate() == dateItem.getDate())
                {
                    dateExist = true;
                }
            }
            if (!dateExist)
            {
                consolidatedList.Add(dateItem);
            }

            GeneralItem generalItem = new GeneralItem();

            generalItem.setChatMessagearray(savedMessages);
            consolidatedList.Add(generalItem);
            tblChatList.ReloadData();
            ScrollToBottom(true);
            filePath      = "";
            thumbFilePath = "";
        }
Exemple #2
0
        public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
        {
            ListItem msg = messages[indexPath.Row];

            if (msg.getType() == 1)
            {
                List <ChatAttachment> AttachList = new List <ChatAttachment>();

                GeneralItem GeneralItem = (GeneralItem)msg;

                var item = GeneralItem.getChatMessagearray();
                AttachList = (item.ChatMessageId != 0) ? Repositories.ChatAttachmentRepository.GetChatAttachList(item.ChatMessageId) : new List <ChatAttachment>();
                if (AttachList.Count > 0)
                {
                    return(ChatBubbleWithAttachmentCell.GetHeight(tableView, item.MessageText, "10:11 PM").Height);
                }
                else
                {
                    return(ChatBubbleCell.GetHeight(tableView, item.MessageText, "10:11 PM").Height);
                }
            }
            else
            {
                return(32);
            }// return ChatBubbleCell.GetSizeForText(tableView, messages[indexPath.Row].Text).Height + ChatBubbleCell.BubblePadding.Height;
             //Message msg = messages[indexPath.Row];
             //return CalculateHeightFor(msg, tableView);
        }
    private void OnGrab(CallbackData data)
    {
        Interactable interactable = ((Hand)data.DataObject).Connector.GrabbedInteractable;

        if (interactable == null)
        {
            return;
        }

        GeneralItem item = interactable as GeneralItem;

        if (item == null)
        {
            return;
        }

        if (hints.ContainsKey(item.ObjectType))
        {
            CreateHint(GetHintString(item.ObjectType, hints[item.ObjectType]));
        }
        if (videos.ContainsKey(item.ObjectType))
        {
            CreateVideoHint(videos[item.ObjectType]);
        }
    }
    /// <summary>
    /// Once fired by an event, checks if the item is correct and sets corresponding condition to be true.
    /// </summary>
    /// <param name="data">Refers to the GameObject that was picked up.</param>
    private void PickupObject(CallbackData data)
    {
        GameObject  g    = data.DataObject as GameObject;
        GeneralItem item = g.GetComponent <GeneralItem>();

        if (item == null)
        {
            return;
        }
        ObjectType type = item.ObjectType;

        switch (type)
        {
        case ObjectType.Syringe:
            EnableCondition(Conditions.SyringePickedUp);
            break;

        case ObjectType.Needle:
            EnableCondition(Conditions.NeedlePickedUp);
            break;

        case ObjectType.Luerlock:
            EnableCondition(Conditions.LuerlockPickedUp);
            break;

        case ObjectType.SyringeCapBag:
            EnableCondition(Conditions.SyringeCapBagPickedUp);
            break;
        }
        CompleteTask();
    }
    private void AddSyringe(CallbackData data)
    {
        //virhetilanteet: pieni ruisku yhdistetty ennen lääkkeellisen ruiskun laittamista
        GameObject  g    = data.DataObject as GameObject;
        GeneralItem item = g.GetComponent <GeneralItem>();
        Syringe     s    = item.GetComponent <Syringe>();

        if (s.Container.Capacity == RIGHT_SMALL_SYRINGE_CAPACITY)
        {
            usedSyringes.Add(s);
            Logger.Print("Added new syringe to used: " + usedSyringes.Count);
        }

        if (!attachedSyringes.ContainsKey(s.GetInstanceID()) && !s.hasBeenInBottle)
        {
            attachedSyringes.Add(s.GetInstanceID(), s.Container.Amount);
        }
        if (!IsPreviousTasksCompleted(requiredTasks))
        {
            return;
        }
        else if (!laminarCabinet.GetContainedItems().Contains(s))
        {
            CreateTaskMistake("Ruisku kiinnitettiin laminaarikaapin ulkopuolella", 1);
            attachedSyringes.Remove(s.GetInstanceID());
        }
        else
        {
            base.package.MoveTaskToManager(this);
        }
    }
Exemple #6
0
    private void DestroyCapBagAndInitFactory()
    {
        if (trueCapBag != null && itemContainer.Contains(trueCapBag))
        {
            Logger.Print("Syringe cap bag still inside cabinet, destroying bag and setting factory active...");

            Logger.Print("Setting IsClean of caps inside laminar cabinet to " + trueCapBag.IsClean);
            syringeCapFactory.GetComponent <GeneralItem>().Contamination = trueCapBag.Contamination;
            foreach (Interactable obj in itemContainer.Objects)
            {
                GeneralItem item = obj as GeneralItem;
                if (item == null)
                {
                    continue;
                }
                if (item.ObjectType == ObjectType.SyringeCap)
                {
                    item.Contamination = trueCapBag.Contamination;
                }
            }

            //capBag.DestroyInteractable();
            DisableTrueCapBag();
        }
        else
        {
            Logger.Print("Syringe cap bag not inside cabinet anymore, won't destroy or set factory active");
        }
    }
Exemple #7
0
    private void PrepareObjectForRemoving(GeneralItem item)
    {
        if (item.IsGrabbed)
        {
            item.Interactors.Hand.Connector.Connection.Remove();
        }

        if (item.ObjectType == ObjectType.Needle)
        {
            ((Needle)item).ReleaseItem();
        }
        else if (item.ObjectType == ObjectType.Luerlock)
        {
            ((LuerlockAdapter)item).ReleaseItems();
        }

        if (item.IsAttached)
        {
            if (item.State == InteractState.LuerlockAttached)
            {
                item.Interactors.LuerlockPair.Value.GetConnector(item.Interactors.LuerlockPair.Key).Connection.Remove();
            }
            else if (item.State == InteractState.NeedleAttached)
            {
                item.Interactors.Needle.Connector.Connection.Remove();
            }
        }
    }
Exemple #8
0
    private void CorrectItems(CallbackData data)
    {
        if ((DoorGoTo)data.DataObject != DoorGoTo.EnterWorkspace)
        {
            return;
        }
        if (cabinet == null)
        {
            Popup("Kerää tarvittavat työvälineet läpiantokaappiin.", MsgType.Notify);
            return;
        }
        List <Interactable> containedObjects = cabinet.GetContainedItems();

        if (containedObjects.Count == 0)
        {
            Popup("Kerää tarvittavat työvälineet läpiantokaappiin.", MsgType.Notify);
            return;
        }

        int gCount = 0;

        foreach (Interactable obj in containedObjects)
        {
            GeneralItem g = obj as GeneralItem;
            if (g == null)
            {
                continue;
            }

            if (!g.IsClean)
            {
                if (g.ObjectType == ObjectType.Bottle && g.Contamination == GeneralItem.ContaminateState.Contaminated)
                {
                    continue;
                }
                CreateTaskMistake("Läpiantokaapissa oli likainen esine", 1);
            }
        }

        if (gCount - 11 > 0)
        {
            int minus = gCount - 11;
            CreateTaskMistake("Läpiantokaapissa oli liikaa esineitä", minus);
        }

        objectCount = containedObjects.Count;
        CheckConditions(containedObjects);
        if (door.IsClosed)
        {
            CompleteTask();
            if (!IsCompleted())
            {
                MissingItems();
            }
        }
        else
        {
            Popup("Sulje läpi-antokaapin ovi.", MsgType.Notify);
        }
    }
        internal bool AddShoppingListAdditionalItem(int menuId, string itemName)
        {
            using (DataContext)
            {
                try
                {
                    ShoppingListAdditionalItem additionalItem = new ShoppingListAdditionalItem {
                        MenuId = menuId
                    };

                    GeneralItem generalItem = DataContext.GeneralItems.SingleOrDefault(gi => gi.GeneralItemName.Trim() == itemName.Trim());
                    if (generalItem != null)
                    {
                        additionalItem.GeneralItemId = generalItem.GeneralItemId;
                    }
                    else
                    {
                        additionalItem.ItemName = itemName;
                    }

                    DataContext.ShoppingListAdditionalItems.Add(additionalItem);
                    DataContext.SaveChanges();

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }
Exemple #10
0
    public void EnterTrashbin(Collider other)
    {
        GeneralItem item = GeneralItem.Find(other.transform);

        if (item != null)
        {
            if (trashType == TrashType.Sharp && item.ObjectType != ObjectType.Needle)
            {
                TaskBase.CreateGeneralMistake("Normaali esine laitettiin terävien roskikseen", 1, true);
                Events.FireEvent(EventType.ItemDroppedInWrongTrash);
            }
            else if (trashType == TrashType.Nonsharp && item.ObjectType == ObjectType.Needle)
            {
                TaskBase.CreateGeneralMistake("Neula laitettiin normaaliin roskikseen", 1, true);
                Events.FireEvent(EventType.ItemDroppedInWrongTrash);
            }

            //PrepareObjectForRemoving(item);

            if (item.ObjectType == ObjectType.Luerlock)
            {
                Logger.Print("Trash bin luerlock count: " + ((LuerlockAdapter)item).AttachedInteractables.Count);
            }

            PrepareObjectForRemoving(item);

            Events.FireEvent(EventType.ItemDroppedInTrash, CallbackData.Object(item));
            item.DestroyInteractable();
        }
    }
Exemple #11
0
    protected override void OnTaskComplete()
    {
        return;

        CabinetBase cabinet = null;

        foreach (CabinetBase c in GameObject.FindObjectsOfType <CabinetBase>())
        {
            if (c.type == CabinetBase.CabinetType.Laminar)
            {
                cabinet = c;
            }
        }

        foreach (Interactable interactable in cabinet.GetContainedItems())
        {
            GeneralItem g = interactable as GeneralItem;
            if (g != null && !g.IsClean)
            {
                Logger.Warning("Possibly deprecated minus disinfect bottle");
                CreateTaskMistake("Pullon korkkia ei puhdistettu", 1);
                return;
            }
        }
    }
Exemple #12
0
        internal bool SaveGeneralItem(GeneralItem Item)
        {
            using (DataContext)
            {
                try
                {
                    if (!DataContext.GeneralItems.Contains(Item))
                    {
                        // Item.CreatedDate = DateTime.Now;
                        Item.SortOrder = DataContext.GeneralItems.Max(d => d.SortOrder) + 1;
                        DataContext.GeneralItems.Add(Item);
                        //DataContext.GeneralItems.InsertOnSubmit(Item);
                    }
                    else
                    {
                        string ItemName = Item.GeneralItemName;
                        Item = DataContext.GeneralItems.Single(d => d.GeneralItemId == Item.GeneralItemId);
                        Item.GeneralItemName = ItemName;
                    }

                    //Item.ModifiedDate = DateTime.Now;
                    DataContext.SaveChanges();
                    //DataContext.SubmitChanges();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }
 private void CheckHandGrab(Hand hand, ref bool check, ref GameObject display)
 {
     if (hand.IsGrabbed)
     {
         if (!check)
         {
             if (hand.Connector.Connection == null)
             {
                 return;
             }
             GameObject obj = hand.Connector.Connection.gameObject;
             obj = Interactable.GetInteractableObject(obj.transform);
             GeneralItem item = obj.GetComponent <GeneralItem>();
             if (item.ObjectType == ObjectType.Syringe)
             {
                 InstantiateSyringeDisplay(ref display, obj);
             }
             check = true;
         }
     }
     else
     {
         check = false;
         if (display != null)
         {
             Destroy(display);
         }
     }
 }
    /// <summary>
    /// Once fired by an event, checks if and how Luerlock was attached as well as previous required task completion.
    /// Sets corresponding conditions to be true.
    /// </summary>
    /// <param name="data">"Refers to the data returned by the trigger."</param>
    private void AttachLuerlock(CallbackData data)
    {
        GameObject  g    = data.DataObject as GameObject;
        GeneralItem item = g.GetComponent <GeneralItem>();

        if (item == null)
        {
            return;
        }

        if (laminarCabinet == null)
        {
            CreateTaskMistake("Ruisku kiinnitettiin liian aikaisin.", 1);
            Fail();
            return;
        }
        else if (!laminarCabinet.GetContainedItems().Contains(item))
        {
            CreateTaskMistake("Ruisku kiinnitettiin laminaarikaapin ulkopuolella", 1);
            Fail();
            return;
        }

        if (!IsPreviousTasksCompleted(requiredTasks))
        {
            Popup("Ota ruiskuun lääkettä ennen luerlockiin yhdistämistä.", MsgType.Notify);
            return;
        }

        ObjectType type = item.ObjectType;

        if (type == ObjectType.Syringe)
        {
            MedicineSyringeCheck(item);
        }

        if (!item.IsClean)
        {
            CreateTaskMistake("Ruisku oli likainen", 1);
            Fail();
        }

        CompleteTask();

        if (!IsCompleted())
        {
            if (!firstCheckDone)
            {
                CreateTaskMistake("Luerlockia ei kiinnitetty ensin lääkkeelliseen ruiskuun", 1);
                Popup("Luerlockia ei kiinnitetty ensin lääkkeelliseen ruiskuun.", MsgType.Mistake, -1);
                firstCheckDone = true;
                Fail();
            }
            else
            {
                Popup("Kiinnitä ensin lääkkeellinen ruisku", MsgType.Mistake);
            }
        }
    }
Exemple #15
0
    private void EnterCabinet(Interactable other)
    {
        GeneralItem item = other as GeneralItem;

        if (item == null)
        {
            return;
        }

        if (this.type == CabinetType.Laminar)
        {
            if (FirstEnterObjects.ContainsKey(item))
            {
                if (!FirstEnterObjects[item])
                {
                    TaskBase.CreateGeneralMistake("Esineitä ei saa tuoda pois työskentelytilasta");
                    FirstEnterObjects[item] = true;
                }
            }
            else
            {
                FirstEnterObjects.Add(item, false);
            }
        }

        if (item.Contamination == GeneralItem.ContaminateState.FloorContaminated && this.type == CabinetType.Laminar)
        {
            Logger.Print("Item was on floor: " + item.name);
            TaskBase.CreateGeneralMistake("Lattialla olevia esineitä ei saa tuoda laminaarikaappiin");

            // To force Contaminated state you need to set the state to Clean first. Look at the Contaminated property and fix it T. previous ryhmä
            item.Contamination = GeneralItem.ContaminateState.Clean;
            item.Contamination = GeneralItem.ContaminateState.Contaminated;
        }

        if (Time.timeSinceLevelLoad > 1)
        {
            UnfoldCloth();
        }

        if (!itemPlaced)
        {
            Events.FireEvent(EventType.ItemPlacedForReference, CallbackData.Object(this));
            itemPlaced = true;
        }
        if (this.type == CabinetType.Laminar)
        {
            Events.FireEvent(EventType.ItemPlacedInCabinet, CallbackData.Object(item));
        }

        ObjectType type           = item.ObjectType;
        Types      underlyingType = CheckItemType(type, item, enteringCabinet: true);

        if (underlyingType != Types.Null)
        {
            missingObjects[underlyingType]--;
        }
    }
    private void MedicineSyringeCheck(GeneralItem item)
    {
        Syringe syringe = item.GetComponent <Syringe>();

        if (syringe.Container.Amount > 0)
        {
            EnableCondition(Conditions.SyringeWithMedicineAttached);
        }
    }
        public async Task <string> CreateHealthRecordAsync(string userName, GeneralItem generalItem)
        {
            var record = await Client()
                         .Child(_usersDocumentAlias)
                         .Child(userName)
                         .Child(_healthEventAlias)
                         .PostAsync(generalItem);

            return(record.Key);
        }
Exemple #18
0
 private void CopyChildStates(GeneralItem original, GeneralItem copy)
 {
     if (original.ObjectType == ObjectType.Needle &&
         original as Needle is var needleOriginal &&
         copy as Needle is var needleCopy)
     {
         if (needleOriginal.Connector.HasAttachedObject)
         {
             needleCopy.Connector.AttachedInteractable.State = needleOriginal.Connector.AttachedInteractable.State.Copy();
         }
     }
 /// <summary>
 /// Заполняет матрицу, используя юзер рейтинги для соответствующих элементов.
 /// Рассматриваются юзеры, которые оценили оба элемента
 /// </summary>
 /// <param name="itemA"></param>
 /// <param name="itemB"></param>
 private void calculate(GeneralItem itemA, GeneralItem itemB)
 {
     itemA.getAllRatings().ForEach(delegate(GeneralRating r)
     {
         GeneralRating r2 = itemB.getUserRating(r.getUserId());
         if (r2 != null)
         {
             int i = r.getRating() - 1;
             int j = r2.getRating() - 1;
             matrix[i, j]++;
         }
     });
 }
Exemple #20
0
    private void ItemLiftedFromFloor(CallbackData data)
    {
        GeneralItem item = (GeneralItem)data.DataObject;

        if (G.Instance.Progress.CurrentPackage.name == PackageName.EquipmentSelection)
        {
            return;
        }

        if (!startedCleanup && !item.IsClean)
        {
            TaskBase.CreateTaskMistakeGlobal(TaskType.ScenarioOneCleanUp, "Siivoa lattialla olevat esineet vasta lopuksi", 1);
        }
    }
Exemple #21
0
    private void ExitCabinet(Interactable other)
    {
        GeneralItem item = other as GeneralItem;

        if (item == null)
        {
            return;
        }

        ObjectType type           = item.ObjectType;
        Types      underlyingType = CheckItemType(type, item, enteringCabinet: false);

        ReAddMissingObjects(underlyingType);
    }
Exemple #22
0
    private void CheckConditions(List <Interactable> containedObjects)
    {
        foreach (Interactable value in containedObjects)
        {
            GeneralItem item = value as GeneralItem;
            ObjectType  type = item.ObjectType;
            switch (type)
            {
            case ObjectType.Syringe:
                Syringe syringe = item as Syringe;
                if (syringe.Container.Capacity == 20000)
                {
                    EnableCondition(Conditions.BigSyringe);
                }
                else if (syringe.Container.Capacity == 1000)
                {
                    smallSyringes++;
                    if (smallSyringes == 6)
                    {
                        EnableCondition(Conditions.SmallSyringes);
                    }
                }
                break;

            case ObjectType.Needle:
                EnableCondition(Conditions.Needle);
                break;

            case ObjectType.Luerlock:
                EnableCondition(Conditions.Luerlock);
                break;

            case ObjectType.SyringeCapBag:
                EnableCondition(Conditions.SyringeCapBag);
                break;

            case ObjectType.Bottle:
                MedicineBottle bottle = item as MedicineBottle;
                if (bottle.Container.Capacity == 4000 || bottle.Container.Capacity == 16000)
                {
                    EnableCondition(Conditions.RightBottle);
                }
                if (bottle.Container.Capacity == 4000)
                {
                    correctMedicineBottle = true;
                }
                break;
            }
        }
    }
    protected void rolGeneralItems_ItemDataBound(object sender, ReorderListItemEventArgs e)
    {
        ReorderListItem rolItem = e.Item as ReorderListItem;
        LinkButton      btn     = rolItem.FindControl("btnUpdate") as LinkButton;
        GeneralItem     Item    = e.Item.DataItem as GeneralItem;

        if (Item != null)
        {
            btn.PostBackUrl = string.Format("~/Admin/GeneralItem.aspx?ItemId={0}", Item.GeneralItemId);
        }

        btn         = rolItem.FindControl("btnDelete") as LinkButton;
        btn.Visible = Item.AllowDelete;
        btn.Attributes.Add("ItemId", Item.GeneralItemId.ToString());
    }
Exemple #24
0
    private void RemoveSyringe(CallbackData data)
    {
        GameObject  g    = data.DataObject as GameObject;
        GeneralItem item = g.GetComponent <GeneralItem>();
        Syringe     s    = item.GetComponent <Syringe>();

        int minus    = 0;
        int oldMinus = 0;

        if (!usedSyringes.ContainsKey(s))
        {
            return;
        }
        oldMinus = usedSyringes[s];

        if (s.Container.Amount != MINIMUM_CORRECT_AMOUNT_IN_SMALL_SYRINGE && !s.IsClean)
        {
            minus += 2;
            CreateTaskMistake("Väärä määrä lääkettä ruiskussa ja likainen", 0);
        }
        else if (s.Container.Amount != MINIMUM_CORRECT_AMOUNT_IN_SMALL_SYRINGE)
        {
            minus++;
            CreateTaskMistake("Väärä määrä lääkettä", 0);
        }
        else if (!s.IsClean)
        {
            minus++;
            CreateTaskMistake("Ruisku tai luerlock oli likainen", 0);
        }
        else
        {
            Popup("Ruiskuun otettiin oikea määrä lääkettä.", MsgType.Done);
        }

        if (minus > oldMinus)
        {
            usedSyringes[s] = minus;
        }

        if (usedSyringes.Count >= 6)
        {
            CreateTaskMistake(null, GetTotalMinus());
            G.Instance.Progress.ForceCloseTask(TaskType.SyringeAttach, false);
            G.Instance.Progress.ForceCloseTask(taskType, false);
            Logger.Print("CLOSED SYRINGE ATTACH AND CORRECT AMOUNT");
        }
    }
Exemple #25
0
 public void GetItem()
 {
     if (state == 5 && tarItem != null)
     {
         if (tarItem.owner != null)
         {
             tarItem = null;
             state   = 0;
         }
         else if (Vector2.Distance(transform.position, tarItem.transform.position) < radius + tarItem.radius)
         {
             state = 0;
             if (tarItem.consumable)
             {
                 bool have = false;
                 foreach (GeneralItem thing in Item)
                 {
                     if (thing.name == tarItem.name)
                     {
                         thing.num++;
                         have = true;
                         Destroy(tarItem.gameObject);
                         break;
                     }
                 }
                 if (!have && Item.Count < 5)
                 {
                     tarItem.owner = gameObject;
                     tarItem.PassiveEffect();
                     Item.Add(tarItem);
                     tarItem = null;
                 }
             }
             else if (Item.Count < 5)
             {
                 tarItem.owner = gameObject;
                 tarItem.PassiveEffect();
                 Item.Add(tarItem);
             }
             tarItem = null;
         }
         else
         {
             transform.position = Moveing(tarPoint);
         }
     }
 }
Exemple #26
0
    private void Start()
    {
        GetComponent <MeshRenderer>().enabled = false;

        itemContainer         = gameObject.AddComponent <TriggerInteractableContainer>();
        itemContainer.OnEnter = OnTrueEnter;
        itemContainer.OnExit  = OnTrueExit;

        StartCoroutine(SearchInteractable());

        IEnumerator SearchInteractable()
        {
            yield return(null);

            generalItem = (GeneralItem)Interactable.GetInteractable(transform);
        }
    }
        public ActionResult <GeneralItemDTO> AddItem(GeneralItemDTO item)
        {
            IdentityUser currentUser = GetCurrentUser();

            if (currentUser == null)
            {
                return(BadRequest());
            }

            GeneralCategory category     = _itemRepository.GetCategoryBy(item.Category.Id);
            GeneralItem     itemToCreate = new GeneralItem(item, category, currentUser);

            _itemRepository.Add(itemToCreate);
            _itemRepository.SaveChanges();

            return(Ok(itemToCreate.Id));
        }
    /// <summary>
    /// Once fired by an event, checks if the item is bottle and sets the corresponding condition to be true.
    /// </summary>
    /// <param name="data">Refers to the data returned by the trigger.</param>
    private void PickupObject(CallbackData data)
    {
        GameObject  g    = data.DataObject as GameObject;
        GeneralItem item = g.GetComponent <GeneralItem>();

        if (item == null)
        {
            return;
        }
        ObjectType type = item.ObjectType;

        if (type == ObjectType.Bottle)
        {
            EnableCondition(Conditions.BottlePickup);
        }
        CompleteTask();
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        this.Validate();
        if (!this.IsValid)
        {
            return;
        }

        GeneralItem Item = new GeneralItem();

        Item.GeneralItemId   = this.ItemId == null ? -1 : this.ItemId.Value;
        Item.GeneralItemName = this.txtItemName.Text;

        if (BusinessFacade.Instance.SaveGeneralItem(Item))
        {
            this.Response.Redirect("~/Admin/GeneralItemsList.aspx");
        }
    }
Exemple #30
0
        internal bool DeleteGeneralItem(int GeneralItemId)
        {
            using (DataContext)
            {
                try
                {
                    GeneralItem Item = DataContext.GeneralItems.Single(sd => sd.GeneralItemId == GeneralItemId);
                    DataContext.GeneralItems.DeleteOnSubmit(Item);
                    DataContext.SubmitChanges();

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }