Ejemplo n.º 1
0
        public IHttpActionResult PutI_StockTaking(int id, I_StockTaking i_StockTaking)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != i_StockTaking.Id)
            {
                return(BadRequest());
            }

            db.Entry(i_StockTaking).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!I_StockTakingExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult CountSheet(int?id, int?GroupId)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (GroupId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            I_StockTaking i_StockTaking = db.I_StockTaking.Find(id);

            Stock obj = new Stock();



            if (i_StockTaking == null)
            {
                return(HttpNotFound());
            }

            obj.Id        = i_StockTaking.Id.ToString();
            obj.Date      = i_StockTaking.Date.ToString();
            obj.Count     = CreateCountName(i_StockTaking.Id.ToString(), i_StockTaking.CreatedOn);
            obj.StoreName = i_StockTaking.Store_Details == null ? (from s in db.Store_Details where s.storeId == i_StockTaking.StoreId select s.storename).FirstOrDefault() : i_StockTaking.Store_Details.storename;
            obj.GroupId   = GroupId.ToString();
            return(View(obj));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            I_StockTaking i_StockTaking = db.I_StockTaking.Find(id);

            db.I_StockTaking.Remove(i_StockTaking);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,StoreId,Date,InventoryTime,InventoryTimeValue,ClosingMethod,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] I_StockTaking i_StockTaking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(i_StockTaking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StoreId = new SelectList(db.Store_Details, "storeId", "storename", i_StockTaking.StoreId);
     return(View(i_StockTaking));
 }
Ejemplo n.º 5
0
        public IHttpActionResult GetI_StockTaking(int id)
        {
            I_StockTaking i_StockTaking = db.I_StockTaking.Find(id);

            if (i_StockTaking == null)
            {
                return(NotFound());
            }

            return(Ok(i_StockTaking));
        }
        // GET: I_StockTaking/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            I_StockTaking i_StockTaking = db.I_StockTaking.Find(id);

            if (i_StockTaking == null)
            {
                return(HttpNotFound());
            }
            return(View(i_StockTaking));
        }
Ejemplo n.º 7
0
        public IHttpActionResult DeleteI_StockTaking(int id)
        {
            I_StockTaking i_StockTaking = db.I_StockTaking.Find(id);

            if (i_StockTaking == null)
            {
                return(NotFound());
            }

            db.I_StockTaking.Remove(i_StockTaking);
            db.SaveChanges();

            return(Ok(i_StockTaking));
        }
        // GET: I_StockTaking/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            I_StockTaking i_StockTaking = db.I_StockTaking.Find(id);

            if (i_StockTaking == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StoreId = new SelectList(db.Store_Details, "storeId", "storename", i_StockTaking.StoreId);
            return(View(i_StockTaking));
        }
        public async Task <ActionResult> AddItems(string StoreId, string Date, string InventoryTime, string ClosingMethod, string Items)
        {
            StockTaking stk = new StockTaking();

            I_StockTaking obj = new I_StockTaking();

            obj.StoreId       = Convert.ToInt32(StoreId);
            obj.Date          = Convert.ToDateTime(Date);
            obj.InventoryTime = Convert.ToInt32(InventoryTime);
            obj.ClosingMethod = Convert.ToInt32(ClosingMethod);
            obj.CreatedBy     = System.Web.HttpContext.Current.User.Identity.Name;
            obj.CreatedOn     = System.DateTime.Now;
            List <int> list = new List <int>();

            string[] arr = Items.Split(',');
            foreach (var item in arr)
            {
                if (item != "")
                {
                    list.Add(Convert.ToInt32(item));
                }
            }
            stk.st    = obj;
            stk.Items = list;


            url = uri + "/api/StockTaking/PostI_StockTaking";
            client.BaseAddress = new Uri(url);
            HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, stk);

            if (responseMessage.IsSuccessStatusCode)
            {
                return(Json(new
                {
                    success = true
                },
                            JsonRequestBehavior.AllowGet));
            }
            return(Json(new
            {
                success = false
            },
                        JsonRequestBehavior.AllowGet));
        }