private void CheckPhoneCallHistory(SLMDBEntities slmdb, kkslm_tr_lead lead, BatchCARInsertStatusData data) { try { if (!string.IsNullOrEmpty(data.StatusName)) { if (data.StatusName.Trim().Length > 4000) { throw new Exception("Field kkslm_ext_StatusDesc exceeds 4000 character limitation"); } kkslm_phone_call pc = new kkslm_phone_call() { slm_TicketId = lead.slm_ticketId, slm_ContactDetail = data.StatusName.Trim(), slm_CreateBy = "SYSTEM", slm_CreatedBy_Position = null, slm_CreateDate = DateTime.Now, slm_Status = lead.slm_Status, slm_Owner = lead.slm_Owner, slm_Owner_Position = lead.slm_Owner_Position, slm_ContactPhone = null, is_Deleted = 0 }; slmdb.kkslm_phone_call.AddObject(pc); } } catch (Exception ex) { throw ex; } }
private List <BatchCARInsertStatusData> GetEBatchCARInsertStatusList(string filePath, int cbsFileId) { List <BatchCARInsertStatusData> ret = null; try { BatchCARInsertStatusHeaderData head = null; using (var streamReader = new StreamReader(filePath)) { string line; while ((line = streamReader.ReadLine()) != null) { if (line.Trim() == "") { continue; } string[] tmp = line.Split('|'); if (tmp.Length == 9) { //Header Row Digit แรกต้องเป็นตัว H if (tmp[0] == AppConstant.BatchCARInsertStatus.TYPE_OF_DATA_HEAD) //TYPE OF DATA { head = new BatchCARInsertStatusHeaderData { ReferenceCode = tmp[1], FileName = tmp[2], CreateDate = tmp[3], CurrentSequence = Convert.ToInt16(tmp[4]), TotalSequence = Convert.ToInt16(tmp[5]), TotalRecord = Convert.ToInt16(tmp[6]), SystemCode = tmp[7] }; ret = new List <BatchCARInsertStatusData>(); } } else if (tmp.Length == 13) //Data Row Digit แรกต้องเป็นตัว D { if (tmp[0] == AppConstant.BatchCARInsertStatus.TYPE_OF_DATA_DETAIL) { BatchCARInsertStatusData data = new BatchCARInsertStatusData { HeaderData = head, ReferenceNo = tmp[1], ChannelID = tmp[2], StatusDateTime = tmp[3], SubscriptionID = tmp[4], SubscriptionCardType = tmp[5], SubscriptionCusType = tmp[6], OwnerSystemId = tmp[7], OwnerSystemCode = tmp[8], RefSystemId = tmp[9], RefSystemCode = tmp[10], Status = tmp[11], StatusName = tmp[12] }; ret.Add(data); } } } } } catch (Exception ex) { UpdateFileStatus(cbsFileId, "FAIL", "Exception : " + ex.Message); } return(ret); }
private void CheckStatus(SLMDBEntities slmdb, kkslm_tr_lead lead, BatchCARInsertStatusData data, string batchCode) { try { string newExternalSystem = ""; string newExternalStatus = ""; string newExternalSubStatus = ""; string newExternalSubStatusDesc = ""; string oldExternalSystem = ""; string oldExternalStatus = ""; string oldExternalSubStatus = ""; string oldExternalSubStatusDesc = ""; string slmOldStatus = ""; slmOldStatus = lead.slm_Status; oldExternalSystem = lead.slm_ExternalSystem; oldExternalStatus = lead.slm_ExternalStatus; oldExternalSubStatus = string.IsNullOrEmpty(lead.slm_ExternalSubStatus) ? null : lead.slm_ExternalSubStatus; oldExternalSubStatusDesc = lead.slm_ExternalSubStatusDesc; if (string.IsNullOrEmpty(data.OwnerSystemCode)) { throw new Exception("System Name in view is null or blank"); } string slmNewStatus = GetSlmStatusCode(slmdb, data.OwnerSystemCode, data.Status, "", lead.slm_Product_Id); if (slmNewStatus == "") { throw new Exception("Cannot find slmStatusCode from the specified " + data.Status + " mapping statusCode=" + data.Status + ", slmProductId=" + lead.slm_Product_Id); } newExternalSystem = data.OwnerSystemCode.Trim().ToUpper(); newExternalStatus = data.Status; newExternalSubStatus = data.Status; newExternalSubStatusDesc = data.StatusName; if (slmNewStatus != slmOldStatus || newExternalStatus != oldExternalStatus || newExternalSubStatus != oldExternalSubStatus || newExternalSystem != oldExternalSystem) { DateTime updateDate = DateTime.Now; kkslm_tr_activity activity = new kkslm_tr_activity() { slm_TicketId = data.RefSystemId, slm_OldStatus = slmOldStatus, slm_NewStatus = slmNewStatus, slm_CreatedBy = "SYSTEM", slm_CreatedBy_Position = null, slm_CreatedDate = updateDate, slm_Type = "09", slm_SystemAction = data.OwnerSystemCode.Trim().ToUpper(), //System ที่เข้ามาทำ action (18/10/2017) slm_SystemActionBy = "SLM", //action เกิดขึ้นที่ระบบอะไร (18/10/2017) slm_ExternalSystem_Old = oldExternalSystem, slm_ExternalStatus_Old = oldExternalStatus, slm_ExternalSubStatus_Old = oldExternalSubStatus, slm_ExternalSubStatusDesc_Old = oldExternalSubStatusDesc, slm_ExternalSystem_New = newExternalSystem, slm_ExternalStatus_New = newExternalStatus, slm_ExternalSubStatus_New = newExternalSubStatus, slm_ExternalSubStatusDesc_New = newExternalSubStatusDesc }; slmdb.kkslm_tr_activity.AddObject(activity); DateTime StatusDateTime = data.StatusDateTime.ConvertStringToStatusDateTime(); AppUtil.CalculateTotalSLA(slmdb, lead, activity, StatusDateTime, logfilename, batchCode); lead.slm_Status = slmNewStatus; lead.slm_StatusDate = StatusDateTime; lead.slm_StatusDateSource = StatusDateTime; lead.slm_Counting = 0; lead.slm_UpdatedBy = "SYSTEM"; lead.slm_UpdatedDate = updateDate; lead.slm_ExternalSystem = newExternalSystem; lead.slm_ExternalStatus = newExternalStatus; } } catch (Exception ex) { throw ex; } }