Beispiel #1
0
        public decimal GetedDecimal(string deptId, string userid)
        {
            var deptcode = new DepartmentBLL().GetEntity(deptId).EnCode;
            var timeNow  = DateTime.Now;
            var from     = new DateTime(timeNow.Year, timeNow.Month, 1);
            var to       = new DateTime(timeNow.Year, timeNow.Month, 1).AddMonths(1).AddDays(-1);
            //人均培训学时
            decimal xs     = 0;
            var     redata = ed.GetGroupCount(deptcode, from, to.AddDays(1));

            redata.Columns.Add("total");
            redata.Columns.Add("avg");
            EducationBLL edubll = new EducationBLL();

            foreach (DataRow row in redata.Rows)
            {
                decimal learns  = 0;
                var     edulist = edubll.GetAllList().Where(x => x.BZId == row[0].ToString() && x.ActivityDate >= from && x.ActivityDate < to);
                foreach (EduBaseInfoEntity e in edulist)
                {
                    learns += Convert.ToDecimal(e.LearnTime * e.AttendNumber);
                }
                row["total"] = learns;
                if (row[3].ToString() == "" || row[2].ToString() == "0")
                {
                    row["avg"] = "0";
                }
                else
                {
                    row["avg"] = Math.Round(Convert.ToDecimal(row[3]) / Convert.ToDecimal(row[2]), 2);
                    xs         = xs + Math.Round(Convert.ToDecimal(row[3]) / Convert.ToDecimal(row[2]), 2);
                }
            }

            return(xs);
        }
Beispiel #2
0
        ///<summary>
        ///首页(管理层界面-班组)
        /// </summary>
        /// <returns></returns>
        public manageindex GetTotalWork(string deptId, string userid)
        {
            manageindex index    = new manageindex();
            var         deptcode = new DepartmentBLL().GetEntity(deptId).EnCode;
            var         depts    = new DepartmentBLL().GetSubDepartments(deptId, null);
            var         deptlist = depts.Select(x => x.DepartmentId).ToArray();
            var         deptstr  = string.Join(",", deptlist);

            object[] total = new object[12] {
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
            };
            var timeNow   = DateTime.Now;
            var from      = new DateTime(timeNow.Year, timeNow.Month, 1);
            var to        = new DateTime(timeNow.Year, timeNow.Month, 1).AddMonths(1).AddDays(-1);
            int dataTotal = 0;
            //班前班后会
            var dic = new Dictionary <string, string>();

            dic.Add("meetingstarttime", from.ToString("yyyy-MM-dd"));
            dic.Add("meetingstarttimetwo", to.AddDays(1).ToString("yyyy-MM-dd"));
            work.GetDataNew(1, 10000, out dataTotal, dic, deptlist);
            index.bqbhh = dataTotal;
            //危险预知训练
            var yxyzdata = Dservice.GetTrainingsApp(deptstr, from, to.AddDays(1));

            dataTotal    = yxyzdata.Count();
            index.wxyzxl = dataTotal;
            //安全日活动 班务会 政治学习 民主管理会
            var hddata      = Aservice.GetList(2, deptstr, from, to.AddDays(1));
            var hdtotaldata = hddata.Where(x => x.ActivityType == "安全日活动").ToList();

            dataTotal   = hdtotaldata.Count();
            index.aqrhd = dataTotal;
            hdtotaldata = hddata.Where(x => x.ActivityType == "班务会").ToList();
            dataTotal   = hdtotaldata.Count();
            index.bwh   = dataTotal;
            hdtotaldata = hddata.Where(x => x.ActivityType == "政治学习").ToList();
            dataTotal   = hdtotaldata.Count();
            index.zzxx  = dataTotal;
            hdtotaldata = hddata.Where(x => x.ActivityType == "民主管理会" || x.ActivityType == "民主生活会").ToList();
            dataTotal   = hdtotaldata.Count();
            index.mzglh = dataTotal;
            // 技术讲课 技术问答 事故预想 反事故演习
            var jsdata = baseService.GetList(new string[] { deptstr }, from, to.AddDays(1)).ToList();
            /// 教育培训类型  1.技术讲课   2.技术问答  3.事故预想 4.反事故预想 5.新技术问答
            var Totaldata = jsdata.Where(x => x.EduType == "1").ToList();

            dataTotal   = Totaldata.Count();
            index.jsjk  = dataTotal;
            Totaldata   = jsdata.Where(x => x.EduType == "2" || x.EduType == "5").ToList();
            dataTotal   = Totaldata.Count();
            index.jswd  = dataTotal;
            Totaldata   = jsdata.Where(x => x.EduType == "3").ToList();
            dataTotal   = Totaldata.Count();
            index.sgyx  = dataTotal;
            Totaldata   = jsdata.Where(x => x.EduType == "4").ToList();
            dataTotal   = Totaldata.Count();
            index.fsgyx = dataTotal;
            //人均培训学时
            decimal xs     = 0;
            var     redata = ed.GetGroupCount(deptcode, from, to.AddDays(1));

            redata.Columns.Add("total");
            redata.Columns.Add("avg");
            EducationBLL edubll = new EducationBLL();

            foreach (DataRow row in redata.Rows)
            {
                decimal learns  = 0;
                var     edulist = edubll.GetAllList().Where(x => x.BZId == row[0].ToString() && x.ActivityDate >= from && x.ActivityDate < to);
                foreach (EduBaseInfoEntity e in edulist)
                {
                    learns += Convert.ToDecimal(e.LearnTime * e.AttendNumber);
                }
                row["total"] = learns;
                if (row[3].ToString() == "" || row[2].ToString() == "0")
                {
                    row["avg"] = "0";
                }
                else
                {
                    row["avg"] = Math.Round(Convert.ToDecimal(row[3]) / Convert.ToDecimal(row[2]), 2);
                    xs         = xs + Math.Round(Convert.ToDecimal(row[3]) / Convert.ToDecimal(row[2]), 2);
                }
            }
            index.rjpxxs = xs;
            //获取应急演练列表
            var dyresult = webClientEmergency <GetDrillRecordBaseList>("EmergencyPlatform/GetDrillRecordBaseList",
                                                                       "{\"userid\":\"" + userid + "\",\"pageindex\":" + 1 + ",\"pagesize\":" + 2000 + ",\"data\":{\"startdate\":\"" + from.ToString("yyyy-MM-dd") + "\",\"enddate\":\"" + to.AddDays(1).ToString("yyyy-MM-dd") + "\"} }");

            if (dyresult.Code == 0)
            {
                if (dyresult.data.Count > 0)
                {
                    dataTotal = dyresult.Count;
                }
            }
            index.yjylcs = dataTotal;
            return(index);
        }