예제 #1
0
        public JsonResult appraisaldetailsedit(string id)
        {
            SingleModel data = new SingleModel();

            data = ap_layer.GetAppraisalDetails(id);
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        // PUT api/SingleModel/5
        public HttpResponseMessage PutSingleModel(int id, SingleModel singlemodel)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            if (id != singlemodel.Id)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex));
            }

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
예제 #3
0
        public IActionResult Single(SingleModel model)
        {
            int    userid  = CurrentUser().CurrentUserId;
            string content = model.Post.Body;
            int    blogid  = Convert.ToInt32(HttpContext.Request.Query["id"]);//在ajax里好像没有用

            blogService.AddPost(content, userid, blogService.GetById(blogid.ToString()));

            blogService.SendMessage(blogService.GetById(blogid.ToString()),
                                    userService.GetById(CurrentUser().CurrentUserId.ToString()));

            //添加的逻辑没问题,只是再显示这个页面的时候 关于文章的Model内容没了  所以显示不出
            //此时的Model返回去好像没了之前取到的Blog的关联User
            //应该是Model的问题
            //解决方式应该是Get Post Redirect 方式    还有Ajax20191206
            #region 关于传回Model 其他属性为空 解决方式未定  已解决20191126  使用Redirect
            //model.BlogTime = blogService.GetById(HttpContext.Request.Query["id"]).CreatedTime;
            //model.Title = blogService.GetById(HttpContext.Request.Query["id"]).Title;
            //model.Body = blogService.GetById(HttpContext.Request.Query["id"]).Body;
            //model.BlogAuthor = blogService.GetById(HttpContext.Request.Query["id"]).Author.UserName;
            //model.Posts = blogService.GetById(HttpContext.Request.Query["id"]).Posts;
            #endregion

            return(Redirect("/Blog/Single?id=" + blogid.ToString()));
            //return View(model);
        }
