protected void btnAddNote_Click(object sender, EventArgs e) { try { cbSendEmail.Enabled = SlmScr009Biz.HasOwnerOrDelegate(txtTicketID.Text.Trim()); if (!cbSendEmail.Enabled) { lblInfo.Text = "ข้อมูลผู้มุ่งหวังนี้ ยังไม่ถูกจ่ายงานให้ Telesales ดังนั้นการบันทึก Note ไม่สามารถส่ง Email ได้"; } else { lblInfo.Text = ""; CheckEmailSubject(); } upPopup.Update(); mpePopup.Show(); } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
private void DoBindGridview() { List <NoteHistoryData> result = SlmScr009Biz.SearchNoteHistory(txtTicketID.Text.Trim(), txtPreleadId.Text.Trim()); BindGridview((SLM.Application.Shared.GridviewPageController)pcTop, result.ToArray(), 0); //cbNoteFlag.Enabled = gvNoteHistory.Rows.Count > 0 ? true : false; upResult.Update(); }
protected void btnSave_Click(object sender, EventArgs e) { try { if (ValidateData()) { if (txtNoteDetail.Text.Trim().Length > AppConstant.TextMaxLength) { throw new Exception("ไม่สามารถบันทึกรายละเอียด Note เกิน " + AppConstant.TextMaxLength.ToString() + " ตัวอักษรได้"); } string noteId = ""; if (txtTicketID.Text.Trim() != "") //กรณี Lead { noteId = SlmScr009Biz.InsertNoteHistory(txtTicketID.Text.Trim(), cbSendEmail.Checked, txtEmailSubject.Text.Trim(), txtNoteDetail.Text.Trim(), GetEmailList(), HttpContext.Current.User.Identity.Name); } else if (txtPreleadId.Text.Trim() != "" && txtTicketID.Text.Trim() == "") //กรณี Prelead { noteId = SlmScr009Biz.InsertPreleadNoteHistory(decimal.Parse(txtPreleadId.Text.Trim()), cbSendEmail.Checked, txtEmailSubject.Text.Trim(), txtNoteDetail.Text.Trim(), GetEmailList(), HttpContext.Current.User.Identity.Name); } else { throw new Exception("ไม่พบ PreleadId หรือ TicketId เพื่อใช้ในการบันทึกข้อมูล"); } CreateCASActivityLog(noteId); txtNoteDetail.Text = ""; cbSendEmail.Checked = false; CheckEmailSubject(); lblInfo.Text = ""; ClearPopupControl(); if (txtTicketID.Text.Trim() != "") { cbNoteFlag.Checked = true; } DoBindGridview(); mpePopup.Hide(); AppUtil.ClientAlert(Page, "บันทึกข้อมูลเรียบร้อย"); } else { mpePopup.Show(); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Error(message); AppUtil.ClientAlert(Page, message); mpePopup.Show(); } }
protected void cbNoteFlag_CheckedChanged(object sender, EventArgs e) { try { SlmScr009Biz.ChangeNoteFlag(txtTicketID.Text.Trim(), cbNoteFlag.Checked, HttpContext.Current.User.Identity.Name); } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
protected void PageSearchChange(object sender, EventArgs e) { try { List <NoteHistoryData> result = SlmScr009Biz.SearchNoteHistory(txtTicketID.Text.Trim(), txtPreleadId.Text.Trim()); var pageControl = (SLM.Application.Shared.GridviewPageController)sender; BindGridview(pageControl, result.ToArray(), pageControl.SelectedPageIndex); } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
public void InitialControl(string ticketId) { try { if (string.IsNullOrWhiteSpace(ticketId)) { ticketId = Request["ticketid"]; } var data = SlmScr009Biz.GetDataForNoteTab(ticketId); if (data.ISCOC == "1") { btnAddNote.Visible = (data.COCCurrentTeam == SLMConstant.COCTeam.Marketing ? true : false); cbNoteFlag.Visible = (data.COCCurrentTeam == SLMConstant.COCTeam.Marketing ? true : false); } else { btnAddNote.Visible = true; cbNoteFlag.Visible = true; } txtTicketID.Text = data.TicketId; txtContractNo.Text = data.ContractNo; //Added 01/04/2016 txtPreleadId.Text = data.PreleadId != null?data.PreleadId.Value.ToString() : ""; txtFirstname.Text = data.Name; txtLastname.Text = data.LastName; txtOwnerLead.Text = data.OwnerName; txtCampaign.Text = data.CampaignName; txtTelNo1.Text = data.TelNo_1; txtExt1.Text = data.Ext_1; cbNoteFlag.Checked = data.NoteFlag != null ? (data.NoteFlag == "1" ? true : false) : false; pcTop.SetVisible = false; DoBindGridview(); CheckEmailSubject(); } catch { throw; } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (ValidateData()) { if (txtNoteDetail.Text.Trim().Length > AppConstant.TextMaxLength) { throw new Exception("ไม่สามารถบันทึกรายละเอียด Note เกิน " + AppConstant.TextMaxLength.ToString() + " ตัวอักษรได้"); } SlmScr009Biz.InsertNoteHistory(txtTicketID.Text.Trim(), cbSendEmail.Checked, txtEmailSubject.Text.Trim(), txtNoteDetail.Text.Trim(), GetEmailList(), HttpContext.Current.User.Identity.Name); txtNoteDetail.Text = ""; cbSendEmail.Checked = false; CheckEmailSubject(); lblInfo.Text = ""; ClearPopupControl(); mpePopup.Hide(); cbNoteFlag.Checked = true; DoBindGridview(); AppUtil.ClientAlert(Page, "บันทึกข้อมูลเรียบร้อย"); } else { mpePopup.Show(); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); mpePopup.Show(); } }
private void CreateCASActivityLog(string noteId) { SlmScr009Biz biz = new SlmScr009Biz(); string emailTo = ""; string emailSubject = ""; try { var data = CARServiceBiz.GetDataForCARLogService(txtTicketID.Text.Trim(), txtPreleadId.Text.Trim()); if (cbSendEmail.Checked) { emailSubject = txtEmailSubject.Text.Trim(); if (data != null) { emailSubject = "[" + data.StatusName + "]" + (string.IsNullOrEmpty(data.SubStatusName) ? "" : "-[" + data.SubStatusName + "]") + " " + emailSubject; if (!string.IsNullOrEmpty(data.Owner) && !string.IsNullOrEmpty(data.OwnerEmail)) { emailTo += (emailTo != "" ? ", " : "") + data.OwnerEmail; } if (!string.IsNullOrEmpty(data.Delegate) && !string.IsNullOrEmpty(data.DelegateEmail)) { emailTo += (emailTo != "" ? ", " : "") + data.DelegateEmail; } } if (txtEmailTo.Text.Trim() != "") { emailTo += (emailTo != "" ? ", " : "") + txtEmailTo.Text.Trim(); } } var staff = StaffBiz.GetStaff(HttpContext.Current.User.Identity.Name); //Activity Info List <Services.CARService.DataItem> actInfoList = new List <Services.CARService.DataItem>(); actInfoList.Add(new Services.CARService.DataItem() { SeqNo = 1, DataLabel = "ผู้สร้าง Note", DataValue = staff != null ? staff.StaffNameTH : HttpContext.Current.User.Identity.Name }); actInfoList.Add(new Services.CARService.DataItem() { SeqNo = 2, DataLabel = "ส่งอีเมล", DataValue = cbSendEmail.Checked ? "Y" : "N" }); actInfoList.Add(new Services.CARService.DataItem() { SeqNo = 3, DataLabel = "To", DataValue = emailTo }); actInfoList.Add(new Services.CARService.DataItem() { SeqNo = 4, DataLabel = "Subject", DataValue = emailSubject }); actInfoList.Add(new Services.CARService.DataItem() { SeqNo = 5, DataLabel = "บันทึก Note", DataValue = txtNoteDetail.Text.Trim() }); //Customer Info List <Services.CARService.DataItem> cusInfoList = new List <Services.CARService.DataItem>(); cusInfoList.Add(new Services.CARService.DataItem() { SeqNo = 1, DataLabel = "Subscription ID", DataValue = (data != null ? data.CitizenId : "") }); cusInfoList.Add(new Services.CARService.DataItem() { SeqNo = 2, DataLabel = "Subscription Type", DataValue = (data != null ? data.CardTypeName : "") }); cusInfoList.Add(new Services.CARService.DataItem() { SeqNo = 3, DataLabel = "ชื่อ-นามสกุลของลูกค้า", DataValue = data != null ? data.CustomerName : "" }); //Product Info List <Services.CARService.DataItem> prodInfoList = new List <Services.CARService.DataItem>(); prodInfoList.Add(new Services.CARService.DataItem() { SeqNo = 1, DataLabel = "Product Group", DataValue = (data != null ? data.ProductGroupName : "") }); prodInfoList.Add(new Services.CARService.DataItem() { SeqNo = 2, DataLabel = "Product", DataValue = (data != null ? data.ProductName : "") }); prodInfoList.Add(new Services.CARService.DataItem() { SeqNo = 3, DataLabel = "Campaign", DataValue = (data != null ? data.CampaignName : "") }); //Contract Info List <Services.CARService.DataItem> contInfoList = new List <Services.CARService.DataItem>(); contInfoList.Add(new Services.CARService.DataItem() { SeqNo = 1, DataLabel = "เลขที่สัญญา", DataValue = (data != null ? data.ContractNo : "") }); contInfoList.Add(new Services.CARService.DataItem() { SeqNo = 2, DataLabel = "ระบบที่บันทึกสัญญา", DataValue = txtPreleadId.Text.Trim() != "" ? "HP" : "" }); contInfoList.Add(new Services.CARService.DataItem() { SeqNo = 3, DataLabel = "ทะเบียนรถ", DataValue = (data != null ? data.LicenseNo : "") }); //Officer Info List <Services.CARService.DataItem> offInfoList = new List <Services.CARService.DataItem>(); offInfoList.Add(new Services.CARService.DataItem() { SeqNo = 1, DataLabel = "Officer", DataValue = (staff != null ? staff.StaffNameTH : HttpContext.Current.User.Identity.Name) }); Services.CARService.CARServiceData carData = new Services.CARService.CARServiceData() { ReferenceNo = noteId, SecurityKey = txtPreleadId.Text.Trim() != "" ? SLMConstant.CARLogService.OBTSecurityKey : SLMConstant.CARLogService.SLMSecurityKey, ServiceName = "CreateActivityLog", SystemCode = txtPreleadId.Text.Trim() != "" ? SLMConstant.CARLogService.CARLoginOBT : SLMConstant.CARLogService.CARLoginSLM, //ถ้ามี preleadid ให้ถือว่าเป็น OBT ทั้งหมด ถึงจะมี TicketId ก็ตาม TransactionDateTime = DateTime.Now, ActivityInfoList = actInfoList, CustomerInfoList = cusInfoList, ProductInfoList = prodInfoList, ContractInfoList = contInfoList, OfficerInfoList = offInfoList, ActivityDateTime = DateTime.Now, CampaignId = data != null ? data.CampaignId : "", ChannelId = data != null ? data.ChannelId : "", PreleadId = txtPreleadId.Text.Trim(), ProductGroupId = data != null ? data.ProductGroupId : "", ProductId = data != null ? data.ProductId : "", Status = data != null ? data.StatusName : "", SubStatus = data != null ? data.SubStatusName : "", TicketId = txtTicketID.Text.Trim(), SubscriptionId = data != null ? data.CitizenId : "", TypeId = SLMConstant.CARLogService.Data.TypeId, AreaId = SLMConstant.CARLogService.Data.AreaId, SubAreaId = SLMConstant.CARLogService.Data.SubAreaId, ActivityTypeId = SLMConstant.CARLogService.Data.ActivityType.FYIId, ContractNo = data != null ? data.ContractNo : "" }; if (data != null && !string.IsNullOrEmpty(data.CBSSubScriptionTypeId)) { carData.CIFSubscriptionTypeId = data.CBSSubScriptionTypeId; } bool ret = Services.CARService.CreateActivityLog(carData); biz.UpdateCasFlag(txtTicketID.Text.Trim(), txtPreleadId.Text.Trim(), noteId, ret ? "1" : "2"); } catch (Exception ex) { biz.UpdateCasFlag(txtTicketID.Text.Trim(), txtPreleadId.Text.Trim(), noteId, "2"); //Error ให้ลง Log ไว้ ไม่ต้อง Throw string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Error(message); } }