Example #1
0
        public ActionResult DeleteOutRecords()
        {
            //TODO
            string jsonData = Request["ItemCodes"];
            JArray jArray   = JArray.Parse(jsonData);

            foreach (var item in jArray)
            {
                JsonSerializer js    = new JsonSerializer();
                ItemCode       obj   = (ItemCode)js.Deserialize(item.CreateReader(), typeof(ItemCode));
                SqlParameter[] parms = new SqlParameter[]
                {
                    new SqlParameter("@code", obj.Code),
                    new SqlParameter("@seqID", obj.SeqID)
                };
                //TODO try catch
                FixtureOutRecord record = context.OutRecords.SqlQuery("select * from FixtureOutRecord where Code=@code and SeqID=@seqID", parms).Single();
                context.OutRecords.Remove(record);
                context.SaveChanges();
            }
            //return RedirectToAction("Index", "OutRecord");
            // return Redirect("/OutRecord/Index");
            var data = new
            {
                success = true,
            };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public ActionResult AddOutRecord()
        {
            string           Code            = Request["code"];
            int              SeqID           = Convert.ToInt32(Request["seqID"]);
            string           UsedByName      = Request["usedByName"];
            string           OperationByName = Request["operationByName"];
            int              ProLineID       = Convert.ToInt32(Request["proLineID"]);
            DateTime         UsedDate        = Convert.ToDateTime(Request["usedDate"]);
            FixtureOutRecord outRecord       = new FixtureOutRecord();

            outRecord.Code            = Code;
            outRecord.SeqID           = SeqID;
            outRecord.UsedByName      = UsedByName;
            outRecord.OperationByName = OperationByName;
            outRecord.ProLineID       = ProLineID;
            outRecord.UsedDate        = UsedDate;
            //SqlParameter[] parms = new SqlParameter[]
            //{
            //    new SqlParameter ("@code",Code),
            //    new SqlParameter("@seqID",SeqID),
            //    new SqlParameter("@usedByName",UsedByName),
            //    new SqlParameter("@operationByName",OperationByName),
            //    new SqlParameter("@proLineID",ProLineID),
            //    new SqlParameter("@usedDate",UsedDate),
            //};
            //TODO try catch
            context.OutRecords.Add(outRecord);
            context.SaveChanges();
            var data = new
            {
                success = true,
            };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }