5 |
5 |
using MARKUS;
|
6 |
6 |
using System;
|
7 |
7 |
using System.Collections.Generic;
|
|
8 |
using System.Collections.ObjectModel;
|
8 |
9 |
using System.Linq;
|
9 |
10 |
using System.Runtime.Remoting.Channels.Tcp;
|
10 |
11 |
using System.Runtime.Serialization;
|
... | ... | |
387 |
388 |
}
|
388 |
389 |
|
389 |
390 |
[OperationContract]
|
|
391 |
public VPRevision GetVPRevisionFirstOrDefault(string ProjectNo, string DocumentId)
|
|
392 |
{
|
|
393 |
VPRevision _result = null;
|
|
394 |
try
|
|
395 |
{
|
|
396 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
|
|
397 |
{
|
|
398 |
_result = (from docitem in entity.DOCUMENT_ITEM
|
|
399 |
where docitem.DOCUMENT_ID == DocumentId
|
|
400 |
select new VPRevision
|
|
401 |
{
|
|
402 |
RevNo = docitem.REVISION,
|
|
403 |
GroupNo = docitem.GROUP_NO,
|
|
404 |
FROM_VENDOR = docitem.ORIGINAL_FILE,
|
|
405 |
DOCUMENT_ID = docitem.DOCUMENT_ID,
|
|
406 |
TO_VENDOR = docitem.RESULT_FILE,
|
|
407 |
RESULT = docitem.RESULT
|
|
408 |
}).FirstOrDefault();
|
|
409 |
}
|
|
410 |
}
|
|
411 |
catch (Exception)
|
|
412 |
{
|
|
413 |
throw;
|
|
414 |
}
|
|
415 |
finally
|
|
416 |
{
|
|
417 |
GC.Collect(2);
|
|
418 |
}
|
|
419 |
return _result;
|
|
420 |
}
|
|
421 |
|
|
422 |
[OperationContract]
|
390 |
423 |
public DOCINFO GetDocInfo(KCOM_BasicParam param)
|
391 |
424 |
{
|
392 |
425 |
DOCINFO _result = null;
|
... | ... | |
694 |
727 |
// return _result;
|
695 |
728 |
//}
|
696 |
729 |
|
697 |
|
//[OperationContract]
|
698 |
|
//[ServiceKnownType(typeof(MEMBER))]
|
699 |
|
//public List<MEMBER> GetUserData(string ProjectNo, string UserID)
|
700 |
|
//{
|
701 |
|
// List<MEMBER> _result = new List<MEMBER>();
|
|
730 |
[OperationContract]
|
|
731 |
[ServiceKnownType(typeof(MEMBER))]
|
|
732 |
public List<MEMBER> GetUserData(string ProjectNo, string UserID)
|
|
733 |
{
|
|
734 |
List<MEMBER> _result = new List<MEMBER>();
|
702 |
735 |
|
703 |
|
// using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
|
704 |
|
// {
|
705 |
|
// var _UserList = from member in entity.MEMBER
|
706 |
|
// where member.ID == UserID
|
707 |
|
// select member;
|
708 |
|
// _result = _UserList.ToList();
|
709 |
|
// }
|
710 |
|
// //GC.Collect(2);
|
711 |
|
// return _result;
|
712 |
|
//}
|
|
736 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
|
|
737 |
{
|
|
738 |
var _UserList = from member in entity.MEMBER
|
|
739 |
where member.ID == UserID
|
|
740 |
select member;
|
|
741 |
_result = _UserList.ToList();
|
|
742 |
}
|
|
743 |
//GC.Collect(2);
|
|
744 |
return _result;
|
|
745 |
}
|
713 |
746 |
|
714 |
747 |
|
715 |
748 |
[OperationContract]
|
... | ... | |
905 |
938 |
// }
|
906 |
939 |
//}
|
907 |
940 |
#endregion
|
|
941 |
|
|
942 |
[OperationContract]
|
|
943 |
public bool SaveMarkupData(MarkupInfoItem UserState,string project_no,string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data)
|
|
944 |
{
|
|
945 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
946 |
{
|
|
947 |
#region Docinfo 정보 가져오기
|
|
948 |
|
|
949 |
string docinfoid_ = (from info in Entity.DOCINFO
|
|
950 |
where info.DOCUMENT_ID == doc_id
|
|
951 |
&& info.PROJECT_NO == project_no
|
|
952 |
select info.ID
|
|
953 |
).First().ToString();
|
|
954 |
#endregion
|
|
955 |
|
|
956 |
#region Markup_Info 저장
|
|
957 |
|
|
958 |
MARKUP_INFO markup_info = new MARKUP_INFO();
|
|
959 |
try
|
|
960 |
{
|
|
961 |
markup_info = (from info in Entity.MARKUP_INFO
|
|
962 |
where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id
|
|
963 |
select info).FirstOrDefault();
|
|
964 |
}
|
|
965 |
catch (Exception)
|
|
966 |
{
|
|
967 |
markup_info = null;
|
|
968 |
}
|
|
969 |
|
|
970 |
//markup_info가 없을 경우 생성
|
|
971 |
if (markup_info == null)
|
|
972 |
{
|
|
973 |
//MarkupInfo 저장
|
|
974 |
markup_info = new MARKUP_INFO
|
|
975 |
{
|
|
976 |
ID = UserState.MarkupInfoID,
|
|
977 |
DOCINFO_ID = docinfoid_,
|
|
978 |
USER_ID = user_id,
|
|
979 |
CREATE_TIME = DateTime.Now,
|
|
980 |
CONSOLIDATE = UserState.Consolidate,
|
|
981 |
AVOID_CONSOLIDATE = UserState.AvoidConsolidate,
|
|
982 |
PART_CONSOLIDATE = UserState.PartConsolidate,
|
|
983 |
DESCRIPTION = UserState.Description,
|
|
984 |
UPDATE_TIME = DateTime.Now
|
|
985 |
};
|
|
986 |
Entity.MARKUP_INFO.AddObject(markup_info);
|
|
987 |
}
|
|
988 |
//markup_info가 있을 경우 업데이트
|
|
989 |
else
|
|
990 |
{
|
|
991 |
markup_info.UPDATE_TIME = DateTime.Now;
|
|
992 |
}
|
|
993 |
Entity.SaveChanges();
|
|
994 |
#endregion
|
|
995 |
|
|
996 |
#region Markup_Info_Version 저장
|
|
997 |
|
|
998 |
MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION();
|
|
999 |
|
|
1000 |
try
|
|
1001 |
{
|
|
1002 |
markup_info_version = (from info in Entity.MARKUP_INFO_VERSION
|
|
1003 |
where info.MARKUPINFO_ID == markup_info.ID
|
|
1004 |
select info).FirstOrDefault();
|
|
1005 |
}
|
|
1006 |
catch (Exception)
|
|
1007 |
{
|
|
1008 |
markup_info_version = null;
|
|
1009 |
}
|
|
1010 |
|
|
1011 |
//markup_info_version 없을 경우 생성
|
|
1012 |
if (markup_info_version == null)
|
|
1013 |
{
|
|
1014 |
//MarkupInfo_version 저장
|
|
1015 |
markup_info_version = new MARKUP_INFO_VERSION()
|
|
1016 |
{
|
|
1017 |
ID = UserState.MarkupVersionID,
|
|
1018 |
MARKUPINFO_ID = markup_info.ID,
|
|
1019 |
CREATE_DATE = DateTime.Now
|
|
1020 |
};
|
|
1021 |
Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version);
|
|
1022 |
Entity.SaveChanges();
|
|
1023 |
}
|
|
1024 |
#endregion
|
|
1025 |
|
|
1026 |
|
|
1027 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item =>
|
|
1028 |
{
|
|
1029 |
Entity.MARKUP_DATA.DeleteObject(item);
|
|
1030 |
});
|
|
1031 |
Entity.SaveChanges();
|
|
1032 |
|
|
1033 |
try
|
|
1034 |
{
|
|
1035 |
mlmarkup_data.ForEach(value =>
|
|
1036 |
{
|
|
1037 |
Entity.MARKUP_DATA.AddObject(new MARKUP_DATA
|
|
1038 |
{
|
|
1039 |
ID = value.ID,
|
|
1040 |
DATA = value.DATA,
|
|
1041 |
DATA_TYPE = value.DATA_TYPE,
|
|
1042 |
PAGENUMBER = value.PAGENUMBER,
|
|
1043 |
MARKUPINFO_VERSION_ID = markup_info_version.ID
|
|
1044 |
});
|
|
1045 |
});
|
|
1046 |
Entity.SaveChanges();
|
|
1047 |
}
|
|
1048 |
catch (Exception)
|
|
1049 |
{
|
|
1050 |
return false;
|
|
1051 |
}
|
|
1052 |
}
|
|
1053 |
return true;
|
|
1054 |
}
|
|
1055 |
|
|
1056 |
|
|
1057 |
[OperationContract]
|
|
1058 |
public bool SaveSymbol(SYMBOL_PRIVATE symbol_private)
|
|
1059 |
{
|
|
1060 |
try
|
|
1061 |
{
|
|
1062 |
using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
|
|
1063 |
{
|
|
1064 |
uc.AddToSYMBOL_PRIVATE(symbol_private);
|
|
1065 |
uc.SaveChanges();
|
|
1066 |
}
|
|
1067 |
}
|
|
1068 |
catch(Exception)
|
|
1069 |
{
|
|
1070 |
return false;
|
|
1071 |
}
|
|
1072 |
return true;
|
|
1073 |
}
|
|
1074 |
|
|
1075 |
[OperationContract]
|
|
1076 |
public bool DeleteSymbol(string symbol_id)
|
|
1077 |
{
|
|
1078 |
try
|
|
1079 |
{
|
|
1080 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
|
1081 |
{
|
|
1082 |
string delItem_ID = symbol_id;
|
|
1083 |
var delitem = Entity.SYMBOL_PRIVATE.Where(data => data.ID == delItem_ID).FirstOrDefault();
|
|
1084 |
Entity.SYMBOL_PRIVATE.DeleteObject(delitem);
|
|
1085 |
Entity.SaveChanges();
|
|
1086 |
}
|
|
1087 |
}
|
|
1088 |
catch(Exception)
|
|
1089 |
{
|
|
1090 |
return false;
|
|
1091 |
}
|
|
1092 |
return true;
|
|
1093 |
}
|
|
1094 |
|
|
1095 |
[OperationContract]
|
|
1096 |
public bool RenameSymbol(string symbol_id, string name)
|
|
1097 |
{
|
|
1098 |
try
|
|
1099 |
{
|
|
1100 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
|
1101 |
{
|
|
1102 |
var UpdateItem = Entity.SYMBOL_PRIVATE.Where(info => info.ID == symbol_id).FirstOrDefault();
|
|
1103 |
UpdateItem.NAME = name;
|
|
1104 |
Entity.SaveChanges();
|
|
1105 |
}
|
|
1106 |
}
|
|
1107 |
catch (Exception)
|
|
1108 |
{
|
|
1109 |
return false;
|
|
1110 |
}
|
|
1111 |
return true;
|
|
1112 |
}
|
|
1113 |
|
|
1114 |
[OperationContract]
|
|
1115 |
public bool AddCheckListHistory(string project_no, CHECK_LIST_HISTORY Check_History)
|
|
1116 |
{
|
|
1117 |
try
|
|
1118 |
{
|
|
1119 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1120 |
{
|
|
1121 |
Entity.CHECK_LIST_HISTORY.AddObject(Check_History);
|
|
1122 |
Entity.SaveChanges();
|
|
1123 |
}
|
|
1124 |
}
|
|
1125 |
catch (Exception)
|
|
1126 |
{
|
|
1127 |
return false;
|
|
1128 |
}
|
|
1129 |
return true;
|
|
1130 |
}
|
|
1131 |
[OperationContract]
|
|
1132 |
public bool SaveCheckListHistory(string project_no, string rev, CHECK_LIST_HISTORY Check_History)
|
|
1133 |
{
|
|
1134 |
try
|
|
1135 |
{
|
|
1136 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1137 |
{
|
|
1138 |
var item = Entity.CHECK_LIST_HISTORY.Where(info => info.REVISION == rev).FirstOrDefault();
|
|
1139 |
item = Check_History;
|
|
1140 |
Entity.SaveChanges();
|
|
1141 |
}
|
|
1142 |
}
|
|
1143 |
catch (Exception)
|
|
1144 |
{
|
|
1145 |
return false;
|
|
1146 |
}
|
|
1147 |
return true;
|
|
1148 |
}
|
|
1149 |
[OperationContract]
|
|
1150 |
public bool SaveCheckList(string project_no, string _id, CHECK_LIST Check_value)
|
|
1151 |
{
|
|
1152 |
try
|
|
1153 |
{
|
|
1154 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1155 |
{
|
|
1156 |
var item = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault();
|
|
1157 |
item.TODOLIST = Check_value.TODOLIST;
|
|
1158 |
item.REMARK = Check_value.REMARK;
|
|
1159 |
item.STATUS = Check_value.STATUS;
|
|
1160 |
item.VENDOR = Check_value.VENDOR;
|
|
1161 |
item.REPLY = Check_value.REPLY;
|
|
1162 |
item.IMAGE_URL = Check_value.IMAGE_URL;
|
|
1163 |
item.IMAGE_ANCHOR = Check_value.IMAGE_ANCHOR;
|
|
1164 |
item.UPDATE_TIME = Check_value.UPDATE_TIME;
|
|
1165 |
Entity.SaveChanges();
|
|
1166 |
}
|
|
1167 |
}
|
|
1168 |
catch (Exception)
|
|
1169 |
{
|
|
1170 |
return false;
|
|
1171 |
}
|
|
1172 |
return true;
|
|
1173 |
}
|
|
1174 |
[OperationContract]
|
|
1175 |
public bool AddCheckList(string project_no, CHECK_LIST Check_value)
|
|
1176 |
{
|
|
1177 |
try
|
|
1178 |
{
|
|
1179 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1180 |
{
|
|
1181 |
Entity.CHECK_LIST.AddObject(Check_value);
|
|
1182 |
Entity.SaveChanges();
|
|
1183 |
}
|
|
1184 |
}
|
|
1185 |
catch (Exception)
|
|
1186 |
{
|
|
1187 |
return false;
|
|
1188 |
}
|
|
1189 |
return true;
|
|
1190 |
}
|
|
1191 |
|
|
1192 |
[OperationContract]
|
|
1193 |
public CHECK_LIST GetCheckList(string project_no, string _id)
|
|
1194 |
{
|
|
1195 |
CHECK_LIST Check_value = new CHECK_LIST();
|
|
1196 |
try
|
|
1197 |
{
|
|
1198 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1199 |
{
|
|
1200 |
Check_value = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault();
|
|
1201 |
}
|
|
1202 |
}
|
|
1203 |
catch (Exception)
|
|
1204 |
{
|
|
1205 |
return null;
|
|
1206 |
}
|
|
1207 |
return Check_value;
|
|
1208 |
}
|
|
1209 |
[OperationContract]
|
|
1210 |
public List<CHECK_LIST> GetUserCheckList(string project_no, string user_id, string doc_no)
|
|
1211 |
{
|
|
1212 |
List<CHECK_LIST> list = new List<CHECK_LIST>();
|
|
1213 |
try
|
|
1214 |
{
|
|
1215 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1216 |
{
|
|
1217 |
list = Entity.CHECK_LIST.Where(i => i.PROJECT_NO == project_no && i.DOCUMENT_NO == doc_no && i.USER_ID == user_id).OrderBy(p => p.CREATE_TIME).ToList();
|
|
1218 |
}
|
|
1219 |
}
|
|
1220 |
catch (Exception)
|
|
1221 |
{
|
|
1222 |
return null;
|
|
1223 |
}
|
|
1224 |
return list;
|
|
1225 |
}
|
|
1226 |
[OperationContract]
|
|
1227 |
public List<CHECK_LIST_HISTORY> GetCheckListHistory(string project_no, string _id)
|
|
1228 |
{
|
|
1229 |
List<CHECK_LIST_HISTORY> history = new List<CHECK_LIST_HISTORY>();
|
|
1230 |
try
|
|
1231 |
{
|
|
1232 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1233 |
{
|
|
1234 |
history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == _id).ToList();
|
|
1235 |
}
|
|
1236 |
}
|
|
1237 |
catch (Exception)
|
|
1238 |
{
|
|
1239 |
return null;
|
|
1240 |
}
|
|
1241 |
return history;
|
|
1242 |
}
|
|
1243 |
[OperationContract]
|
|
1244 |
public CHECK_LIST_HISTORY GetCheckListHistoryFirstOrDefault(string project_no, string checklist_id, string rev)
|
|
1245 |
{
|
|
1246 |
CHECK_LIST_HISTORY Check_Item = new CHECK_LIST_HISTORY();
|
|
1247 |
try
|
|
1248 |
{
|
|
1249 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1250 |
{
|
|
1251 |
Check_Item = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == checklist_id && info.REVISION == rev).FirstOrDefault();
|
|
1252 |
}
|
|
1253 |
}
|
|
1254 |
catch (Exception)
|
|
1255 |
{
|
|
1256 |
return null;
|
|
1257 |
}
|
|
1258 |
return Check_Item;
|
|
1259 |
}
|
|
1260 |
[OperationContract]
|
|
1261 |
public bool SavePageAngle(string project_no, List<DOCPAGE> _mldocpage)
|
|
1262 |
{
|
|
1263 |
try
|
|
1264 |
{
|
|
1265 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1266 |
{
|
|
1267 |
KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE();
|
|
1268 |
_mldocpage.ForEach(data =>
|
|
1269 |
{
|
|
1270 |
_docpage = (from info in Entity.DOCPAGE
|
|
1271 |
where info.ID == data.ID
|
|
1272 |
select info).FirstOrDefault();
|
|
1273 |
|
|
1274 |
if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE)
|
|
1275 |
{
|
|
1276 |
_docpage.PAGE_ANGLE = data.PAGE_ANGLE;
|
|
1277 |
}
|
|
1278 |
});
|
|
1279 |
|
|
1280 |
Entity.SaveChanges();
|
|
1281 |
}
|
|
1282 |
}
|
|
1283 |
catch (Exception)
|
|
1284 |
{
|
|
1285 |
return false;
|
|
1286 |
}
|
|
1287 |
return true;
|
|
1288 |
}
|
|
1289 |
|
|
1290 |
[OperationContract]
|
|
1291 |
public MARKUP_INFO GetMarkupInfo(string project_no, string _id)
|
|
1292 |
{
|
|
1293 |
MARKUP_INFO markupInfo = new MARKUP_INFO();
|
|
1294 |
|
|
1295 |
try
|
|
1296 |
{
|
|
1297 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1298 |
{
|
|
1299 |
markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
|
|
1300 |
}
|
|
1301 |
}
|
|
1302 |
catch (Exception)
|
|
1303 |
{
|
|
1304 |
return null;
|
|
1305 |
}
|
|
1306 |
return markupInfo;
|
|
1307 |
}
|
|
1308 |
|
|
1309 |
[OperationContract]
|
|
1310 |
public List<string> GetMarkupDataListperPage(string project_no, string _markupinfoid, int _pageNo)
|
|
1311 |
{
|
|
1312 |
List<string> markupdata = new List<string>();
|
|
1313 |
MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION();
|
|
1314 |
try
|
|
1315 |
{
|
|
1316 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1317 |
{
|
|
1318 |
markup_info_version = (from version in Entity.MARKUP_INFO_VERSION
|
|
1319 |
where version.MARKUPINFO_ID == _markupinfoid
|
|
1320 |
orderby version.CREATE_DATE descending
|
|
1321 |
select version).First();
|
|
1322 |
markupdata = (from data in Entity.MARKUP_DATA
|
|
1323 |
where data.MARKUPINFO_VERSION_ID == markup_info_version.ID && data.PAGENUMBER == _pageNo
|
|
1324 |
select data.DATA).ToList();
|
|
1325 |
}
|
|
1326 |
}
|
|
1327 |
catch (Exception)
|
|
1328 |
{
|
|
1329 |
return null;
|
|
1330 |
}
|
|
1331 |
return markupdata;
|
|
1332 |
}
|
|
1333 |
|
|
1334 |
[OperationContract]
|
|
1335 |
public bool AddMarkupInfo(string project_no, MARKUP_INFO value)
|
|
1336 |
{
|
|
1337 |
try
|
|
1338 |
{
|
|
1339 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1340 |
{
|
|
1341 |
Entity.MARKUP_INFO.AddObject(value);
|
|
1342 |
Entity.SaveChanges();
|
|
1343 |
}
|
|
1344 |
}
|
|
1345 |
catch (Exception)
|
|
1346 |
{
|
|
1347 |
return false;
|
|
1348 |
}
|
|
1349 |
return true;
|
|
1350 |
}
|
|
1351 |
|
|
1352 |
[OperationContract]
|
|
1353 |
public bool AddMarkupInfoVersion(string project_no, MARKUP_INFO_VERSION value)
|
|
1354 |
{
|
|
1355 |
try
|
|
1356 |
{
|
|
1357 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1358 |
{
|
|
1359 |
Entity.MARKUP_INFO_VERSION.AddObject(value);
|
|
1360 |
Entity.SaveChanges();
|
|
1361 |
}
|
|
1362 |
}
|
|
1363 |
catch (Exception)
|
|
1364 |
{
|
|
1365 |
return false;
|
|
1366 |
}
|
|
1367 |
return true;
|
|
1368 |
}
|
|
1369 |
|
|
1370 |
[OperationContract]
|
|
1371 |
public bool AddMarkupData(string project_no, MARKUP_DATA value)
|
|
1372 |
{
|
|
1373 |
try
|
|
1374 |
{
|
|
1375 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1376 |
{
|
|
1377 |
Entity.MARKUP_DATA.AddObject(value);
|
|
1378 |
Entity.SaveChanges();
|
|
1379 |
}
|
|
1380 |
}
|
|
1381 |
catch (Exception)
|
|
1382 |
{
|
|
1383 |
return false;
|
|
1384 |
}
|
|
1385 |
return true;
|
|
1386 |
}
|
|
1387 |
|
|
1388 |
[OperationContract]
|
|
1389 |
public bool AvoidMarkupInfo(string project_no, string _doc_id)
|
|
1390 |
{
|
|
1391 |
try
|
|
1392 |
{
|
|
1393 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1394 |
{
|
|
1395 |
var item = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
|
|
1396 |
item.AVOID_CONSOLIDATE = 1;
|
|
1397 |
Entity.SaveChanges();
|
|
1398 |
}
|
|
1399 |
}
|
|
1400 |
catch (Exception)
|
|
1401 |
{
|
|
1402 |
return false;
|
|
1403 |
}
|
|
1404 |
return true;
|
|
1405 |
}
|
|
1406 |
|
|
1407 |
[OperationContract]
|
|
1408 |
public bool SaveMarkupInfo(string project_no, string _id, MARKUP_INFO value)
|
|
1409 |
{
|
|
1410 |
try
|
|
1411 |
{
|
|
1412 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1413 |
{
|
|
1414 |
var item = Entity.MARKUP_INFO.Where(info => info.ID == _id).FirstOrDefault();
|
|
1415 |
item = value;
|
|
1416 |
Entity.SaveChanges();
|
|
1417 |
}
|
|
1418 |
}
|
|
1419 |
catch (Exception)
|
|
1420 |
{
|
|
1421 |
return false;
|
|
1422 |
}
|
|
1423 |
return true;
|
|
1424 |
}
|
|
1425 |
[OperationContract]
|
|
1426 |
public List<MARKUP_DATA> GetMarkupDataList(string project_no, string _versionid)
|
|
1427 |
{
|
|
1428 |
List<MARKUP_DATA> mlresult = new List<MARKUP_DATA>();
|
|
1429 |
|
|
1430 |
try
|
|
1431 |
{
|
|
1432 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1433 |
{
|
|
1434 |
mlresult = Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == _versionid).ToList();
|
|
1435 |
}
|
|
1436 |
}
|
|
1437 |
catch (Exception)
|
|
1438 |
{
|
|
1439 |
return null;
|
|
1440 |
}
|
|
1441 |
return mlresult;
|
|
1442 |
}
|
|
1443 |
|
|
1444 |
[OperationContract]
|
|
1445 |
public bool Consolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems)
|
|
1446 |
{
|
|
1447 |
try
|
|
1448 |
{
|
|
1449 |
List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
|
|
1450 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1451 |
{
|
|
1452 |
var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
|
|
1453 |
if (markupInfo.CONSOLIDATE == 1)
|
|
1454 |
{
|
|
1455 |
markupInfo.AVOID_CONSOLIDATE = 1;
|
|
1456 |
}
|
|
1457 |
|
|
1458 |
foreach (MarkupInfoItem item in markupInfoItems)
|
|
1459 |
{
|
|
1460 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
|
|
1461 |
{
|
|
1462 |
instanceDataSet.Add(d);
|
|
1463 |
});
|
|
1464 |
}
|
|
1465 |
|
|
1466 |
KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
|
|
1467 |
info.ID = shortGuid();
|
|
1468 |
info.CONSOLIDATE = 1;
|
|
1469 |
info.CREATE_TIME = DateTime.Now;
|
|
1470 |
info.DOCINFO_ID = _doc_id;
|
|
1471 |
info.UPDATE_TIME = DateTime.Now;
|
|
1472 |
info.USER_ID = _user_id;
|
|
1473 |
info.AVOID_CONSOLIDATE = 0;
|
|
1474 |
|
|
1475 |
Entity.MARKUP_INFO.AddObject(info);
|
|
1476 |
Entity.SaveChanges();
|
|
1477 |
|
|
1478 |
|
|
1479 |
KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
|
|
1480 |
{
|
|
1481 |
ID = shortGuid(),
|
|
1482 |
CREATE_DATE = DateTime.Now,
|
|
1483 |
MARKUP_INFO = info,
|
|
1484 |
};
|
|
1485 |
Entity.SaveChanges();
|
|
1486 |
|
|
1487 |
foreach (var item in instanceDataSet)
|
|
1488 |
{
|
|
1489 |
Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
|
|
1490 |
{
|
|
1491 |
ID = shortGuid(),
|
|
1492 |
DATA = item.DATA,
|
|
1493 |
DATA_TYPE = item.DATA_TYPE,
|
|
1494 |
PAGENUMBER = item.PAGENUMBER,
|
|
1495 |
MARKUP_INFO_VERSION = info2
|
|
1496 |
});
|
|
1497 |
}
|
|
1498 |
Entity.SaveChanges();
|
|
1499 |
|
|
1500 |
|
|
1501 |
}
|
|
1502 |
}
|
|
1503 |
catch (Exception)
|
|
1504 |
{
|
|
1505 |
return false;
|
|
1506 |
}
|
|
1507 |
return true;
|
|
1508 |
}
|
|
1509 |
|
|
1510 |
[OperationContract]
|
|
1511 |
[ServiceKnownType(typeof(MEMBER))]
|
|
1512 |
public MEMBER GetMember(string project_no, string user_id)
|
|
1513 |
{
|
|
1514 |
MEMBER rstmember = new MEMBER();
|
|
1515 |
try
|
|
1516 |
{
|
|
1517 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1518 |
{
|
|
1519 |
var tmp = (from member in Entity.MEMBER
|
|
1520 |
where member.ID == user_id
|
|
1521 |
select member).FirstOrDefault();
|
|
1522 |
rstmember.DEPARTMENT = tmp.DEPARTMENT;
|
|
1523 |
rstmember.ID = tmp.ID;
|
|
1524 |
rstmember.NAME = tmp.NAME;
|
|
1525 |
}
|
|
1526 |
}
|
|
1527 |
catch (Exception)
|
|
1528 |
{
|
|
1529 |
return null;
|
|
1530 |
}
|
|
1531 |
return rstmember;
|
|
1532 |
}
|
|
1533 |
|
|
1534 |
[OperationContract]
|
|
1535 |
public List<SYMBOL_PRIVATE> GetSymbolList(string user_id)
|
|
1536 |
{
|
|
1537 |
List<SYMBOL_PRIVATE> Custom_List = new List<SYMBOL_PRIVATE>();
|
|
1538 |
try
|
|
1539 |
{
|
|
1540 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
|
1541 |
{
|
|
1542 |
Custom_List = Entity.SYMBOL_PRIVATE.Where(data => data.MEMBER_USER_ID == user_id).ToList();
|
|
1543 |
}
|
|
1544 |
}
|
|
1545 |
catch (Exception)
|
|
1546 |
{
|
|
1547 |
return null;
|
|
1548 |
}
|
|
1549 |
return Custom_List;
|
|
1550 |
}
|
|
1551 |
[OperationContract]
|
|
1552 |
public List<string> GetPublicSymbolDeptList()
|
|
1553 |
{
|
|
1554 |
List<string> Custom_List = new List<string>();
|
|
1555 |
try
|
|
1556 |
{
|
|
1557 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
|
1558 |
{
|
|
1559 |
Custom_List = Entity.SYMBOL_PUBLIC.Select(data => data.DEPARTMENT).ToList();
|
|
1560 |
}
|
|
1561 |
}
|
|
1562 |
catch (Exception)
|
|
1563 |
{
|
|
1564 |
return null;
|
|
1565 |
}
|
|
1566 |
return Custom_List;
|
|
1567 |
}
|
|
1568 |
[OperationContract]
|
|
1569 |
public List<SYMBOL_PUBLIC> GetPublicSymbolList(string dept)
|
|
1570 |
{
|
|
1571 |
List<SYMBOL_PUBLIC> Custom_List = new List<SYMBOL_PUBLIC>();
|
|
1572 |
try
|
|
1573 |
{
|
|
1574 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
|
1575 |
{
|
|
1576 |
if(!string.IsNullOrEmpty(dept))
|
|
1577 |
{
|
|
1578 |
Custom_List = Entity.SYMBOL_PUBLIC.Where(data => data.DEPARTMENT == dept).ToList();
|
|
1579 |
}
|
|
1580 |
else
|
|
1581 |
{
|
|
1582 |
Custom_List = Entity.SYMBOL_PUBLIC.ToList();
|
|
1583 |
}
|
|
1584 |
|
|
1585 |
}
|
|
1586 |
}
|
|
1587 |
catch (Exception)
|
|
1588 |
{
|
|
1589 |
return null;
|
|
1590 |
}
|
|
1591 |
return Custom_List;
|
|
1592 |
}
|
|
1593 |
|
|
1594 |
/// <summary>
|
|
1595 |
///
|
|
1596 |
/// </summary>
|
|
1597 |
/// <param name="id">symbol id</param>
|
|
1598 |
/// <param name="type"> 0 : PRIVATE, 1 : PUBLIC</param>
|
|
1599 |
/// <returns></returns>
|
|
1600 |
[OperationContract]
|
|
1601 |
public string GetSymbolData(string id, int type)
|
|
1602 |
{
|
|
1603 |
string result;
|
|
1604 |
try
|
|
1605 |
{
|
|
1606 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
|
1607 |
{
|
|
1608 |
if(type == 0)
|
|
1609 |
{
|
|
1610 |
result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA;
|
|
1611 |
}
|
|
1612 |
else
|
|
1613 |
{
|
|
1614 |
result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA;
|
|
1615 |
}
|
|
1616 |
}
|
|
1617 |
}
|
|
1618 |
catch (Exception)
|
|
1619 |
{
|
|
1620 |
return null;
|
|
1621 |
}
|
|
1622 |
return result;
|
|
1623 |
}
|
|
1624 |
|
|
1625 |
[OperationContract]
|
|
1626 |
public string GetSignData(string project_no, string user_id)
|
|
1627 |
{
|
|
1628 |
string result = null;
|
|
1629 |
try
|
|
1630 |
{
|
|
1631 |
var ModelWFConnectionString = ConnectStringBuilder.ProjectCIConnectString(project_no).ToString();
|
|
1632 |
if (null != ModelWFConnectionString)
|
|
1633 |
{
|
|
1634 |
using (CIEntities entity = new CIEntities(ModelWFConnectionString))
|
|
1635 |
{
|
|
1636 |
var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id);
|
|
1637 |
if (_sign.Count() > 0)
|
|
1638 |
{
|
|
1639 |
result = _sign.First().SIGN_STR;
|
|
1640 |
}
|
|
1641 |
else
|
|
1642 |
{
|
|
1643 |
return null;
|
|
1644 |
}
|
|
1645 |
}
|
|
1646 |
}
|
|
1647 |
}
|
|
1648 |
catch (Exception)
|
|
1649 |
{
|
|
1650 |
return null;
|
|
1651 |
}
|
|
1652 |
return result;
|
|
1653 |
}
|
|
1654 |
|
|
1655 |
[OperationContract]
|
|
1656 |
public string GetProjectName(string project_no)
|
|
1657 |
{
|
|
1658 |
string result = null;
|
|
1659 |
|
|
1660 |
try
|
|
1661 |
{
|
|
1662 |
using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
|
|
1663 |
{
|
|
1664 |
result = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == project_no).FirstOrDefault().PROJECT_NAME.ToString();
|
|
1665 |
}
|
|
1666 |
}
|
|
1667 |
catch (Exception)
|
|
1668 |
{
|
|
1669 |
return null;
|
|
1670 |
}
|
|
1671 |
return result;
|
|
1672 |
}
|
|
1673 |
|
|
1674 |
[OperationContract]
|
|
1675 |
public List<DOCUMENT_ITEM> GetPreRevSelect(string project_no, string doc_no, string current_rev)
|
|
1676 |
{
|
|
1677 |
List<DOCUMENT_ITEM> result = new List<DOCUMENT_ITEM>();
|
|
1678 |
|
|
1679 |
try
|
|
1680 |
{
|
|
1681 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1682 |
{
|
|
1683 |
result = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == project_no
|
|
1684 |
&& i.DOCUMENT_NO == doc_no
|
|
1685 |
&& i.REVISION != current_rev).OrderByDescending(i => i.GROUP_NO).ToList();
|
|
1686 |
}
|
|
1687 |
}
|
|
1688 |
catch (Exception)
|
|
1689 |
{
|
|
1690 |
return null;
|
|
1691 |
}
|
|
1692 |
return result;
|
|
1693 |
}
|
|
1694 |
|
|
1695 |
[OperationContract]
|
|
1696 |
public DOCINFO GetDocInfoOneSelect(string project_no, string doc_id)
|
|
1697 |
{
|
|
1698 |
DOCINFO docinfo = null;
|
|
1699 |
|
|
1700 |
try
|
|
1701 |
{
|
|
1702 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1703 |
{
|
|
1704 |
docinfo = (from info in Entity.DOCINFO
|
|
1705 |
where info.DOCUMENT_ID == doc_id
|
|
1706 |
&& info.PROJECT_NO == project_no
|
|
1707 |
select info).First();
|
|
1708 |
}
|
|
1709 |
}
|
|
1710 |
catch (Exception)
|
|
1711 |
{
|
|
1712 |
return null;
|
|
1713 |
}
|
|
1714 |
return docinfo;
|
|
1715 |
}
|
|
1716 |
|
|
1717 |
[OperationContract]
|
|
1718 |
public List<MarkupInfoItem> GetPrintDocItemList(string project_no, string doc_id, List<MarkupInfoItem> _markupInfoList)
|
|
1719 |
{
|
|
1720 |
MarkupInfoItem _result = null;
|
|
1721 |
List<MarkupInfoItem> markupinfo = new List<MarkupInfoItem>();
|
|
1722 |
try
|
|
1723 |
{
|
|
1724 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
|
1725 |
{
|
|
1726 |
var docitem = (from info in Entity.DOCINFO
|
|
1727 |
where info.DOCUMENT_ID == doc_id
|
|
1728 |
&& info.PROJECT_NO == project_no
|
|
1729 |
select info).First();
|
|
1730 |
|
|
1731 |
foreach (MARKUP_INFO markinfo in docitem.MARKUP_INFO)
|
|
1732 |
{
|
|
1733 |
var member = (from mem in Entity.MEMBER
|
|
1734 |
where mem.ID == markinfo.USER_ID
|
|
1735 |
select mem).First();
|
|
1736 |
string displaycolor = null;
|
|
1737 |
try
|
|
1738 |
{
|
|
1739 |
displaycolor = _markupInfoList.Where(info => info.MarkupInfoID == markinfo.ID).First().DisplayColor;
|
|
1740 |
}
|
|
1741 |
catch(Exception)
|
|
1742 |
{
|
|
1743 |
displaycolor = "#FFFFFF";
|
|
1744 |
}
|
|
1745 |
|
|
1746 |
_result = new MarkupInfoItem
|
|
1747 |
{
|
|
1748 |
MarkupInfoID = markinfo.ID,
|
|
1749 |
Consolidate = markinfo.CONSOLIDATE,
|
|
1750 |
CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME,
|
|
1751 |
DisplayColor = displaycolor,
|
|
1752 |
UserID = markinfo.USER_ID,
|
|
1753 |
UserName = member.NAME,
|
|
1754 |
Depatment = member.DEPARTMENT,
|
|
1755 |
};
|
|
1756 |
|
|
1757 |
_result.MarkupList = new List<IKCOM.MarkupItem>();
|
|
1758 |
var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First();
|
|
1759 |
|
|
1760 |
foreach (MARKUP_DATA markdata in markup_Version.MARKUP_DATA)
|
|
1761 |
{
|
|
1762 |
MarkupItem markitem = new MarkupItem()
|
|
1763 |
{
|
|
1764 |
ID = markdata.ID,
|
|
1765 |
PageNumber = markdata.PAGENUMBER,
|
|
1766 |
};
|
|
1767 |
_result.MarkupList.Add(markitem);
|
|
1768 |
}
|
|
1769 |
|
|
1770 |
_result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count();
|
|
1771 |
|
|
1772 |
markupinfo.Add(_result);
|
|
1773 |
}
|
|
1774 |
}
|
|
1775 |
}
|
|
1776 |
catch (Exception)
|
|
1777 |
{
|
|
1778 |
return null;
|
|
1779 |
}
|
|
1780 |
return markupinfo;
|
|
1781 |
}
|
908 |
1782 |
}
|
909 |
1783 |
}
|