예제 #4
0
        public JsonResult UpdateAppraisal(SingleModel smodel)
        {
            MastersModel mm  = new MastersModel();
            string       res = "";

            try
            {
                res = ap_layer.Update_Appraisal(smodel.EMP_ID, smodel.CURRENTROLL_MGRRATING, smodel.CURRENTROLL_MGREXP, smodel.QUALITYWORK_MGRRATING, smodel.QUALITYWORK_MGREXP, smodel.ORGWORK_MGRRATING, smodel.ORGWORK_MGREXP, smodel.INITIATE_MGRRATING, smodel.INITIATE_MGREXP,
                                                smodel.PERSONAL_MGRRATING, smodel.PERSONAL_MGREXP, smodel.VSKILL_MGRRATING, smodel.VSKILL_MGREXP, smodel.WSKILL_MGRRATING, smodel.WSKILL_MGREXP, smodel.TEAM_MGRRATING, smodel.TEAM_MGREXP, smodel.CONFIDENTIALITY_MGRRATING, smodel.CONFIDENTIALITY_MGREXP,
                                                smodel.ATTENDANCE_MGRRATING, smodel.ATTENDANCE_MGREXP, smodel.SECTION_SECOND_TOTALRATING, smodel.SECTION_ONE_OVERALL_TOTALRATING, smodel.SECTION_2_OVERALL_TOTALRATING_MGR, smodel.SUBTOTAL_MGR, smodel.OVERALL_RATING_MGR, smodel.MGR_RATING);

                //string res1 =ap_layer.AnnualAppraisal(Year, Convert.ToInt32(Session["Emp_id"].ToString()))
                string[] response = res.Split(',');
                if (response[0] == "Success")
                {
                    mm.SuccessMsg = response[1];
                }
                else if (response[0] == "Error")
                {
                    mm.ErrorMsg = response[1];
                }
                AnnualAppraisalForSubmit(2019);
            }
            catch (Exception ex)
            {
                mm.ErrorMsg = ex.Message;
            }
            return(Json(mm, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        /// <summary>
        /// 发布评论
        /// </summary>
        /// <param name="model"></param>
        /// <param name="problemId"></param>
        /// <returns></returns>
        public async Task <ViewModel.Shared.Comment.ItemModel> SaveComment(SingleModel model, int problemId)
        {
            var author = await GetCurrentUser();

            var commentCount = await _context.Comments.Where(x => x.ProblemId == problemId).CountAsync();

            var comment = new Comment
            {
                Body = model.Body,
                //CreateTime=DateTime.Now,
                ProblemId = problemId,
                UserId    = author.Id,
                Floor     = commentCount + 1
            };
            await _context.Comments.AddAsync(comment);

            await _context.SaveChangesAsync();

            return(new ViewModel.Shared.Comment.ItemModel
            {
                Body = comment.Body,
                Author = new UserModel {
                    Id = author.Id, Name = author.Name
                },
                CreateTime = comment.CreateTime,
                Floor = comment.Floor
            });
        }
예제 #6
0
        public void HoleGridSelectChange()
        {
            if (Holerec != null)
            {
                List <DataPoint>    DataPoints = new List <DataPoint>();
                List <Models.Point> points     = new List <Models.Point>();
                points = CommonMethods.StringToList(Holerec.Data);
                for (int j = 0; j < points.Count; j++)
                {
                    var temppoint = new DataPoint(points[j].x * Global.SystemPara.con_factor_x,
                                                  points[j].y * Global.SystemPara.con_factor_y);
                    DataPoints.Add(temppoint);
                }

                OxyPlot.Series.LineSeries lineSeries = new OxyPlot.Series.LineSeries();
                lineSeries.Points.AddRange(DataPoints);
                lineSeries.Color               = OxyColor.FromRgb(255, 0, 0);
                lineSeries.StrokeThickness     = 1;
                lineSeries.TrackerFormatString = "{0}\n{1}: {2:0.#}mm\n{3}: {4:0.##}Mpa";
                SingleModel.Series.Clear();
                SingleModel.Series.Add(lineSeries);
                SingleModel.Title = "Work" + Workrec.SerialNo + " Hole" + Holerec.HoleNumber.ToString() + "'s Chart";
                SingleModel.InvalidatePlot(true);
            }
        }
예제 #7
0
        public SingleModel GetById(int id)
        {
            Article     article = articleRepository.Find(id);
            SingleModel model   = mapper.Map <SingleModel>(article);

            return(model);
        }
예제 #8
0
        public async Task <IActionResult> Single(int id)
        {
            var model = new SingleModel();

            model.Item = await _problemService.GetItem(id);

            return(View(model));
        }
예제 #9
0
        public ActionResult Add()
        {
            var viewModel = new SingleModel <ArticleCategory>()
            {
                ActionType = ActionType.Add
            };

            return(View(viewModel));
        }
    public static void Main()
    {
        SingleModel single = SingleModel.GetInstance();

        single.Message();

        SingleModel single2 = SingleModel.GetInstance();

        single2.Message();
    }
예제 #11
0
        public static void Result(SingleModel singleModel)
        {
            for (int i = 0; i < singleModel.AmountTimes; i++)
            {
                result = result + singleModel.Character;
            }

            Console.WriteLine(result);
            Console.ReadLine();
        }
예제 #12
0
        // GET api/SingleModel/5
        public SingleModel GetSingleModel(int id)
        {
            SingleModel singlemodel = db.SingleModels.Find(id);

            if (singlemodel == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(singlemodel);
        }
예제 #13
0
        public async Task <IActionResult> Single(int id, SingleModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await _problemService.SaveComment(model, id);

            return(Redirect($"/Problem/{id}"));
        }
        public IActionResult List()
        {
            //GENERATE RAND NUMBER FOR ID
            Random rand     = new Random();
            int    PrId     = rand.Next(1, _DataContext.Primary.Count() + 1);
            var    _Primary = _DataContext.Primary.Find(PrId);

            int SeId       = rand.Next(1, _DataContext.Secondary.Count() + 1);
            var _Secondary = _DataContext.Secondary.Find(SeId);

            int LeId    = rand.Next(1, _DataContext.Lethal.Count() + 1);
            var _Lethal = _DataContext.Lethal.Find(LeId);

            int TacId     = rand.Next(1, _DataContext.Tactical.Count() + 1);
            var _Tactical = _DataContext.Tactical.Find(TacId);


            var _Perks = _DataContext.Perks;

            SingleModel dto = new SingleModel();

            dto.PriName   = _Primary.Name;
            dto.PriImage  = _Primary.Image;
            dto.SecName   = _Secondary.Name;
            dto.SecImage  = _Secondary.Image;
            dto.TecName   = _Tactical.Name;
            dto.TecImage  = _Tactical.Image;
            dto.LethName  = _Lethal.Name;
            dto.LethImage = _Lethal.Image;


            //TRY TO ADD THREE PERKS BUT RANDOM TO A LIST
            List <PerksModel> p = new List <PerksModel>();

            for (int i = 0; i < _DataContext.Perks.Count() + 1; i++)
            {
                int PeId = rand.Next(1, _DataContext.Perks.Count() + 1);

                //CHECKS IF THE PERKS IS ALREADY IN THE P LIST

                if (!p.Contains(_Perks.Find(PeId)) && p.Count() < 3)
                {
                    p.Add(_Perks.Find(PeId));
                }
            }
            //NOW I NEED TO FIND A AWAY TO NOT GET THE SAME ONE FROM THE SAME PERKNUM.

            dto.perks = p;



            return(View(dto));
        }
예제 #15
0
        public virtual JsonResult Single([FromForm] SingleModel singleModel, [FromServices] IRepositoryBase repository)
        {
            RestResponseDto res = new RestResponseDto();

            T entity = repository.QueryFirst <T>(x => x.Id == singleModel.Id, singleModel.Include);

            res.Data = new object[] { entity };

            res.Success = true;

            return(Json(res));
        }
예제 #16
0
        public T CreateCmd <T>(SnakeBlock excer, ICmdParam param) where T : SnakeCmd
        {
            if (param != null)
            {
                ObjectCacheModel cache = SingleModel <ObjectCacheModel> .Get();

                T cmd = cache.GetObjectCache <T>();
                cmd.Gen(excer, param);
                return(cmd);
            }
            else
            {
                return(null);
            }
        }
예제 #17
0
        // POST api/SingleModel
        public HttpResponseMessage PostSingleModel(SingleModel singlemodel)
        {
            if (ModelState.IsValid)
            {
                db.SingleModels.Add(singlemodel);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, singlemodel);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = singlemodel.Id }));
                return(response);
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
        }
예제 #18
0
        public static string GetValue(string key)
        {
            string value = RedisUtil.Get <string>("WebConfig_" + key);

            if (string.IsNullOrEmpty(value))
            {
                WebConfig model = SingleModel.GetModel("WebKey='" + key + "'");
                if (model == null)
                {
                    value = string.Empty;
                }
                else
                {
                    value = model.WebValue;
                }
                RedisUtil.Set <string>("WebConfig_" + key, value);
            }
            return(value.Trim('"'));
        }
예제 #19
0
        public IActionResult Single()
        {
            SingleModel model = new SingleModel();
            string      id    = HttpContext.Request.Query["id"];

            //string currentUser=HttpContext.Session.GetString("Username");
            //int currentId = JsonConvert.DeserializeObject<LogViewModel>(currentUser).CurrentUserId;
            if (suggestService.FindBySuggestId(Convert.ToInt32(id)) != null)
            {
                model.Title = suggestService.FindBySuggestId(Convert.ToInt32(id)).Title;
                model.Body  = suggestService.FindBySuggestId(Convert.ToInt32(id)).Body;

                return(View(model));
            }
            else
            {
                return(View("Index"));
            }
        }
예제 #20
0
        public static string GetValueOrDefault(string key, string defaultValue)
        {
            string value = RedisUtil.Get <string>("WebConfig_" + key);

            if (string.IsNullOrWhiteSpace(value))
            {
                WebConfig model = SingleModel.GetModel("WebKey='" + key + "'");
                if (model == null)
                {
                    value = defaultValue;
                }
                else
                {
                    value = model.WebValue;
                }
                RedisUtil.Set <string>("WebConfig_" + key, value);
            }
            return(value.Trim('"'));
        }
예제 #21
0
    //---------------------------------------------------------------------------------------------------------------
    public void AssignTask(SingleModel model)
    {
        if (model.IsNull())
        {
            Debug.LogError("Attempt to assign null model to task.");
            return;
        }
        this.Model      = model;
        this.TaskRender = GameObject.Instantiate(this.Model.GetModelObject, this.transform);
        this.TaskRender.transform.localScale    = new Vector3(TaskRenderScale, TaskRenderScale, TaskRenderScale);
        this.TaskRender.transform.localPosition = new Vector3(0, -40, -60);
        this.TaskRender.transform.localRotation = Quaternion.identity;
        this.TaskRender.transform.localRotation =
            Quaternion.Euler(this.TaskRender.transform.localRotation.x - 60,
                             this.TaskRender.transform.localRotation.y + 30,
                             this.TaskRender.transform.localRotation.z);

        this.TaskRender.transform.SetAsFirstSibling();
    }
예제 #22
0
        public SingleModel GetSingleById(int id)
        {
            Article article = articleRepository.Find(id);
            //SingleModel model = mapper.Map<SingleModel>(article);
            User        user  = userRepository.GetById(article.AuthorId);
            SingleModel model = new SingleModel
            {
                Id     = article.Id,
                Title  = article.Title,
                Body   = article.Body,
                Author = new UserModel
                {
                    Id   = user.Id,
                    Name = user.Name
                }
            };

            return(model);
        }
예제 #23
0
        public SinglePage(Window window, SettingsModel settings, GameDB gameDb)
        {
            _window   = window;
            _settings = settings;
            _gameDb   = gameDb;
            _cancellationTokenSource = new CancellationTokenSource();

            InitializeComponent();

            Model = new SingleModel
            {
                Icon0 = new ResourceModel()
                {
                    Type = ResourceType.ICON0
                },
                Icon1 = new ResourceModel()
                {
                    Type = ResourceType.ICON1
                },
                Pic0 = new ResourceModel()
                {
                    Type = ResourceType.PIC0
                },
                Pic1 = new ResourceModel()
                {
                    Type = ResourceType.PIC1
                },
                Snd0 = new ResourceModel()
                {
                    Type = ResourceType.SND0
                },
                IsDirty     = false,
                MaxProgress = 100,
                Progress    = 0,
                Discs       = DummyDisc(0, 5).ToList()
            };

            DataContext = Model;

            //Closing += OnClosing;
        }
예제 #24
0
        public ActionResult Detail(long questionId, int PageIndex = 1, int replyPageSize = 10)
        {
            var parameters = new Dictionary <string, string>()
            {
                { "questionId", questionId.ToString() },
                { "replyPageIndex", PageIndex.ToString() },
                { "replyPageSize", replyPageSize.ToString() }
            };

            var responseResult = PostStandardWithSameControllerAction <QuestionDetailWithReplyListOutput>(this, parameters);
            var model          = new SingleModel <QuestionDetailWithReplyListOutput>
            {
                Data      = responseResult.Entity,
                IsSuccess = responseResult.IsSuccess
            };

            ViewBag.PageIndex   = PageIndex;
            ViewBag.PageSize    = replyPageSize;
            ViewBag.RecordCount = responseResult.TotalNums;
            return(View(model));
        }
예제 #25
0
        // DELETE api/SingleModel/5
        public HttpResponseMessage DeleteSingleModel(int id)
        {
            SingleModel singlemodel = db.SingleModels.Find(id);

            if (singlemodel == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            db.SingleModels.Remove(singlemodel);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, singlemodel));
        }
