Beispiel #1
0
        public ActionResult SaveSingle()
        {
            string month = Request.Params["month"];

            if (month == null)
            {
                return(Json(
                           new OperateResult
                {
                    content = "请输入考核月",
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }
            string data = Request.Params["salaryRecord"];

            if (data == null)
            {
                return(Json(
                           new OperateResult
                {
                    content = "无数据",
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            JavaScriptSerializer js    = new JavaScriptSerializer();
            SalaryRecord         model = js.Deserialize <SalaryRecord>(data);

            if (model == null)
            {
                return(Json(
                           new OperateResult
                {
                    content = "无数据",
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            SalaryRecordManager manager = new SalaryRecordManager();
            OperateResult       or      = manager.Add(model);

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public bool EmployeeSalaryInputStub(string month)
        {
            Random random = new Random();

            QueryParam queryParam = new QueryParam {
                pager = new Pager
                {
                    page = 1,
                    rows = EmployeeStubSize
                }
            };

            FilterModel filter = new FilterModel
            {
                key   = "month",
                value = month
            };
            Dictionary <string, FilterModel> filterSet = new Dictionary <string, FilterModel>();

            filterSet.Add(filter.key, filter);
            queryParam.filters = filterSet;

            var or = SalaryRecordManager.GetAssessmentAll(queryParam);

            if (or.status == OperateStatus.Error)
            {
                return(false);
            }

            dynamic listAssessment = or.data;

            foreach (var ass in listAssessment)
            {
                SalaryRecord e = new SalaryRecord();

                PropertyInfo[] pArray = ass.GetType().GetProperties();
                Type           t      = ass.GetType();

                //e.billSerial = Convert.ToString();
                //e.employeeId = Convert.ToInt64(t.GetProperty("employeeId").GetValue(ass));


                e.billSerial             = t.GetProperty("billSerial").GetValue(ass);
                e.assessmentInfoId       = t.GetProperty("assessmentInfoId").GetValue(ass);
                e.levelSalary            = t.GetProperty("levelSalary").GetValue(ass);
                e.fullAttendanceRewards  = t.GetProperty("fullAttendanceRewards").GetValue(ass);
                e.performanceRewards     = t.GetProperty("performanceRewards").GetValue(ass);
                e.benefitRewards         = t.GetProperty("benefitRewards").GetValue(ass);
                e.seniorityRewards       = t.GetProperty("seniorityRewards").GetValue(ass);
                e.normalOvertimeRewards  = t.GetProperty("normalOvertimeRewards").GetValue(ass);
                e.holidayOvertimeRewards = t.GetProperty("holidayOvertimeRewards").GetValue(ass);
                e.shouldTotal            = t.GetProperty("shouldTotal").GetValue(ass);
                e.actualTotal            = t.GetProperty("actualTotal").GetValue(ass);

                or = SalaryRecordManager.Add(e);
                if (or.status == OperateStatus.Error)
                {
                    StackTrace st  = new StackTrace(new StackFrame(true));
                    string     msg = $"App Trace >>> in file: {st.GetFrame(0).GetFileName()} " +
                                     $"line {st.GetFrame(0).GetFileLineNumber()} message: {or.content}";
                    Trace.WriteLine(msg);
                    return(false);
                }
            }

            return(true);
        }