/// <summary> /// 此函數的目的是將 Rows 中的每一筆場地設備資料,整理成: /// 1. 要新增的場地 (listRoomInsert ) /// 2. 要修改的場地 (listRoomUpdate ) /// 3. 每個場地的設備清單 (dicEquipment ) /// </summary> /// <param name="Rows"></param> /// <param name="listRoomInsert"></param> /// <param name="listRoomUpdate"></param> /// <param name="dicEquipmentInRoom"></param> private void parseData(List <Campus.DocumentValidator.IRowStream> Rows, List <UDT.MeetingRoom> listRoomInsert, List <UDT.MeetingRoom> listRoomUpdate, Dictionary <string, List <UDT.MeetingRoomEquipment> > dicEquipmentInRoom) { // 對於每一筆場地的設備資料 foreach (IRowStream Row in Rows) { //a. 確認場地是新增或修改 string building = Row.GetValue("所屬大樓名稱"); string roomName = Row.GetValue("會議室名稱"); string equipName = Row.GetValue("設備名稱"); string keyRoom = string.Format("{0}_{1}", roomName, building); // 會議室key if (importBot.GetMeetingRoomDic().ContainsKey(keyRoom)) //更新 { if (importBot.GetMeetingRoomDic()[keyRoom].UID != "") // 確保資料有系統編號 在做更新 { UDT.MeetingRoom room = importBot.GetMeetingRoomDic()[keyRoom]; // ???? if (!Log_Dic.ContainsKey(room.UID)) { ImputLog i_n = new ImputLog(); i_n.lo_MeetingRoom = room.CopyExtension(); Log_Dic.Add(room.UID, i_n); } importBot.FillMeetingRoomData(Row, room); listRoomUpdate.Add(room); } } else { //新增 UDT.MeetingRoom room = new UDT.MeetingRoom(); room.Name = roomName; room.Building = building; importBot.FillMeetingRoomData(Row, room); // 將新增的會議室加入Dic 避免重複新增 importBot.GetMeetingRoomDic().Add(keyRoom, room); listRoomInsert.Add(room); } //b. 確認設備所屬場地 //string keyEquip = string.Format("{0}_{1}", keyRoom, equipName); // 設備key if (!dicEquipmentInRoom.ContainsKey(keyRoom)) { dicEquipmentInRoom.Add(keyRoom, new List <UDT.MeetingRoomEquipment>()); } UDT.MeetingRoomEquipment equip = new UDT.MeetingRoomEquipment(); importBot.FillEquipmentData(Row, equip); dicEquipmentInRoom[keyRoom].Add(equip); } }
public string SetLog(ImputLog log) { //檢查與確認資料是否被修改 StringBuilder sb = new StringBuilder(); sb.AppendLine(string.Format("會議室名稱「{0}」 所屬大樓「{1}」", log.New_MeetingRoom.Name, log.New_MeetingRoom.Building)); if (log.lo_MeetingRoom.Name != log.New_MeetingRoom.Name) { sb.AppendLine(ByOne("會議室名稱", log.lo_MeetingRoom.Name, log.New_MeetingRoom.Name)); } if (log.lo_MeetingRoom.Picture != log.New_MeetingRoom.Picture) { sb.AppendLine(ByOne("照片", log.lo_MeetingRoom.Picture, log.New_MeetingRoom.Picture)); } if (log.lo_MeetingRoom.Building != log.New_MeetingRoom.Building) { sb.AppendLine(ByOne("所屬大樓名稱", log.lo_MeetingRoom.Building, log.New_MeetingRoom.Building)); } if (log.lo_MeetingRoom.Capacity != log.New_MeetingRoom.Capacity) { sb.AppendLine(ByOne("容納人數", "" + log.lo_MeetingRoom.Capacity, "" + log.New_MeetingRoom.Capacity)); } if (log.lo_MeetingRoom.Status != log.New_MeetingRoom.Status) { sb.AppendLine(ByOne("會議室目前狀態", log.lo_MeetingRoom.Status, log.New_MeetingRoom.Status)); } if (log.lo_MeetingRoom.RefUnitID != log.New_MeetingRoom.RefUnitID) { sb.AppendLine(ByOne("管理單位編號", "" + log.lo_MeetingRoom.RefUnitID, "" + log.New_MeetingRoom.RefUnitID)); } if (log.lo_MeetingRoom.IsSpecial != log.New_MeetingRoom.IsSpecial) { sb.AppendLine(ByOne("是否為特殊場地", "" + log.lo_MeetingRoom.IsSpecial, "" + log.New_MeetingRoom.IsSpecial)); } if (log.lo_MeetingRoom.CreateTime != log.New_MeetingRoom.CreateTime) { sb.AppendLine(ByOne("建立日期", log.lo_MeetingRoom.CreateTime.ToShortDateString(), log.New_MeetingRoom.CreateTime.ToShortDateString())); } if (log.lo_MeetingRoom.CreatedBy != log.New_MeetingRoom.CreatedBy) { sb.AppendLine(ByOne("建立者帳號", GetDeptName(log.lo_MeetingRoom.CreatedBy), GetDeptName(log.New_MeetingRoom.CreatedBy))); } sb.AppendLine(""); return(sb.ToString()); }