public ActionResult ValueRecord(int id)
        {
            Valuable_List model = Bll.BllValuable_List.First(o => o.Id == id);

            if (model == null)
            {
                return(MessageBoxAndReturn("价值观配置不存在!"));
            }

            var yearAndMonth = GetYearAndMonth();

            var record = Bll.BllValuable_Records.First(o => o.UserId == MyInfo.Id && o.Vid == model.Id && o.Year == yearAndMonth.Item1 && o.Month == yearAndMonth.Item2);

            IList <Valuable_Sample> samplelist = null;

            if (record != null)
            {
                samplelist = Bll.BllValuable_Sample.GetList(record.Id);
            }

            ViewBag.samplelist   = samplelist;
            ViewBag.record       = record;
            ViewBag.currentMonth = yearAndMonth.Item2;
            ViewBag.currentYear  = yearAndMonth.Item1;
            ViewBag.rankclass    = Bll.BllRank_Class.Instance().GetListByParentId(0, false);
            return(View(model));
        }
Beispiel #2
0
        private void GetActStr(Valuable_List model, int listCount, int i)
        {
            StringBuilder actStr = new StringBuilder();

            actStr.Append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"250\"><tr><form name=\"upform\"><td width=\"70\">");
            if (i > 0)
            {
                actStr.Append($"<select id=\"stepUp{model.Id}\" > ");
                for (int j = 1; j <= i; j++)
                {
                    actStr.Append("<option value=\"" + j + "\">" + j + "</option>");
                }
                actStr.Append($"</select><input type=\"button\" name=\"Submit2\" value=\"↑\" class=\"btn btn-default\" onclick=\"SetMove('{model.Id}','up')\"> ");
            }
            actStr.Append("</td></form><form name=\"downform\"><td  width=\"70\">");
            if (i < listCount - 1)
            {
                actStr.Append($"<select id=\"stepDown{model.Id}\" > ");
                for (int j = 1; j <= listCount - i - 1; j++)
                {
                    actStr.Append("<option value=\"" + j + "\">" + j + "</option>");
                }
                actStr.Append($"</select><input type=\"button\" name=\"Submit2\" value=\"↓\" class=\"btn btn-default\" onclick=\"SetMove('{model.Id}','down')\"> ");
            }
            actStr.Append("</td></form></tr></table>");
            model.actStr = actStr.ToString();
        }
Beispiel #3
0
        public ActionResult Save()
        {
            int    id      = RequestInt("id");
            int    classid = RequestInt("classid");
            string content = RequestString("content");
            bool   belock  = RequestBool("belock");
            int    score   = RequestInt("score");

            Valuable_List model     = null;
            string        classHtml = string.Empty;

            if (id > 0)
            {
                model           = Bll.BllValuable_List.First(o => o.Id == id);
                model.Content   = content;
                model.BeLock    = !belock;
                model.ClassId   = classid;
                model.Score     = score;
                model.ClassName = Bll.BllSys_Class <Valuable_Class> .Instance().GetClassName(classid);

                model.UserId = MyInfo.Id;

                if (Bll.BllValuable_List.Update(model, o => o.Id == id) > 0)
                {
                    return(LayerAlertSuccessAndRefresh("修改成功"));
                }
                else
                {
                    return(LayerAlertSuccessAndRefresh("修改失败"));
                }
            }
            else
            {
                model           = new Valuable_List();
                model.Content   = content;
                model.BeLock    = !belock;
                model.ClassId   = classid;
                model.Score     = score;
                model.ClassName = Bll.BllSys_Class <Valuable_Class> .Instance().GetClassName(classid);

                model.UserId     = MyInfo.Id;
                model.CreateTime = DateTime.Now;
                model.Sequence   = Bll.BllSys_Class <Valuable_List> .Instance().GetNextSequence("");

                if (Bll.BllValuable_List.Insert(model) > 0)
                {
                    return(LayerAlertSuccessAndRefresh("添加成功"));
                }
                else
                {
                    return(LayerAlertSuccessAndRefresh("添加失败"));
                }
            }
        }
        public ActionResult ChildSave()
        {
            int    id     = RequestInt("id");
            int    rid    = RequestInt("rid");
            int    rank   = RequestInt("rank");
            string remark = RequestString("remark");

            if (id == 0)
            {
                return(MessageBoxAndReturn("价值观配置不存在!"));
            }
            if (rid == 0)
            {
                return(MessageBoxAndReturn("记录不存在!"));
            }
            if (rank == 0)
            {
                return(MessageBoxAndReturn("请选择一个评分项!"));
            }

            Valuable_List model = Bll.BllValuable_List.First(o => o.Id == id);

            if (model == null)
            {
                return(MessageBoxAndReturn("价值观配置不存在!"));
            }
            Valuable_Records record = Bll.BllValuable_Records.First(o => o.Id == rid);

            if (record == null)
            {
                return(MessageBoxAndReturn("该员工未自评!"));
            }

            record.Score       = Bll.BllRank_Class.First(o => o.Id == rank)?.Score ?? 0;
            record.ApproveTime = DateTime.Now;
            record.IsApprove   = true;
            record.ParUserId   = MyInfo.Id;
            record.ParUserName = MyInfo.RealName;
            record.Remark      = remark;
            int count = Bll.BllValuable_Records.Update(record, o => o.Id == rid);

            if (count > 0)
            {
                return(MessageBoxAndJump("审核成功!", $"/valuable/valuable/childvaluelist?userId={record.UserId}&year={record.Year}&month={record.Month}"));
            }
            else
            {
                return(MessageBoxAndReturn("审核出错!请联系管理员"));
            }
        }
