internal void AddNewDepartment() { // Create a new department row WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow newDepartment = vbData.Departments.NewDepartmentsRow(); newDepartment.CustomerID = Properties.Settings.Default.CustomerID; newDepartment.DepartmentID = Guid.NewGuid(); newDepartment.Name = CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.CallFlowView_NewDepartment); newDepartment.Type = (int)WOSI.CallButler.Data.DepartmentTypes.Greeting; newDepartment.Enabled = true; newDepartment.OptionNumber = GetNewOptionNumber(); Forms.DepartmentForm dpForm = new CallButler.Manager.Forms.DepartmentForm(newDepartment, vbData); if (dpForm.ShowDialog(this) == DialogResult.OK) { // Add our department locally vbData.Departments.AddDepartmentsRow(newDepartment); // Add our department remotely ManagementInterfaceClient.ManagementInterface.PersistDepartment(ManagementInterfaceClient.AuthInfo, Utils.TableUtils <WOSI.CallButler.Data.CallButlerDataset.DepartmentsDataTable> .CreateTableFromRow(newDepartment)); PersistDepartmentGreeting(newDepartment, null, dpForm); CallFlowItem cfItem = AddCallFlowDepartmentItem(newDepartment); diagramControl.ScrollControlIntoView(cfItem); NotifyUpdateMenuGreeting(); vbData.AcceptChanges(); } }
/*void RenumberDepartmentOptions() * { * WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow[] departments = (WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow[])vbData.Departments.Select("", "OptionNumber ASC"); * * int optionNumber = 1; * * foreach (WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow department in departments) * { * if (department.RowState != DataRowState.Deleted) * { * department.OptionNumber = optionNumber; * optionNumber++; * } * } * * ManagementInterfaceClient.ManagementInterface.PersistDepartment(ManagementInterfaceClient.AuthInfo, vbData.Departments); * vbData.Departments.AcceptChanges(); * UpdateDepartments(); * }*/ void EditDepartment(WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow department, CallFlowItem cfItem) { Forms.DepartmentForm dpForm = new CallButler.Manager.Forms.DepartmentForm(department, vbData); WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow localizedGreeting = null; // Get and load our localized greeting if this is a greeting department if (department.Type == (short)WOSI.CallButler.Data.DepartmentTypes.Greeting) { WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable localizedGreetings = ManagementInterfaceClient.ManagementInterface.GetLocalizedGreeting(ManagementInterfaceClient.AuthInfo, department.DepartmentID, GetCurrentLanguage()); if (localizedGreetings.Count > 0) { localizedGreeting = localizedGreetings[0]; Utils.GreetingUtils.GetLocalizedGreetingSound(localizedGreeting); dpForm.GreetingControl.LoadGreeting(localizedGreeting, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); } } if (dpForm.ShowDialog(this) == DialogResult.OK) { vbData.AcceptChanges(); // Update our department item remotely ManagementInterfaceClient.ManagementInterface.PersistDepartment(ManagementInterfaceClient.AuthInfo, Utils.TableUtils <WOSI.CallButler.Data.CallButlerDataset.DepartmentsDataTable> .CreateTableFromRow(department)); PersistDepartmentGreeting(department, localizedGreeting, dpForm); //if ((WOSI.CallButler.Data.DepartmentTypes)department.Type == WOSI.CallButler.Data.DepartmentTypes.Greeting) // dpForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); UpdateDepartmentItem(cfItem); NotifyUpdateMenuGreeting(); } }
/*void RenumberDepartmentOptions() { WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow[] departments = (WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow[])vbData.Departments.Select("", "OptionNumber ASC"); int optionNumber = 1; foreach (WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow department in departments) { if (department.RowState != DataRowState.Deleted) { department.OptionNumber = optionNumber; optionNumber++; } } ManagementInterfaceClient.ManagementInterface.PersistDepartment(ManagementInterfaceClient.AuthInfo, vbData.Departments); vbData.Departments.AcceptChanges(); UpdateDepartments(); }*/ void EditDepartment(WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow department, CallFlowItem cfItem) { Forms.DepartmentForm dpForm = new CallButler.Manager.Forms.DepartmentForm(department, vbData); WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow localizedGreeting = null; // Get and load our localized greeting if this is a greeting department if (department.Type == (short)WOSI.CallButler.Data.DepartmentTypes.Greeting) { WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable localizedGreetings = ManagementInterfaceClient.ManagementInterface.GetLocalizedGreeting(ManagementInterfaceClient.AuthInfo, department.DepartmentID, GetCurrentLanguage()); if (localizedGreetings.Count > 0) { localizedGreeting = localizedGreetings[0]; Utils.GreetingUtils.GetLocalizedGreetingSound(localizedGreeting); dpForm.GreetingControl.LoadGreeting(localizedGreeting, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); } } if (dpForm.ShowDialog(this) == DialogResult.OK) { vbData.AcceptChanges(); // Update our department item remotely ManagementInterfaceClient.ManagementInterface.PersistDepartment(ManagementInterfaceClient.AuthInfo, Utils.TableUtils<WOSI.CallButler.Data.CallButlerDataset.DepartmentsDataTable>.CreateTableFromRow(department)); PersistDepartmentGreeting(department, localizedGreeting, dpForm); //if ((WOSI.CallButler.Data.DepartmentTypes)department.Type == WOSI.CallButler.Data.DepartmentTypes.Greeting) // dpForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); UpdateDepartmentItem(cfItem); NotifyUpdateMenuGreeting(); } }
internal void AddNewDepartment() { // Create a new department row WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow newDepartment = vbData.Departments.NewDepartmentsRow(); newDepartment.CustomerID = Properties.Settings.Default.CustomerID; newDepartment.DepartmentID = Guid.NewGuid(); newDepartment.Name = CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.CallFlowView_NewDepartment); newDepartment.Type = (int)WOSI.CallButler.Data.DepartmentTypes.Greeting; newDepartment.Enabled = true; newDepartment.OptionNumber = GetNewOptionNumber(); Forms.DepartmentForm dpForm = new CallButler.Manager.Forms.DepartmentForm(newDepartment, vbData); if (dpForm.ShowDialog(this) == DialogResult.OK) { // Add our department locally vbData.Departments.AddDepartmentsRow(newDepartment); // Add our department remotely ManagementInterfaceClient.ManagementInterface.PersistDepartment(ManagementInterfaceClient.AuthInfo, Utils.TableUtils<WOSI.CallButler.Data.CallButlerDataset.DepartmentsDataTable>.CreateTableFromRow(newDepartment)); PersistDepartmentGreeting(newDepartment, null, dpForm); CallFlowItem cfItem = AddCallFlowDepartmentItem(newDepartment); diagramControl.ScrollControlIntoView(cfItem); NotifyUpdateMenuGreeting(); vbData.AcceptChanges(); } }