예제 #26
0
        public ActionResult Edit(int CatId)
        {
            var responseResult = PostStandardWithControllerAction <ArticleCategory>(
                "ArticleCategory", "Detail",
                new Dictionary <string, string> {
                { "catId", CatId.ToString() }
            });

            if (responseResult.IsSuccess)
            {
                var viewModel = new SingleModel <ArticleCategory>()
                {
                    IsSuccess  = true,
                    ActionType = ActionType.Edit,
                    Data       = responseResult.Entity
                };

                return(View("Add", viewModel));
            }

            TempData["Error"] = responseResult.Message;
            return(RedirectToAction("List"));
        }
예제 #27
0
        public IActionResult Single()
        {
            SingleModel model = new SingleModel();

            string id = HttpContext.Request.Query["id"];

            if (blogService.GetById(id) != null)
            {
                model.Id       = Convert.ToInt32(id);
                model.BlogTime = blogService.GetById(id).CreatedTime;
                model.Title    = blogService.GetById(id).Title;
                model.Body     = blogService.GetById(id).Body;
                #region 使用登录状态获取用户名,使用级联加载后不再需要
                //string user = HttpContext.Session.GetString("Username");
                //viewModel = JsonConvert.DeserializeObject<LogViewModel>(user);
                //model.CurrentUsername = viewModel.CurrentUsername;
                #endregion
                model.BlogAuthor = blogService.GetById(id).Author.UserName;
                //model.Keywords = blogService.GetById(id).Keywords;
                model.Posts    = blogService.GetById(id).Posts;
                model.Keywords = blogService.GetById(id).Keywords;

                //前台得不到当前登录用户   todo

                if (CurrentUser() == null)
                {
                }
                else
                {
                    model.CurrentUserId = CurrentUser().CurrentUserId;
                }

                return(View(model));
            }
            return(View());
        }
예제 #28
0
 public static SingleModel GetInstance()
 {
     //?? 运算符称为 null 合并运算符,用于定义可以为 null 值的类型和引用类型的默认值。
     //如果此运算符的左操作数不为 null,则此运算符将返回左操作数;否则返回右操作数。
     return(_singleModel ?? (_singleModel = new SingleModel()));
 }
예제 #29
0
        public ActionResult Single(int id)
        {
            SingleModel model = articleService.GetSingleById(id);

            return(View(model));
        }
예제 #30
0
 public void Form()
 {
     singleModel = Views.One.Form.EnterChar();
 }