Beispiel #5
0
        public ActionResult Edit(int id = 0)
        {
            Valuable_List model     = null;
            string        classHtml = string.Empty;

            if (id > 0)
            {
                model     = Bll.BllValuable_List.First(o => o.Id == id);
                classHtml = Bll.BllValuable_Class.Instance().ShowClass(0, model.ClassId.Value, true);
            }
            else
            {
                classHtml = Bll.BllValuable_Class.Instance().ShowClass(0, 0, true);
            }
            ViewBag.classHtml = classHtml;
            return(View(model));
        }
        public ActionResult ChildValueRecord(int id, int userId, int year, int month)
        {
            Valuable_List model = Bll.BllValuable_List.First(o => o.Id == id);

            if (model == null)
            {
                return(MessageBoxAndReturn("价值观配置不存在!"));
            }

            var record = Bll.BllValuable_Records.First(o => o.UserId == userId && o.Vid == model.Id && o.Year == year && o.Month == month);

            if (record == null)
            {
                return(MessageBoxAndReturn("该员工未自评!"));
            }

            int nextWorkmonth = GetNextWorkerMonth(year, month);

            //ViewBag.isLock = (GetWorkerMonth(year, month) != GetWorkerMonth(DateTime.Now.Year, DateTime.Now.Month) || year != DateTime.Now.Year);
            ViewBag.samplelist = Bll.BllValuable_Sample.GetList(record.Id);
            ViewBag.record     = record;
            ViewBag.rankclass  = Bll.BllRank_Class.Instance().GetListByParentId(0, false);
            return(View(model));
        }
        public ActionResult Save()
        {
            int id           = RequestInt("id");
            int rid          = RequestInt("rid");
            int rank         = RequestInt("rank");
            var yearAndMonth = GetYearAndMonth();

            string[] sampleIds = RequestString("sampleId").TrimEnd(',').Split(',');

            if (id == 0)
            {
                return(MessageBoxAndReturn("价值观配置不存在!"));
            }
            if (rank == 0)
            {
                return(MessageBoxAndReturn("请选择一个评分项!"));
            }
            Valuable_List model = Bll.BllValuable_List.First(o => o.Id == id);

            if (model == null)
            {
                return(MessageBoxAndReturn("价值观配置不存在!"));
            }

            //所选分值对应所需的案例个数
            int sampleNum = Bll.BllRank_Class.Instance().First(rank, "SampleNum")?.SampleNum ?? 0;

            List <Valuable_Sample> samplelist = null;

            if (sampleIds != null && sampleIds.Length > 0)
            {
                samplelist = new List <Valuable_Sample>();
                int sampleId = 0;
                foreach (string sid in sampleIds)
                {
                    if (int.TryParse(sid, out sampleId))
                    {
                        samplelist.Add(new Valuable_Sample()
                        {
                            Content = RequestString("sample" + sampleId)
                        });
                    }
                }
            }

            //判断案例数是否达标
            if (sampleNum > 0 && samplelist != null && samplelist.Count < sampleNum)
            {
                return(MessageBoxAndReturn($"请填入至少{sampleNum}个案例!"));
            }

            Valuable_Records record = null;

            if (rid > 0)
            {
                record = Bll.BllValuable_Records.First(o => o.Id == rid);
                if (record.IsApprove.Value)
                {
                    return(MessageBoxAndReturn("该记录已评审,禁止修改!"));
                }

                record.Rank       = rank;
                record.RankScore  = Bll.BllRank_Class.First(o => o.Id == rank)?.Score ?? 0;
                record.UpdateTime = DateTime.Now;
                record.UserId     = MyInfo.Id;
                record.Vid        = id;
                Bll.BllValuable_Records.Update(record, o => o.Id == rid);
            }
            else
            {
                bool isExist = Bll.BllValuable_Records.IsExist(MyInfo.Id, yearAndMonth.Item1, yearAndMonth.Item2, id);
                if (isExist)
                {
                    return(MessageBoxAndReturn("请勿重复提交!"));
                }
                record            = new Valuable_Records();
                record.CreateTime = DateTime.Now;
                record.Rank       = rank;
                record.RankScore  = Bll.BllRank_Class.First(o => o.Id == rank)?.Score ?? 0;
                record.Score      = 0;
                record.UpdateTime = DateTime.Now;
                record.UserId     = MyInfo.Id;
                record.Vid        = id;
                record.Year       = yearAndMonth.Item1;
                record.Month      = yearAndMonth.Item2;
                record.IsApprove  = false;
                rid = Bll.BllValuable_Records.Insert(record);
            }
            if (rid > 0)
            {
                //添加记录
                Bll.BllValuable_Sample.Add(rid, samplelist);
                return(MessageBoxAndJump("提交成功!", $"/valuable/valuable/valuelist?year={yearAndMonth.Item1}&month={yearAndMonth.Item2}"));
            }
            return(MessageBoxAndReturn("提交失败!"));
        }