Esempio n. 1
0
        public IHttpActionResult ChangePassword([FromUri] string code, string newPassword)
        {
            try
            {
                prdAppDb.peAppWvUsers.Where(u => u.code.Equals(code)).Update(n => new peAppWvUser {
                    password = newPassword
                });
                prdAppDb.SaveChanges();
                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());

                throw;
            }
        }
Esempio n. 2
0
        public ActionResult GmoIdelAssets_Create([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")] IEnumerable <GmoIdelAsset> gmoIdelAssets, string userID)
        {
            int _userID    = userID.ToInt();
            var _userInfo  = db.peAppUsers.Where(u => u.ID.Equals(_userID)).Select(u => new { u.Dept, u.LoginName }).FirstOrDefault();
            var results    = new List <GmoIdelAsset>();
            var idelAssets = gmoIdelAssets as IList <GmoIdelAsset> ?? gmoIdelAssets.ToList();

            if (ModelState.IsValid)
            {
                foreach (var gmoIdelAsset in idelAssets)
                {
                    var entity = new GmoIdelAsset
                    {
                        DeptName      = gmoIdelAsset.DeptName,
                        ZicanId       = gmoIdelAsset.ZicanId,
                        ZicanName     = gmoIdelAsset.ZicanName,
                        Pinpai        = gmoIdelAsset.Pinpai,
                        Xinghao       = gmoIdelAsset.Xinghao,
                        CunfangDidian = gmoIdelAsset.CunfangDidian,
                        QidongDate    = gmoIdelAsset.QidongDate,
                        BeginDate     = gmoIdelAsset.BeginDate,
                        Reason        = gmoIdelAsset.Reason,
                        Status        = gmoIdelAsset.Status,
                        Fuzeren       = gmoIdelAsset.Fuzeren,
                        Yuanzhi       = gmoIdelAsset.Yuanzhi,
                        LeijiZhejiu   = gmoIdelAsset.LeijiZhejiu,
                        JingZhi       = gmoIdelAsset.JingZhi,
                        Inputer       = _userInfo.LoginName ?? "",
                        //InputDatetime = DateTime.Now,
                        Modifier       = "",
                        ModifyDatetime = gmoIdelAsset.ModifyDatetime
                    };

                    db.GmoIdelAssets.Add(entity);
                    gmoIdelAsset.Id = entity.Id;
                }
                db.SaveChanges();
            }

            return(Json(idelAssets.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult peAppWvUsers_Create([DataSourceRequest] DataSourceRequest request, UserVm vm)
        {
            if (ModelState.IsValid)
            {
                var entity = new peAppWvUser
                {
                    code = vm.code,
                    name = vm.name,
                    // 6个1
                    password = "******",
                    dept     = vm.dept,
                    SubDept  = vm.SubDept,
                };

                db.peAppWvUsers.Add(entity);
                db.SaveChanges();
                vm.Id = entity.Id;
            }

            return(Json(new[] { vm }.ToDataSourceResult(request, ModelState)));
        }
Esempio n. 4
0
        public ActionResult GmoCapexes_Create([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")] IEnumerable <GmoCapex> gmoCapexs, string userID)
        {
            int _userID    = userID.ToInt();
            var _userInfo  = db.peAppUsers.Where(u => u.ID.Equals(_userID)).Select(u => new { u.Dept, u.LoginName }).FirstOrDefault();
            var gmoCapexes = gmoCapexs as IList <GmoCapex> ?? gmoCapexs.ToList();

            if (ModelState.IsValid)
            {
                foreach (var gmoCapex in gmoCapexes)
                {
                    var entity = new GmoCapex
                    {
                        AnnualBudgetId = gmoCapex.AnnualBudgetId,
                        DeptName       = gmoCapex.DeptName,
                        PrjLeader      = gmoCapex.PrjLeader,
                        PrjName        = gmoCapex.PrjName,
                        YusuanMoney    = gmoCapex.YusuanMoney,
                        BudgetQuarter  = gmoCapex.BudgetQuarter,
                        Status         = gmoCapex.Status,
                        JinduMiaoshu   = gmoCapex.JinduMiaoshu,
                        CapexId        = gmoCapex.CapexId,
                        ShenqingMoney  = gmoCapex.ShenqingMoney,
                        HuiguJieguo    = gmoCapex.HuiguJieguo,
                        Inputer        = _userInfo.LoginName ?? "",
                        //InputDatetime = gmoCapex.InputDatetime,
                        Modifier       = "",
                        ModifyDatetime = gmoCapex.ModifyDatetime
                    };

                    db.GmoCapexes.Add(entity);
                    gmoCapex.Id = entity.Id;
                }
                db.SaveChanges();
            }

            return(Json(gmoCapexes.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult Index(PostedUserMenus postedUserMenus)
        {
            string _userCode = TempData["userCode"] as string;

            dbContext.peAppWvUserMenus.Where(um => um.usercode.Equals(_userCode, StringComparison.CurrentCultureIgnoreCase)).Delete();
            foreach (var menuId in postedUserMenus.MenuIds)
            {
                dbContext.peAppWvUserMenus.Add(new peAppWvUserMenu()
                {
                    menucode = menuId,
                    usercode = _userCode
                });
            }
            dbContext.SaveChanges();
            return(View(GetMenusInitialModel()));
        }
Esempio n. 6
0
 /// <summary>
 /// 登陆成功后/WiFi重新连接时调用
 /// </summary>
 /// <param name="empoNo">员工号</param>
 /// <param name="subDept">分厂</param>
 public void OnLogined(string empoNo, string subDept)
 {
     using (PrdAppDbContext prdAppDb = new PrdAppDbContext())
     {
         var deptGroup = prdAppDb.peAppWvUsers.FirstOrDefault(u => u.SubDept.Equals(subDept));
         if (deptGroup != null)
         {
             var isuser = prdAppDb.peAppWvUsers.FirstOrDefault(u => u.ConnectionId == Context.ConnectionId);
             if (isuser == null)
             {
                 // 更新数据库的登录状态
                 prdAppDb.peAppWvUsers.Where(u => u.code == empoNo).Update(u => new peAppWvUser()
                 {
                     ConnectionId = Context.ConnectionId, IsLogin = true
                 });
                 prdAppDb.SaveChanges();
             }
         }
     }
 }
Esempio n. 7
0
        public IHttpActionResult AddSsCheckYarn([FromBody] SsCheckYarnBindingModel SsCheckYarn)
        {
            if (SsCheckYarn == null)
            {
                return(NotFound());
            }
            var add = new SsCheckYarn()
            {
                InputDate       = SsCheckYarn.InputDate,
                MachineNo       = SsCheckYarn.MachineNo,
                BatchNo         = SsCheckYarn.BatchNo,
                CheckNum        = SsCheckYarn.CheckNum,
                OperateType     = SsCheckYarn.OperateType,
                SongjinNum      = SsCheckYarn.SongjinNum,
                DaxiaoDiffNum   = SsCheckYarn.DaxiaoDiffNum,
                ChengxingBadNum = SsCheckYarn.ChengxingBadNum,
                WorkerClass     = SsCheckYarn.WorkerClass,
                CheckerName     = SsCheckYarn.CheckerName
            };

            db.SsCheckYarns.Add(add);
            db.SaveChanges();
            return(Ok());
        }