public JsonResult GetWorkDetailById(int projectId) { var result = new ResultInfo <WorkList>(); var model = WorkListDBOperate.GetModelById(projectId); var detail = WorkListDetailDBOperate.GetList(new string[] { model.Guid }); var guid = detail.Select(a => a.Guid).ToArray(); var items = WorkListItemsDBOperate.GetList(guid); model.DetailList = detail; model.ItemList = items; result.Data = model; result.IsSuccess = true; return(Json(result)); }
public static void Main(string[] args) { var list = WorkListItemsDBOperate.GetWeekModifyList(); var ids = list.Select(a => a.Id).ToArray(); WorkListItemsDBOperate.ModifyWeekList(ids); SystemLogDBOperate.AddSystemLog(new Dto.SystemLog() { CreateDate = DateTime.Now, LogLevel = LogLevel.Success.ToString(), MainContent = CommonMethod.ToJson(ids), MainKey = "WeekModify", UserName = "******", MainRequest = "系统自动更新工单时间" }); }
public static bool WorkListInfoEdit(List <WorkListEdit> list, WorkList work) { var operate = CookieOperate.MemberCookie; var workDetail = new List <WorkListDetail>(); var workItem = new List <WorkListItems>(); var index = 1; foreach (var item in list) { var workDetailModel = new WorkListDetail() { WorkId = work.Guid, Index = index++, Infos = item.Name, RoleCode = item.Role, IsDeleted = 0, CreateBy = operate.UserName, Guid = Guid.NewGuid().ToString() }; workDetail.Add(workDetailModel); var infos = item.Infos.Split('\n'); foreach (var item1 in infos) { var workItemModel = new WorkListItems() { CompanyId = operate.CompanyId, CompanyName = operate.CompanyName, ProjectId = work.ProjectId, WorkId = work.Id, Name = item.Name, Level = 999, Status = ItemStatus.HasPei.ToString(), UserId = string.Format("{0},", operate.UserName), UserName = string.Format("{0},", operate.Name), DayCount = 0, Infos = item1, DetailGuid = workDetailModel.Guid, CreateBy = operate.UserName, Type = ItemType.HouDuan.ToString() }; workItem.Add(workItemModel); } } return(WorkListItemsDBOperate.AddWorkListItems(workDetail, workItem)); }
public static bool ImportExcel(DataTable dt, CompanyUser user, out string message) { message = string.Empty; try { var workName = dt.Columns[1].ColumnName.Trim(); var work = WorkListDBOperate.GetModelByName(workName); if (work == null) { message = "工单不存在,请先导入或创建工单"; return(false); } var addList = new List <WorkListItems>(); var detailName = new List <string>(); for (int i = 1; i < dt.Rows.Count; i++) { var dr = dt.Rows[i]; var detail = dr[1].ToString(); if (!detailName.Contains(detail)) { detailName.Add(detail); } var col = dr.ItemArray; //从第二列开始算 for (int j = 2; j < col.Length; j++) { var info = col[j].ToString(); if (string.IsNullOrEmpty(info)) { continue; } var model = new WorkListItems() { CompanyId = work.CompanyId, CompanyName = work.CompanyName, ProjectId = work.ProjectId, WorkId = work.Id, Name = detail, Level = 999, Status = ItemStatus.XuQiu.ToString(), DayCount = 0, CreateBy = user.UserName, CreateDate = DateTime.Now, IsDeleted = 0, Infos = info, }; addList.Add(model); } } var detailList = WorkListDetailDBOperate.GetModelByNames(detailName.ToArray(), work.Guid); var flag = true; var notExistList = new List <string>(); addList.ForEach(a => { var myDetail = detailList.FirstOrDefault(b => b.Infos == a.Name); if (myDetail == null) { flag = false; notExistList.Add(a.Name); return; } a.DetailId = myDetail.Id; a.DetailGuid = myDetail.Guid; }); if (!flag) { message = string.Format("[{0}]工单内容不存在,无法导入", string.Join(",", notExistList.Distinct())); return(false); } return(WorkListItemsDBOperate.AddWorkListItems(addList)); } catch (Exception ex) { message = ex.Message; } return(false); }