// // GET: /StatisticsManage/Department/ public override ActionResult Index() { string organizeId = Common.GetString("organizeid"); string startDT = Common.GetString("startdt"); // Request["StartDT"]; string endDT = Common.GetString("enddt"); // Request["EndDT"]; UserApp userApp = new UserApp(); organizeId = string.IsNullOrEmpty(organizeId) ? NFine.Code.OperatorProvider.Provider.GetCurrent().CompanyId : organizeId;//获取到当前的组织结构id //todo 找出该组织的下级 OrganizeApp organizeApp = new OrganizeApp(); var organizeData = organizeApp.GetList(organizeId); List <string> listOrganizeId = organizeData.Select(x => x.F_Id).ToList();// new List<string>() { organizeId }; //var userData = userApp.GetList(listOrganizeId); ViewBag.OrganizeList = organizeData.Select(x => x.F_FullName).ToJson(); //todo 找出每个员工的完成情况 放入内存中 执行逻辑操作 TaskApp taskApp = new TaskApp(); //var taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList()); List <Report> listReports = new List <Report>(); ItemsDetailApp itemsDetailApp = new ItemsDetailApp(); var itemsData = itemsDetailApp.GetItemList(schedule); foreach (var item in itemsData) { Report report = new Report(); report.name = item.F_ItemName; List <int> listCount = new List <int>(); foreach (var organizeItem in organizeData) { //todo 获取组织下的所有员工 //获取组织下的组织 var data = organizeApp.GetAllList(organizeItem.F_Id); List <string> listOrganizeNext = new List <string>(); foreach (var organizeItemNext in data) { listOrganizeNext.Add(organizeItemNext); } //获取下级下的所有员工 var userData = userApp.GetList(listOrganizeNext); //获取下级下的所有员工的任务 var taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList()); if (!string.IsNullOrEmpty(startDT)) { var time = Utils.ObjectToDateTime(startDT); taskData = taskData.Where(d => d.F_CreatorTime > time).ToList(); } if (!string.IsNullOrEmpty(endDT)) { var time = Utils.ObjectToDateTime(endDT); taskData = taskData.Where(d => d.F_CreatorTime <= time).ToList(); } listCount.Add(taskData.Count(d => d.F_Status == item.F_Id)); } report.data = listCount; listReports.Add(report); } ViewBag.Series = listReports.ToJson(); return(View()); }
public ActionResult SubmitTaskStatusForm(CustomerEntity customerEntity, string statusId, string taskId) { //string defaultStatus = "7a6d1bc4-3ec7-4c57-be9b-b4c97d60d5f6";//默认状态 TaskApp taskApp = new TaskApp(); TaskEntity taskEntity = new TaskEntity(); taskEntity.F_Status = statusId; taskApp.SubmitForm(taskEntity, taskId); return(Success("操作成功。")); }
public ActionResult Default() { var organizeId = NFine.Code.OperatorProvider.Provider.GetCurrent().CompanyId;//获取到当前的组织结构id UserApp userApp = new UserApp(); TaskApp taskApp = new TaskApp(); OrganizeApp organizeApp = new OrganizeApp(); var organizeData = organizeApp.GetAllList(organizeId); List <string> listOrganizeNext = new List <string>(); foreach (var item in organizeData) { listOrganizeNext.Add(item); } var userData = userApp.GetList(listOrganizeNext); var taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList()); DateTime dt = DateTime.Now; //当前时间 //当天待处理任务 ViewBag.DayTaskDoing = taskData.Count(d => d.F_Status == Doing && d.F_CreatorTime > dt.AddDays(-1) && d.F_CreatorTime <= dt); //本周待处理任务 DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))); //本周周一 DateTime endWeek = startWeek.AddDays(6); //本周周日 ViewBag.WeekTaskDoing = taskData.Count(d => d.F_Status == Doing && d.F_CreatorTime > startWeek && d.F_CreatorTime <= endWeek); //本周已处理任务 ViewBag.WeekTaskDone = taskData.Count(d => d.F_Status == Done && d.F_CreatorTime > startWeek && d.F_CreatorTime <= endWeek); //本月待处理任务 DateTime startMonth = dt.AddDays(1 - dt.Day); //本月月初 DateTime endMonth = startMonth.AddMonths(1).AddDays(-1); //本月月末 //本月任务 var tempTask = taskData.Where(d => d.F_CreatorTime > startMonth && d.F_CreatorTime <= endMonth).ToList(); //本月待处理 ViewBag.MonthTaskDoing = tempTask.Count(d => d.F_Status == Doing); //本月已处理任务 ViewBag.MonthTaskDone = tempTask.Count(d => d.F_Status == Done); //本月未完成 ViewBag.MonthTaskNone = tempTask.Count(d => d.F_Status != Done && d.F_Status != Doing); //最近6个月的完成情况 List <int> listLineChartData = new List <int>(); List <string> listLineChartName = new List <string>(); for (int i = 6; i > 0; i--) { startMonth = dt.AddMonths(-i).AddDays(1 - dt.Day); //当月月初 endMonth = startMonth.AddMonths(1).AddDays(-1); //当月月末 var tempCount = taskData.Count(d => d.F_Status == Done && d.F_CreatorTime > startMonth && d.F_CreatorTime <= endMonth); listLineChartData.Add(tempCount); listLineChartName.Add(dt.AddMonths(-i).Year + "年" + dt.AddMonths(-i).Month + "月"); } ViewBag.LineChartData = listLineChartData.ToJson(); ViewBag.LineChartName = listLineChartName.ToJson(); return(View()); }
public ActionResult SubmitTaskForm(CustomerEntity customerEntity, string keyValue, string userId, string taskId) { string defaultStatus = "7a6d1bc4-3ec7-4c57-be9b-b4c97d60d5f6";//默认状态 TaskApp taskApp = new TaskApp(); TaskEntity taskEntity = new TaskEntity(); taskEntity.F_UserId = userId; taskEntity.F_CustomerId = keyValue; taskEntity.F_Status = defaultStatus; taskEntity.F_Id = taskId; keyValue = taskId; taskApp.SubmitForm(taskEntity, keyValue); return(Success("操作成功。")); }
public ActionResult GetGridJson(Pagination pagination, string keyword) { string organizeId = Common.GetString("organizeid"); //组织id string startTime = Common.GetString("startdt"); // 开始时间 string endTime = Common.GetString("enddt"); // 结束时间 string schedule = Common.GetString("schedule"); //进度 //TODO 找出该组织下的员工 UserApp userApp = new UserApp(); var userData = userApp.GetList(pagination, keyword, organizeId); //ViewBag.UserList = userData.Select(x => x.F_RealName).ToJson(); //todo 找出每个员工的完成情况 放入内存中 执行逻辑操作 TaskApp taskApp = new TaskApp(); var taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList()); List <Series> list = new List <Series>(); foreach (var item in userData) { Series series = new Series(); series.id = item.F_Id; series.name = item.F_RealName; series.tel = item.F_MobilePhone; var tempTask = taskData.Where(d => d.F_UserId == item.F_Id); if (!string.IsNullOrEmpty(schedule)) { tempTask = tempTask.Where(d => d.F_Status == schedule); } if (!string.IsNullOrEmpty(startTime)) { tempTask = tempTask.Where(d => d.F_CreatorTime > Utils.ObjectToDateTime(startTime)); } if (!string.IsNullOrEmpty(endTime)) { tempTask = tempTask.Where(d => d.F_CreatorTime <= Utils.ObjectToDateTime(endTime)); } series.count = tempTask.Count(); series.schedule = schedule; list.Add(series); } var data = new { rows = list, total = pagination.total, page = pagination.page, records = pagination.records }; return(Content(data.ToJson())); }
public TaskAppViewModel(TaskApp taskApp) { if (DesignMode.IsInDesignMode) { return; } if (taskApp == null) { throw new ArgumentNullException("taskApp"); } this.TaskBase = taskApp; InitializeCommands(); InitializeData(taskApp.AppWithGroup); }
public override ActionResult Details() { string keyValue = Common.GetString("keyValue"); TaskApp taskApp = new TaskApp(); var taskModel = taskApp.GetForm(keyValue); CustomerApp customerApp = new CustomerApp(); var customerModel = customerApp.GetForm(taskModel.F_CustomerId); switch (customerModel.F_Bank) { case "d69cb819-2bb3-4e1d-9917-33b9a439233d": //中国光大银行 return(RedirectToAction("CEBDetails", new { TaskId = keyValue })); break; case "4c2f2428-2e00-4336-b9ce-5a61f24193f6": //郑州银行 return(RedirectToAction("ZZBANKDetails", new { TaskId = keyValue })); break; case "48c4e0f5-f570-4601-8946-6078762db3bf": //广发银行 return(RedirectToAction("CGBDetails", new { TaskId = keyValue })); break; case "0096ad81-4317-486e-9144-a6a02999ff19": //中国邮政储蓄 return(RedirectToAction("PSBCDetails", new { TaskId = keyValue })); break; case "ace2d5e8-56d4-4c8b-8409-34bc272df404": //中国民生银行 return(RedirectToAction("CMBCDetails", new { TaskId = keyValue })); break; default: break; } return(View()); }
/// <summary> /// 任务列表 /// </summary> /// <param name="pageIndex">页码</param> /// <param name="pageSize">数量</param> /// <param name="bank">银行</param> /// <param name="schedule">进度</param> /// <param name="keyword">关键字</param> /// <param name="startdt">开始时间</param> /// <param name="enddt">结束时间</param> /// <param name="userid">用户id</param> /// <returns></returns> public ApiResult <dynamic> PostTaskList() { ApiResult <dynamic> api = new ApiResult <dynamic>(); try { int pageindex = Common.GetInt("pageIndex", 0); // jsondata.pageIndex ?? 0; int pagesize = Common.GetInt("pageSize", 0); // jsondata.pageSize ?? 0; string userid = Common.GetString("userid"); string bank = Common.GetString("bank"); string schedule = Common.GetString("schedule"); string keyword = Common.GetString("keyword"); string startdt = Common.GetString("startdt"); string enddt = Common.GetString("enddt"); TaskApp taskApp = new TaskApp(); Pagination pagination = new Pagination(); pagination.page = pageindex; pagination.rows = pagesize; pagination.sidx = "F_CreatorTime"; pagination.sord = "desc"; var result = taskApp.GetList(pagination, keyword, schedule, startdt, enddt, userid, bank); CustomerApp customerApp = new CustomerApp(); List <dynamic> list = new List <dynamic>(); foreach (var item in result) { var entity = customerApp.GetForm(item.F_CustomerId); list.Add(entity); } api.Message = "获取成功"; api.Status = true; api.Result = list; return(api); } catch (Exception e) { api.Message = e.Message; return(api); } }
/// <summary> /// 任务详情,单据需要什么 取什么数据 /// </summary> /// <param name="id">任务id</param> /// <returns></returns> public ApiResult <dynamic> Details() { ApiResult <dynamic> api = new ApiResult <dynamic>(); try { string id = Common.GetString("id"); TaskApp taskApp = new TaskApp(); var taskData = taskApp.GetForm(id); CustomerApp customerApp = new CustomerApp(); var customerData = customerApp.GetForm(taskData.F_CustomerId); UserApp userApp = new UserApp(); var userData = userApp.GetForm(taskData.F_UserId); VisitApp visitApp = new VisitApp(); var model = visitApp.GetList(id).OrderByDescending(d => d.F_CreatorTime).FirstOrDefault(); var visitData = visitApp.GetForm(model == null ? string.Empty : model.F_Id); var data = new { VisitData = visitData, F_Shop_Name = customerData.F_Shop_Name, F_Shop_Address = customerData.F_Shop_Address, F_Name = customerData.F_Name, F_Tel = customerData.F_Tel, F_User_Name = userData.F_RealName, F_Task_Time = taskData.F_CreatorTime, F_User_Tel = userData.F_MobilePhone, F_Status = GetName(taskData.F_Status) }; api.Message = "获取成功"; api.Status = true; api.Result = data; return(api); } catch (Exception e) { api.Message = e.Message; return(api); } }
/// <summary> /// 任务处理 提交任务状态 /// </summary> /// <param name="taskId">任务id</param> /// <param name="statusId">状态id</param> /// <returns></returns> public ApiResult <dynamic> PostTaskStatus() { ApiResult <dynamic> api = new ApiResult <dynamic>(); try { string taskId = Common.GetString("taskId"); string statusId = Common.GetString("statusId"); TaskApp taskApp = new TaskApp(); TaskEntity taskEntity = new TaskEntity(); taskEntity.F_Status = statusId; taskApp.SubmitFormAPI(taskEntity, taskId); api.Message = "操作成功"; api.Status = true; return(api); } catch (Exception e) { api.Message = e.Message; return(api); } }
public ActionResult GetFormJson(string keyValue) { string taskId = Common.GetString("keyValue"); TaskApp taskApp = new TaskApp(); var taskData = taskApp.GetForm(taskId); CustomerApp customerApp = new CustomerApp(); var customerData = customerApp.GetForm(taskData.F_CustomerId); UserApp userApp = new UserApp(); var userData = userApp.GetForm(taskData.F_UserId); var data = new { F_Shop_Name = customerData.F_Shop_Name, F_Shop_Address = customerData.F_Shop_Address, F_Name = customerData.F_Name, F_Tel = customerData.F_Tel, F_User_Name = userData.F_RealName, F_Task_Time = taskData.F_CreatorTime, F_User_Tel = userData.F_MobilePhone, F_Status = GetName(taskData.F_Status) }; return(Content(data.ToJson())); }
public void SetApp(TaskApp app) { this.app = app; }
protected override void bgw_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { try { using (DamWCFContext dam6Entities = new DamWCFContext(false)) { ResetConnectionString(dam6Entities); using (EF5x.Models.DamDBContext dam5Entities = new EF5x.Models.DamDBContext()) { ResetConnectionString(dam5Entities); //import tasktype foreach (var taskType in dam5Entities.TaskTypes) { var newTaskType = new TaskType(); newTaskType.Id = taskType.TaskTypeID; newTaskType.TypeName = taskType.TypeName; dam6Entities.TaskTypes.Add(newTaskType); dam6Entities.SaveChanges(); dam6Entities.Entry(newTaskType).State = System.Data.Entity.EntityState.Detached; } _allRowCnt = dam5Entities.AppCollections.Count(); DateTime minDate = new DateTime(1970, 1, 1); var newAppCol = new AppCollection(); var newTaskApp = new TaskApp(); foreach (var oldItem in dam5Entities.AppCollections) { newAppCol.Id = oldItem.AppCollectionID; newAppCol.CollectionName = oldItem.CollectionName; newAppCol.Description = oldItem.Description; newAppCol.Order = oldItem.Order; newAppCol.TaskTypeID = oldItem.taskTypeID; dam6Entities.AppCollections.Add(newAppCol); dam6Entities.SaveChanges(); dam6Entities.Entry(newAppCol).State = System.Data.Entity.EntityState.Detached;; var query = from i in dam5Entities.TaskAppratus where i.appCollectionID == newAppCol.Id select i; foreach (var item in query) { var id = (from i in dam6Entities.Apps where i.AppName == item.appName select i).First().Id; newTaskApp.Id = Guid.NewGuid(); newTaskApp.AppId = id; newTaskApp.Order = item.Order; newTaskApp.AppCollectionID = item.appCollectionID; dam6Entities.TaskApps.Add(newTaskApp); dam6Entities.SaveChanges(); dam6Entities.Entry(newTaskApp).State = System.Data.Entity.EntityState.Detached;; } handledCnt++; reportProgress(); } } } reportProgress(); bgwResult = "导入成功!"; } catch (Exception ex) { if (ex.InnerException != null) { bgwResult = ex.InnerException.Message; } else { bgwResult = ex.Message; } } }