Пример #1
0
        private void ExportNormalInfo(int i, DataRow dr)
        {
            dr[0] = _AssessActivityList[i].ItsEmployee.Account.Name;
            if (_AssessActivityList[i].ItsEmployee.Account.Position.Grade != null)
            {
                dr[1] = _AssessActivityList[i].ItsEmployee.Account.Position.Grade.Name;
            }
            dr[2] = _AssessActivityList[i].ItsEmployee.EmployeeDetails.Work.ComeDate;
            dr[3] =
                _AssessActivityList[i].ItsEmployee.EmployeeDetails.Education.EducationalBackground.Name;
            dr[4] = _AssessActivityList[i].ItsEmployee.Account.Dept.DepartmentName;
            BindItemValueCollection collection =
                _GetBindField.BindItemValueCollection(_AssessActivityList[i].ItsEmployee.Account.Id,
                                                      _AssessActivityList[i].ScopeFrom, _AssessActivityList[i].ScopeTo);

            foreach (BindItemValue item in collection.BindItemValueList)
            {
                if (item.BindItemEnum.Id == BindItemEnum.OutCityDays.Id)
                {
                    dr[9] = item.Value;
                }
                else if (item.BindItemEnum.Id == BindItemEnum.Absenteeism.Id)
                {
                    dr[10] = item.Value;
                }
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        public decimal Calculate(int accountid, DateTime start, DateTime end, string formula)
        {
            GetBindField            getBindField       = new GetBindField();
            BindItemValueCollection collection         = getBindField.BindItemValueCollection(accountid, start, end);
            List <ExpressionItem>   expressionItemList = new List <ExpressionItem>();

            expressionItemList.Add(new ExpressionItem(AssessBindItemEnum.ImposibleID, formula, EnumDataType.Number));
            foreach (BindItemValue item in collection.BindItemValueList)
            {
                if (item.BindItemEnum.Id == BindItemEnum.ShiJia.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.ShiJia.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.BingJia.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.BingJia.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.ChanQianJia.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.ChanQianJia.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.BuRuJia.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.BuRuJia.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.ChanJia.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.ChanJia.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.BeLate.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.BeLate.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.LeaveEarly.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.LeaveEarly.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.Absenteeism.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.Absenteeism.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.WorkAge.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.WorkAge.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.OnDutyDays.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.OnDutyDays.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.ExpectedOnDutyDays.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.ExpectOnDutyDays.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.PuTongOverTime.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.PuTongOverTime.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.ShuangXiuOverTime.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.ShuangXiuOverTime.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.JieRiOverTime.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.JieRiOverTime.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                else if (item.BindItemEnum.Id == BindItemEnum.OutCityDays.Id)
                {
                    expressionItemList.Add(
                        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.OutCityDays.ID), item.Value.ToString(),
                                           EnumDataType.Number));
                }
                //else if (item.BindItemEnum.Id == BindItemEnum.NotEntryDays.Id)
                //{
                //    expressionItemList.Add(
                //        new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.NotEntryDays.ID), item.Value.ToString(),
                //                           EnumDataType.Number));
                //}
                //else if (item.BindItemEnum.Id == BindItemEnum.DimissionDays.Id)
                //{
                //    expressionItemList.Add(
                //       new ExpressionItem(string.Format("A{0}", AssessBindItemEnum.DimissionDays.ID), item.Value.ToString(),
                //                          EnumDataType.Number));
                //}
            }
            CalculateExpressionItemList cal = new CalculateExpressionItemList(expressionItemList, "A");

            cal.CalculateExpressionResult();
            foreach (ExpressionItem item in expressionItemList)
            {
                if (item.Parameter == AssessBindItemEnum.ImposibleID)
                {
                    return(Convert.ToDecimal(item.Result));
                }
            }
            return(0);
        }