Esempio n. 1
0
        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
            });
        }
Esempio n. 2
0
        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
            });
        }
Esempio n. 3
0
        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;
            }
        }