コード例 #1
0
ファイル: TR01MController.cs プロジェクト: WuYen/VN_PURSYS
        public ActionResult CloseConfirmAjax(int TR01A_ID)
        {
            PURSysEntities entity = new Models.PURSysEntities();
            var            result = entity.TR01A.FirstOrDefault(x => x.TR01A_ID == TR01A_ID);

            result.CFN_YN = "Y";
            result.CFN_U2 = UserInfo.Id;
            //var aa = System.Threading.Thread.CurrentThread.CurrentCulture;
            //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
            result.CFN_DT = DateTime.Now.ToString("yyyyMMdd");

            var itemList = entity.TR01B.Where(x => x.TR01A_ID == TR01A_ID).ToList();

            foreach (var item in itemList)
            {
                try
                {
                    item.CFN_QT = entity.TR01C.Where(x => x.TR01B_ID == item.TR01B_ID).Sum(x => x.ARR_QT);
                }
                catch (Exception ex)
                {
                    item.CFN_QT = 0;
                }
            }
            entity.SaveChanges();
            return(new JsonResult {
                Data = new { IsSuccess = "T" }, JsonRequestBehavior = JsonRequestBehavior.DenyGet
            });
        }
コード例 #2
0
ファイル: TR01MController.cs プロジェクト: WuYen/VN_PURSYS
        public ActionResult RejectApplyAjax(int TR01A_ID)
        {
            PURSysEntities entity = new Models.PURSysEntities();
            var            result = entity.TR01A.FirstOrDefault(x => x.TR01A_ID == TR01A_ID);

            result.CFN_YN = "R";
            entity.SaveChanges();
            return(new JsonResult {
                Data = new { IsSuccess = "T" }, JsonRequestBehavior = JsonRequestBehavior.DenyGet
            });
        }
コード例 #3
0
ファイル: FN01Controller.cs プロジェクト: WuYen/VN_PURSYS
        public ActionResult GridViewPartialAddNew(ERP_V2.Models.FN01 item)
        {
            var model = db.FN01;

            item.CREATE_DATE = DateTime.Now;
            item.CREATE_USER = "******";
            if (ModelState.IsValid)
            {
                try
                {
                    model.Add(item);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_GridViewPartial", model.ToList()));
        }
コード例 #4
0
ファイル: TR01MController.cs プロジェクト: WuYen/VN_PURSYS
        private void CheckStatus(int TR01B_ID)
        {
            var entity   = new Models.PURSysEntities();
            var TR01A_ID = entity.TR01B.First(x => x.TR01B_ID == TR01B_ID).TR01A_ID;
            var TR01A    = entity.TR01A.First(x => x.TR01A_ID == TR01A_ID);
            var result   = entity.Database.SqlQuery <int>($"select dbo.Get_Not_Receive_Count({TR01A_ID})").FirstOrDefault();

            if (result != 0)//原本可能是P 但是修改後 變成 N
            {
                TR01A.CFN_YN = "N";
            }
            entity.SaveChanges();

            if (TR01A.CFN_YN == "N" || TR01A.CFN_YN == null || TR01A.CFN_YN == "R")
            {
                ViewBag.Enable = true;
            }
            else
            {
                ViewBag.Enable = false;
            }
        }