/******************************************************************** * Insert User CallNotes Data Service *********************************************************************/ public void InsertUserCallNotesData() { // Initalize and reset bool isGQorNoCaller = false; resetCallTypes(); try { // If this call notes are for a general question, no caller selected // or call back is selected, then flip isGQorNoCaller to true if (IsGeneralQuestOrNoCallerOrCallBack()) { isGQorNoCaller = true; } // Create the CallLogUI object CallLogUI calllog = createCallLogUI(); // Set Success or Error message for UI if (CommonConstants.Callid < 0) { // Error Message lblsuccesMessage.Text = failedMessage; lblsuccesMessage.ForeColor = Color.Red; EnableSaveButton(); } else { // Success Message // lblsuccesMessage.Text = updateMessage; //TODO Please ask about this lblsuccesMessage.Text = saveMessage; lblsuccesMessage.ForeColor = Color.Green; lblsuccesMessage.Visible = true; } // Insert User Call Notes into Database dblayer.InsertUserCallNotesData(calllog, isGQorNoCaller); } catch (Exception ex) { // ERROR: Log Error Logging.LogErrorMsg(this.Name, MethodInfo.GetCurrentMethod().Name, ex.Message, ex.StackTrace); } }
/******************************************************************** * Create CallLogUI Object *********************************************************************/ public CallLogUI createCallLogUI() { try { CallLogUI calllog = new CallLogUI(); // Set start time for a General Question, No Caller Selected, or Call Back was selected if (IsGeneralQuestOrNoCallerOrCallBack()) { calllog.StartTime = DateTime.Now; } // Populate the call log values calllog.FRCRCNumber = getCallerDetailsControlListValue("cbFRA", true, ComboBox.clazz); calllog.FRCRCNumber = getCallerDetailsControlListValue("txtFRA", true, TextBox.clazz); // TODO look into two FRCRCNumber. Verify rules calllog.CallBackPhone = getCallerDetailsControlListValue("txtFRA", true, TextBox.clazz); calllog.SearchType = txtbxCallType.Text; calllog.SearchValue = txtbxCallDetails.Text; calllog.Role = CommonConstants.SelectedRole.ToString(); calllog.Qualifier = buildValueForList(calllog.Qualifier, lstQualifier); calllog.ClosingQues = buildValueForList(calllog.ClosingQues, lstclosingQues); // If GANumber is null/blank then search for value otherwise use what's there if (string.IsNullOrWhiteSpace(CommonConstants.GANumber.ToString())) { calllog.GANumber = getCallerControlListValue("txtno", true, TextBox.clazz); } else { calllog.GANumber = CommonConstants.GANumber; } // If selected role matches the required list of roles then get and set the call log values if (isRequiredForSelectedRole(CommonConstants.SelectedRole, lstInteractionRequiredRoles)) { calllog.InteractionID = getValueWithNullCheck(CommonConstants.interactionIDKey); } if (isRequiredForSelectedRole(CommonConstants.SelectedRole, lstCallerRequiredRoles)) { calllog.CallerID = getValueWithNullCheck(CommonConstants.callerID); } if (isRequiredForSelectedRole(CommonConstants.SelectedRole, lstCallerIntentRequiredRoles)) { calllog.CallerIntent = getValueWithNullCheck(CommonConstants.CallerIntent); } // For each Caller Detail record create the list of CallerNames or single value CallerName for (int i = 0; i < grpCallerDetails.Controls.Count; i++) { if (isRequiredForSelectedRole(CommonConstants.SelectedRole, lstCallerNameRequiredRoles)) { // Add items to lstcallerName array CheckBox chkBox = (CheckBox)grpCallerDetails.Controls[i]; if (chkBox.Checked == true) { string ctrlname = "txt" + chkBox.Name.Substring(2); if (hasRecords(findCallerDetails(ctrlname, true))) { lstcallerName.Add(getCallerDetailsControlListValue(ctrlname, true, TextBox.clazz)); } else if (containsIgnoreCase(chkBox.Text, "assignee")) { lstcallerName.Add(getCallerDetailsControlListValue("cbAssignee", true, ComboBox.clazz)); } else if (containsIgnoreCase(chkBox.Text, "fra")) { lstcallerName.Add(getCallerDetailsControlListValue("cbFRA", true, ComboBox.clazz)); } else if (containsIgnoreCase(chkBox.Text, "fr")) { lstcallerName.Add(getCallerDetailsControlListValue("cbFR", true, ComboBox.clazz)); } } } else { // Else set the CallerName field if Caller Details are not required for role RadioButton rb = (RadioButton)grpCallerDetails.Controls[i]; if (rb.Checked == true) { calllog.CallerType = rb.Text; string ctrlname = "txt" + rb.Name.Substring(2); if (hasRecords(findCallerDetails(ctrlname, true))) { calllog.CallerName = getCallerDetailsControlListValue(ctrlname, true, TextBox.clazz); } else if (containsIgnoreCase(rb.Text, "assignee")) { calllog.CallerName = getCallerDetailsControlListValue("cbAssignee", true, ComboBox.clazz); } else if (containsIgnoreCase(chkBox.Text, "fra")) { calllog.CallerName = getCallerDetailsControlListValue("cbFRA", true, ComboBox.clazz); } else if (containsIgnoreCase(chkBox.Text, "fr")) { calllog.CallerName = getCallerDetailsControlListValue("cbFR", true, ComboBox.clazz); } break; } } } // Loop through the Call Type array and set values for (int i = 0; i < gbCalltype.Controls.Count; i++) { CheckBox chkbox = (CheckBox)gbCalltype.Controls[i]; if (chkbox.Checked == true && chkbox.Name.Contains("Specify")) { if (chkbox.Text.Contains("Transfer")) { if (isSkillAvailable) { calllog.SkillSet = getCallerTypeControlListValue("cmbSkill", true, ComboBox); } if (isReasonCodeAvailable) { calllog.ReasonCode = getCallerTypeControlListValue("cmbReason", true, ComboBox); } if (isInternalTransferAvailable) { calllog.InternalTransfer = getCallerTypeControlListValue("cmbInternalTransfer", true, ComboBox); } else { calllog.InternalTransfer = getCallerTypeControlListValue("txtTransfer", true, TextBox); } } else if (chkbox.Text.Contains("Other")) { calllog.Others = getCallerTypeControlListValue("txtOther", true, TextBox); } } } string chklstBox1Item = string.Empty; if (isRequiredForSelectedRole(CommonConstants.SelectedRole, lstBox1ItemRequiredRoles)) { // Set chklstBox1Item if (hasRecords(chklstBox1NBCSR.CheckedItems)) { string chkboxList1_Item = chklstBox1NBCSR.SelectedItem.ToString(); // TODO Verify with requirements as this code seems strange // The chklstBox1Item is always going to be empty at this point because // we just set it to Empty above. if (!string.IsNullOrEmpty(chklstBox1Item)) { chklstBox1Item = chklstBox1Item + "," + chkboxList1_Item; } else { chklstBox1Item = chkboxList1_Item; } } // Set lstcallType or lstcallType2 if (chklstBox2NBCSR.Visible == true && hasRecords(chklstBox2NBCSR.CheckedItems)) { string chkboxList2_Item = chklstBox2NBCSR.SelectedItem.ToString(); if (!string.IsNullOrEmpty(chkboxList2_Item)) { if (isRequiredForSelectedRole(CommonConstants.SelectedRole, lstCallType2RequiredRoles)) { lstcallType2.Add(chkboxList2_Item); } else { lstcallType.Add(chkboxList2_Item); } } } // Set lstcallType3 if (chklstBox3NBCSR.Visible == true && hasRecords(chklstBox3NBCSR.CheckedItems)) { string chkboxList3_Item = chklstBox3NBCSR.SelectedItem.ToString(); if (!string.IsNullOrEmpty(chkboxList3_Item)) { if (isRequiredForSelectedRole(CommonConstants.SelectedRole, lstCallType3or4RequiredRoles)) { lstcallType3.Add(chkboxList3_Item); } else { lstcallType.Add(chkboxList3_Item); } } } // Set lstcallType4 if (chklstBox4NBCSR.Visible == true && hasRecords(chklstBox4NBCSR.CheckedItems)) { string chkboxList4_Item = chklstBox4NBCSR.SelectedItem.ToString(); if (!string.IsNullOrEmpty(chkboxList4_Item)) { if (isRequiredForSelectedRole(CommonConstants.SelectedRole, lstCallType3or4RequiredRoles)) { lstcallType4.Add(chkboxList4_Item); } else { lstcallType.Add(chkboxList4_Item); } } } } // Initialize values for setting of the next section string result = string.Empty; int index = 0; string result1 = string.Empty; string num = string.Empty; bool isNumberChanged = false; foreach (Control cn in gbCalltype.Controls) { if (cn is ComboBox) { // Initialize values for ComboBox isNumberChanged = false; string cmbBoxName = cn.Name; string comboBoxNameWithNumber = string.Empty; string commonCmbBoxName = string.Empty; string cmbBoxNumber = string.Empty; string number = string.Empty; string callType = string.Empty; string h = cmbBoxName.ElementAt(cmbBoxName.Length - 3).ToString(); // Set Default Substring Search Indexes // Common Combo Box Name Default Indexes int commonCmbBoxNameStartIndex = 0; int commonCmbBoxNameEndIndex = cmbBoxName.Length - 2; // Combo Box Name with Number Default Indexes int comboBoxNameWithNumberStartIndex = 0; int comboBoxNameWithNumberEndIndex = cmbBoxName.Length - 1; // Number Default Indexes int numberStartIndex = cmbBoxName.Length - 1; // Call Type Default Indexes int callTypeStartIndex = 3; int callTypeEndIndex = cmbBoxName.Length - 5; if (h.Any(char.IsDigit)) { // Override the defaults if any character is a digit int commonCmbBoxNameStartIndex = 0; int commonCmbBoxNameEndIndex = cmbBoxName.Length - 3; int comboBoxNameWithNumberStartIndex = 0; int comboBoxNameWithNumberEndIndex = cmbBoxName.Length - 2; int numberStartIndex = cmbBoxName.Length - 2; int callTypeEndIndex = cmbBoxName.Length - 6; } // Set values using substring and the indexes commonCmbBoxName = getSubstringValue(cmbBoxName, commonCmbBoxNameStartIndex, commonCmbBoxNameEndIndex); comboBoxNameWithNumber = getSubstringValue(cmbBoxName, comboBoxNameWithNumberStartIndex, comboBoxNameWithNumberEndIndex); number = getSubstringValue(cmbBoxName, numberStartIndex); callType = getSubstringValue(cmbBoxName, callTypeStartIndex, callTypeEndIndex); int index1 = cmbBoxName.IndexOf(commonCmbBoxName); cmbBoxNumber = getSubstringValue(comboBoxNameWithNumber, index1 + commonCmbBoxName.Length); // Set result1, lstcallType 1 to 4 if (!(containsIgnoreCase(cmbBoxName, "skill") || containsIgnoreCase(cmbBoxName, "transfer") || containsIgnoreCase(cmbBoxName, "reason") || containsIgnoreCase(cmbBoxName, "documentrequest"))) { Control[] ctlList = findCallType("cb" + number, true); CheckBox chkBox = ((CheckBox)ctlList[0]); ComboBox cmb = (ComboBox)cn; if (chkBox != null && chkBox.Checked == true) { if (comboBoxNameWithNumber.Contains("1") && cmbBoxNumber.Equals("1")) { if (!string.IsNullOrEmpty(callType) && cmb.SelectedItem != null) { lstcallType2.Add(cmb.SelectedItem.ToString()); } else if (string.IsNullOrEmpty(callType) && cmb.SelectedItem != null && !string.IsNullOrEmpty(result1)) { result1 = result1 + "," + cmb.SelectedItem.ToString(); } else if (string.IsNullOrEmpty(callType) && cmb.SelectedItem != null && string.IsNullOrEmpty(result1)) { result1 = cmb.SelectedItem.ToString(); } } else { if (cmb.SelectedItem != null) { if (comboBoxNameWithNumber.Contains("2") && cmbBoxNumber.Equals("2")) { lstcallType2.Add(cmb.SelectedItem.ToString()); } else if (comboBoxNameWithNumber.Contains("3") && cmbBoxNumber.Equals("3")) { lstcallType3.Add(cmb.SelectedItem.ToString()); } else if (comboBoxNameWithNumber.Contains("4") && cmbBoxNumber.Equals("4")) { lstcallType4.Add(cmb.SelectedItem.ToString()); } } } } } } } // Added for CSR or NBCSR call type removal // TODO: Verify if this has to be located here or can be rolled up in logic earlier if ((CommonConstants.SelectedRole == POSRoles.CSR || CommonConstants.SelectedRole == POSRoles.NBCSR) && lstcallType.Count == 0) { calllog.CallType = string.Empty; } // Set Call Log values calllog.CallType = buildValueForList(calllog.CallType, lstcallType); calllog.CallerType = buildValueForList(calllog.CallerType, lstClrType); calllog.CallerName = buildValueForList(calllog.CallerName, lstcallerName); calllog.CallType = buildValueForString(calllog.CallType, result1); calllog.CallType = buildValueForString(calllog.CallType, chklstBox1Item); calllog.CallType2 = buildValueForList(calllog.CallType2, lstcallType2); calllog.CallType3 = buildValueForList(calllog.CallType3, lstcallType3); calllog.CallType4 = buildValueForList(calllog.CallType4, lstcallType4); calllog.AdditionalSearchNos = getAdditionalSearchNosValue(lbxAdditionalSearch); calllog.CallNotes = txtbxNotes.Text; calllog.TransferFrom = string.Empty; // Set Related Reference if role is of CSR if (CommonConstants.SelectedRole == POSRoles.CSR) { calllog.RelatedRef = varRelatedRef; //TODO Find out where this comes from } // If CallType is null if (calllog.CallType == null) { // And we meet these conditions if ((isNoCallerSelected && (CommonConstants.SelectedRole == POSRoles.CSR || CommonConstants.SelectedRole == POSRoles.LTC || CommonConstants.SelectedRole == POSRoles.SHRC || CommonConstants.SelectedRole == POSRoles.PolicyMaintenance || CommonConstants.SelectedRole == POSRoles.Distribution || CommonConstants.SelectedRole == POSRoles.ADM || CommonConstants.SelectedRole == POSRoles.IncomeBenefit || CommonConstants.SelectedRole == POSRoles.CRR)) || ((CommonConstants.SelectedRole == POSRoles.LoansAndSurrender) && (isNoCallerSelected || isCallBackSelected))) { // Then set the CallType value to an empty string calllog.CallType = string.Empty; } } return(calllog); } catch (Exception ex) { Logging.LogErrorMsg(this.Name, MethodInfo.GetCurrentMethod().Name, ex.Message, ex.StackTrace); throw new System.Exception("Exception in creating the CallLogUI object. ", ex); } }