Exemplo n.º 1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ItemAdjustment itemadjustment = await db.ItemAdjustments.FindAsync(id);

            db.ItemAdjustments.Remove(itemadjustment);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Edit([Bind(Include = "ItemAdjustmentID,Quantity,Discount,ItemID,EmployeeID,Reason,EffectDate")] ItemAdjustment itemadjustment)
        {
            if (ModelState.IsValid)
            {
                db.Entry(itemadjustment).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.EmployeeID = new SelectList(db.Users, "Id", "UserName", itemadjustment.EmployeeID);
            ViewBag.ItemID     = new SelectList(db.Items, "ItemID", "Name", itemadjustment.ItemID);
            return(View(itemadjustment));
        }
Exemplo n.º 3
0
        // GET: /ItemAdjustmentManager/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ItemAdjustment itemadjustment = await db.ItemAdjustments.FindAsync(id);

            if (itemadjustment == null)
            {
                return(HttpNotFound());
            }
            return(View(itemadjustment));
        }
Exemplo n.º 4
0
        // GET: /ItemAdjustmentManager/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ItemAdjustment itemadjustment = await db.ItemAdjustments.FindAsync(id);

            if (itemadjustment == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EmployeeID = new SelectList(db.Users, "Id", "UserName", itemadjustment.EmployeeID);
            ViewBag.ItemID     = new SelectList(db.Items, "ItemID", "Name", itemadjustment.ItemID);
            return(View(itemadjustment));
        }
    private void LoadItemAdjustmentDetail()
    {
        txtReferenceNo.Focus();

        if (IsEditMode())
        {
            var objItemAdjustment = new ItemAdjustment()
            {
                ItemAdjustmentId = lblItemAdjustmentId.zToInt(),
            }.SelectList <ItemAdjustment>()[0];
            txtReferenceNo.Text    = objItemAdjustment.ReferenceNo;
            txtAdjustmentDate.Text = objItemAdjustment.AdjustmentDate.Value.ToString(CS.ddMMyyyy);
            txtNote.Text           = objItemAdjustment.Note;
        }
        else
        {
            txtReferenceNo.Text    = txtNote.Text = string.Empty;
            txtAdjustmentDate.Text = IndianDateTime.Today.ToString(CS.ddMMyyyy);
        }

        ManageAdjustmentDetail(null, eRepeaterOperation.Select);
    }
Exemplo n.º 6
0
        private void LogItemChanges(Item activeItem,
                                    int itemOptionSet1, int itemOptionSet2, int itemOptionSet3)
        {
            List <int> currentItemOptionSets = new List <int>(activeItem.ItemOptionSetIds);
            List <int> newItemOptionSets     = new List <int>(
                new [] { itemOptionSet1, itemOptionSet2, itemOptionSet3 });

            foreach (int itemOptionSetId in newItemOptionSets.Where(
                         itemOptionSetId => !currentItemOptionSets.Contains(itemOptionSetId) && (itemOptionSetId > 0)))
            {
                ItemAdjustment.Add(SessionManager.ActiveEmployee.Id, ItemAdjustmentType.OptionSetAddition,
                                   activeItem.Id, itemOptionSetId);
            }
            foreach (int itemOptionSetId in currentItemOptionSets)
            {
                // Deletion
                if (!newItemOptionSets.Contains(itemOptionSetId) && (itemOptionSetId > 0))
                {
                    ItemAdjustment.Add(SessionManager.ActiveEmployee.Id, ItemAdjustmentType.OptionSetDeletion,
                                       activeItem.Id, itemOptionSetId);
                }
            }
        }
    private bool SaveData()
    {
        if (!IsValidate())
        {
            return(false);
        }

        string Message           = string.Empty;
        var    objItemAdjustment = new ItemAdjustment()
        {
            OrganizationId = lblOrganizationId.zToInt(),
            OrdersId       = 0,
            ReferenceNo    = txtReferenceNo.Text,
            AdjustmentDate = txtAdjustmentDate.zToDate(),
            Note           = txtNote.Text
        };

        if (IsEditMode())
        {
            objItemAdjustment.ItemAdjustmentId = lblItemAdjustmentId.zToInt();
            objItemAdjustment.Update();

            Message = "Adjustment Change Sucessfully.";
        }
        else
        {
            lblItemAdjustmentId.Text = objItemAdjustment.Insert().ToString();

            Message = "Adjustment Added Sucessfully.";
        }

        ManageAdjustmentDetail(null, eRepeaterOperation.Save);

        CU.ZMessage(eMsgType.Success, string.Empty, Message);

        return(true);
    }