/// <summary> /// XML Comment /// </summary> /// <returns></returns> /// <remarks></remarks> public DataTable SelectSQLPaymentTypes() { string sqlStatement = "SELECT tp.PAYMENT_TYPE_ID, tp.PAYMENT_TYPE_CODE, tp.PAYMENT_TYPE_DESCRIPTION, tp.IS_OTHER_TYPE, " + " tpbu.DEFAULT_PAYMENT_TYPE " + " FROM tbl_payment_type tp " + " LEFT OUTER JOIN tbl_payment_type_bu tpbu ON tpbu.PAYMENT_TYPE_CODE = tp.PAYMENT_TYPE_CODE AND tpbu.BUSINESS_UNIT = @BusinessUnit "; DataTable outputDataTable = new DataTable(); TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); try { //Construct The Call talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; ErrorObj err = new ErrorObj(); talentSqlAccessDetail.CommandElements.CommandText = sqlStatement; talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@BusinessUnit", businessUnit)); err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { outputDataTable = talentSqlAccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } return(outputDataTable); }
/// <summary> ///Print Request status for filtered Hospitality Bookings. /// </summary> /// <param name="inputModel">The given hospitality booking enquiry input model</param> /// <returns>A data set of result with print request status</returns> private DataSet printBookings(HospitalityBookingEnquiryInputModel inputModel) { DataSet dsResults = new DataSet(); TalentPackage talPackage = new TalentPackage(); DESettings settings = Environment.Settings.DESettings; ErrorObj err = new ErrorObj(); talPackage.Settings = settings; talPackage.DePackages.HospitalityBookingFilters = new HospitalityBookingFilters(); talPackage.DePackages.HospitalityBookingFilters.Agent = inputModel.BoxOfficeUser; talPackage.DePackages.HospitalityBookingFilters.CallId = inputModel.CallID; talPackage.DePackages.HospitalityBookingFilters.Fromdate = inputModel.FromDate; talPackage.DePackages.HospitalityBookingFilters.ToDate = inputModel.ToDate; talPackage.DePackages.HospitalityBookingFilters.Status = inputModel.Status; talPackage.DePackages.HospitalityBookingFilters.Customer = inputModel.CustomerNumber; talPackage.DePackages.HospitalityBookingFilters.PackageDescription = inputModel.Package; talPackage.DePackages.HospitalityBookingFilters.ProductDescription = inputModel.ProductCode; talPackage.DePackages.HospitalityBookingFilters.MaxRecords = inputModel.MaxRecords; talPackage.DePackages.HospitalityBookingFilters.MarkOrderFor = inputModel.MarkOrderFor; talPackage.DePackages.HospitalityBookingFilters.QandAStatus = inputModel.QandAStatus; talPackage.DePackages.HospitalityBookingFilters.PrintStatus = inputModel.PrintStatus; talPackage.DePackages.BoxOfficeUser = inputModel.LoggedInBoxOfficeUser; talPackage.DePackages.CallId = inputModel.CallIdToBePrinted; err = talPackage.PrintHospitalityBookings(); dsResults = talPackage.ResultDataSet; return(dsResults); }
/// <summary> /// Returns the group ID /// </summary> /// <returns></returns> /// <remarks></remarks> public int GetGroupID() { DataTable outputDataTable = new DataTable(); TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); StringBuilder commandText = new StringBuilder(); ErrorObj err = new ErrorObj(); try { commandText.AppendLine("select value from dbo.tbl_ecommerce_module_defaults_bu a where a.DEFAULT_NAME = \'TALENT_DEFAULTS_GROUP_ID\'"); commandText.AppendLine("update dbo.tbl_ecommerce_module_defaults_bu"); commandText.AppendLine("set VALUE = cast(VALUE as int) + 1 "); commandText.AppendLine("where DEFAULT_NAME = \'TALENT_DEFAULTS_GROUP_ID\'"); //Construct The Call talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentSqlAccessDetail.CommandElements.CommandText = commandText.ToString(); err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { outputDataTable = talentSqlAccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } return(int.Parse(System.Convert.ToString(outputDataTable.Rows[0]["value"]))); }
public override DataTable RetrieveDTForList() { DataTable outputDataTable = new DataTable(); TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); string commandText = string.Format("select a.GROUP_ID as ID, convert(varchar,min(TIMESTAMP),120) TIMESTAMP, min(user_name) USER_NAME, min(MODULE_NAME) MODULE_NAME, count(1) as COMMAND_COUNT, MIN(BUSINESS_UNIT) as BUSINESS_UNIT, MIN(DATA_SOURCE) AS DATA_SOURCE, min(CATALOG) as CATALOG from tbl_config_detail_audit a group by a.GROUP_ID"); ErrorObj err = new ErrorObj(); try { //Construct The Call talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentSqlAccessDetail.CommandElements.CommandText = commandText; err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.TALENT_DEFINITION); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { outputDataTable = talentSqlAccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } return(outputDataTable); }
/// <summary> /// Hospitality bookings with print request status. /// </summary> /// <param name="inputModel">The given hospitality booking enquiry input model</param> /// <returns>Status of Print Request</returns> public HospitalityBookingEnquiryViewModel PrintHospitalityBookings(HospitalityBookingEnquiryInputModel inputModel) { HospitalityBookingEnquiryViewModel viewModel = new HospitalityBookingEnquiryViewModel(true); DataSet dsPrintBookings = new DataSet(); ErrorObj err = new ErrorObj(); DESettings settings = Environment.Settings.DESettings; viewModel = RetrieveHospitalityBookings(inputModel); if (!viewModel.Error.HasError) { dsPrintBookings = printBookings(inputModel); viewModel.Error = Data.PopulateErrorObject(err, dsPrintBookings, settings, GlobalConstants.STATUS_RESULTS_TABLE_NAME, 1); if (!viewModel.Error.HasError) { DataTable dtStatusResult = dsPrintBookings.Tables[GlobalConstants.STATUS_RESULTS_TABLE_NAME]; if (dtStatusResult.Rows.Count > 0 && !string.IsNullOrEmpty(dtStatusResult.Rows[0]["ReturnCode"].ToString())) { viewModel.PrintRequestSuccess = false; } else { viewModel.PrintRequestSuccess = true; } } } return(viewModel); }
/// <summary> /// Retrieve the price break prices for the given product by calling MD141S /// </summary> /// <param name="talProduct">The TalentProduct object</param> /// <param name="err">error object</param> /// <returns>The datatable of price break prices</returns> private DataTable getPriceBreakPrices(ErrorObj err, long priceBreakId) { DataTable resultDataTable = new DataTable(); _talProduct = new TalentProduct(); _talProduct.Settings = Environment.Settings.DESettings; _talProduct.Settings.Cacheing = true; _talProduct.De = _deProdDetails; err = _talProduct.ProductPriceBreaks(); _viewModel.Error = Data.PopulateErrorObject(err, _talProduct.ResultDataSet, _talProduct.Settings, 2); if (!_viewModel.Error.HasError) { if (priceBreakId == 0) { resultDataTable = _talProduct.ResultDataSet.Tables["ProductPriceBreaks"]; } else { DataView priceBreakDefinitions = new DataView(_talProduct.ResultDataSet.Tables["ProductPriceBreaks"]); priceBreakDefinitions.RowFilter = "PriceBreakId = " + priceBreakId; resultDataTable = priceBreakDefinitions.ToTable(); } } else { _talProduct.Settings.Logging.GeneralLog("SeatSelectionError", _viewModel.Error.ReturnCode, "Error getting price break prices from MD141S for Product Code: " + _talProduct.De.ProductCode + " | " + _viewModel.Error.ErrorMessage, "SeatSelectionLog"); } return(resultDataTable); }
public override List <ConfigurationEntity> RetrieveAlliSeriesValues(string companyCode, string[] defaultKeys, string[] variableKeys, string selectedColumns = "") { DataTable outputDataTable = new DataTable(); TalentDB2Access talentDB2AccessDetail = new TalentDB2Access(); ErrorObj err = new ErrorObj(); string columns = (selectedColumns != string.Empty ? selectedColumns : "*"); try { string commandText = string.Format("SELECT {0} FROM CD00A WHERE CONO0A = @CompanyCode", selectedColumns); talentDB2AccessDetail.Settings = settings; talentDB2AccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentDB2AccessDetail.CommandElements.CommandText = commandText; talentDB2AccessDetail.CommandElements.CommandParameter.Clear(); talentDB2AccessDetail.CommandElements.CommandParameter.Add(ConstructDB2Parameter("@CompanyCode", companyCode, 3)); //Execute err = talentDB2AccessDetail.DB2Access(DestinationDatabase.TALENTTKT); if ((!(err.HasError)) && (!(talentDB2AccessDetail.ResultDataSet == null))) { outputDataTable = talentDB2AccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentDB2AccessDetail = null; } return(GetConfigurationData(outputDataTable, defaultKeys, variableKeys)); }
public AddressChangeSyncViewModel SyncAddress(AddressChangeSyncInputModel inputModel) { AddressChangeSyncViewModel viewModel = new AddressChangeSyncViewModel(inputModel); TalentCustomer talentCustomer = new TalentCustomer(); Mapper.CreateMap <AddressChangeSyncInputModel, DECustomer>(); talentCustomer.Settings = Environment.Settings.DESettings; DECustomer deCust = new DECustomer(); deCust = Mapper.Map <DECustomer>(inputModel); DECustomerV11 deCustV11 = new DECustomerV11(); talentCustomer.DeV11.DECustomersV1.Add(deCust); ErrorObj err = talentCustomer.UpdateCustomerAddresses(); viewModel.Error = Data.PopulateErrorObject(err, talentCustomer.ResultDataSet, talentCustomer.Settings, null); //if (!viewModel.Error.HasError) //{ // viewModel.AddressChange = Data.PopulateObjectListFromTable<AddressChangeModel>(talentCustomer.ResultDataSet.Tables["CustomersAtAddress"]); //} return(viewModel); }
/// <summary> /// Get details of Hospitality Product groups and its Fixtures /// </summary> /// <param name="inputModel">The given hospitality product group list input model</param> /// <returns>Hospitality Product groups and its fixtures list</returns> public HospitalityProductGroupViewModel GetHospitalityProductGroups(HospitalityProductGroupInputModel inputModel) { HospitalityProductGroupViewModel viewModel = new HospitalityProductGroupViewModel(getContentAndAttributes: true); DataSet dsProductGroupList = new DataSet(); DataSet dsProductGroupFixturesList = new DataSet(); ErrorObj err = new ErrorObj(); DEProductDetails de = new DEProductDetails(); DESettings settings = Environment.Settings.DESettings; List <ProductGroupDetails> productGroupDetailsList = new List <ProductGroupDetails>(); List <ProductDetails> productGroupFixturesList = new List <ProductDetails>(); dsProductGroupList = retrieveProductGroups(); viewModel.Error = Data.PopulateErrorObject(err, dsProductGroupList, settings, GlobalConstants.STATUS_RESULTS_TABLE_NAME, 2); if (!viewModel.Error.HasError) { productGroupDetailsList = Data.PopulateObjectListFromTable <ProductGroupDetails>(dsProductGroupList.Tables["ProductGroupsDetails"]); foreach (ProductGroupDetails productGroup in productGroupDetailsList) { HospitalityProductGroupInputModel inputModelProductGroup = new HospitalityProductGroupInputModel(); inputModelProductGroup.ProductGroupCode = productGroup.GroupId; dsProductGroupFixturesList = retrieveProductGroupFixtures(inputModelProductGroup.ProductGroupCode); viewModel.Error = Data.PopulateErrorObject(err, dsProductGroupFixturesList, settings, GlobalConstants.STATUS_RESULTS_TABLE_NAME, 2); if (!viewModel.Error.HasError) { productGroup.ProductGroupFixturesList = new List <ProductDetails>(); productGroup.ProductGroupFixturesList = Data.PopulateObjectListFromTable <ProductDetails>(dsProductGroupFixturesList.Tables["ProductGroupFixturesDeatils"]); } } viewModel.ProductGroupDetailsList = productGroupDetailsList; } return(viewModel); }
/// <summary> /// Returns populated error model object after error handling - operates on tables only /// </summary> /// <param name="error">Talent error object - logs .net error</param> /// <param name="table"></param> /// <returns></returns> public ErrorModel PopulateErrorObject(ErrorObj error, DataTable table, DESettings settings) { ErrorModel model = new ErrorModel(); model.HasError = false; if (error.HasError) { model.HasError = true; model.ReturnCode = "TBL-DNError"; } else { if (table != null) { if (table.Rows.Count == 0) { model.HasError = true; model.ReturnCode = "TBL-EmptyTable"; } } } if (model.HasError) { model.ErrorMessage = AddErrorMessageText(model.ReturnCode, settings); } return(model); }
/// <summary> /// This method retrieves template override criterias /// </summary> /// <param name="inputModel">The given template override input model</param> /// <returns>The formed template override view model</returns> public TemplateOverrideViewModel RetriveOverrideCriterias() { TemplateOverrideViewModel viewModel = new TemplateOverrideViewModel(getContentAndAttributes: true); DataSet dsOverrideCriteria = new DataSet(); ErrorObj err = new ErrorObj(); DESettings settings = Environment.Settings.DESettings; List <TicketingOverrideCriteria> ticketingOverrideCriterias = new List <TicketingOverrideCriteria>(); List <PackageOverrideCriteria> packageOverrideCriterias = new List <PackageOverrideCriteria>(); dsOverrideCriteria = retriveOverrideCriterias(); viewModel.Error = Data.PopulateErrorObject(err, dsOverrideCriteria, settings, GlobalConstants.STATUS_RESULTS_TABLE_NAME, 3); if (!viewModel.Error.HasError) { ticketingOverrideCriterias = Data.PopulateObjectListFromTable <TicketingOverrideCriteria>(dsOverrideCriteria.Tables["TicketingOverrideCriteria"]); packageOverrideCriterias = Data.PopulateObjectListFromTable <PackageOverrideCriteria>(dsOverrideCriteria.Tables["PackageOverrideCriteria"]); //Set view model viewModel.TicketingOverrideCriterias = ticketingOverrideCriterias.ToList(); viewModel.PackageOverrideCriterias = packageOverrideCriterias.ToList(); foreach (TicketingOverrideCriteria criteria in ticketingOverrideCriterias) { criteria.ProductTypeDecsription = viewModel.GetPageText("ProductType-" + criteria.ProductType); } } return(viewModel); }
/// <summary> /// Get the descriptive agent name based on the given user code, Eg. "TKT472TF" /// </summary> /// <param name="agentUserCode">The given agent user code</param> /// <returns>The descriptive agent name</returns> public string GetAgentDescriptiveNameByAgentUserCode(string agentUserCode) { string agentDescriptiveName = agentUserCode; TalentAgent talAgent = new TalentAgent(); DEAgent agentDataEntity = new DEAgent(); ErrorModel errModel = new ErrorModel(); ErrorObj err = new ErrorObj(); agentDataEntity.Source = GlobalConstants.SOURCE; talAgent.AgentDataEntity = agentDataEntity; talAgent.Settings = Environment.Settings.DESettings; err = talAgent.RetrieveAllAgents(); errModel = Data.PopulateErrorObject(err, talAgent.ResultDataSet, talAgent.Settings, "ErrorStatus", null); if (!errModel.HasError) { foreach (DataRow row in talAgent.ResultDataSet.Tables["AgentUsers"].Rows) { if (row["USERCODE"].ToString() == agentUserCode.Trim()) { agentDescriptiveName = row["USERNAME"].ToString(); break; } } } return(agentDescriptiveName); }
public override List<ConfigurationEntity> RetrieveAllValues(string businessUnit, string[] defaultKeys, string[] variableKeys, string displayName = "") { DataTable outputDataTable = new DataTable(); TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); string commandText = string.Format("SELECT * FROM tbl_control_text_lang WHERE (business_unit = @BUSINESS_UNIT) AND control_code = @CONTROL_CODE" + (displayName != string.Empty ? " AND TEXT_CODE like \'%\'+ @TEXT_CODE + \'%\'" : "") + " ORDER BY ID"); ErrorObj err = new ErrorObj(); try { //Construct The Call talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentSqlAccessDetail.CommandElements.CommandParameter.Clear(); talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@BUSINESS_UNIT", businessUnit)); talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@CONTROL_CODE", defaultKeys[0])); if (displayName != string.Empty) { talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@TEXT_CODE", displayName)); } talentSqlAccessDetail.CommandElements.CommandText = commandText; err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { outputDataTable = talentSqlAccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } return GetConfigurationData(outputDataTable, defaultKeys, variableKeys); }
/// <summary> /// Returns agent details by session ID /// </summary> /// <param name="SessionID"></param> /// <returns></returns> /// <remarks></remarks> public DataTable RetrieveAgentDetailsFromSessionID(string sessionID) { TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); ErrorObj err = new ErrorObj(); var commandText = string.Format("select SESSIONID, AGENT_NAME, COMPANY from dbo.tbl_agent a where a.SESSIONID = \'{0}\' and not exists(select 1 from dbo.tbl_agent x where x.AGENT_NAME = a.AGENT_NAME and x.TIMESTAMP_UPDATED > a.TIMESTAMP_UPDATED AND x.SESSIONID <> a.SESSIONID) ", sessionID); DataTable agentDetails = new DataTable(); try { talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentSqlAccessDetail.CommandElements.CommandText = commandText; err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { agentDetails = talentSqlAccessDetail.ResultDataSet.Tables[0]; if (agentDetails.Rows.Count > 0) { settings.AgentName = System.Convert.ToString(agentDetails.Rows[0]["AGENT_NAME"]); settings.Company = System.Convert.ToString(agentDetails.Rows[0]["COMPANY"]); } } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } return(agentDetails); }
public override List <ConfigurationEntity> RetrieveAllValues(string businessUnit, string[] defaultKeys, string[] variableKeys, string displayName = "") { DataTable outputDataTable = new DataTable(); TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); string commandText = string.Format("SELECT * FROM tbl_activity_template_type WHERE BUSINESS_UNIT=@BUSINESS_UNIT AND NAME=@NAME"); try { //Construct The Call talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentSqlAccessDetail.CommandElements.CommandParameter.Clear(); talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@BUSINESS_UNIT", businessUnit)); talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@NAME", variableKeys[0])); ErrorObj err = new ErrorObj(); talentSqlAccessDetail.CommandElements.CommandText = commandText; err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { outputDataTable = talentSqlAccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } return(GetConfigurationData(outputDataTable, defaultKeys, variableKeys)); }
private static void Debugger3(ErrorObj o) { if (debugging) { Debug.Log("DEBUGGING AT " + Time.time + ": " + o.ToString() + "\n\t-" + o.type.ToString() + " " + o.error + " " + o.conUUID); } }
/// <summary> /// Returns current configurations /// </summary> /// <param name="businessUnit"></param> /// <param name="configs"></param> /// <returns></returns> /// <remarks></remarks> private Dictionary <string, string> RetrieveCurrentValues(string businessUnit, System.Collections.Generic.List <ConfigurationItem> configs) { DataTable outputDataTable = new DataTable(); TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); System.Collections.Generic.List <string> codes = new System.Collections.Generic.List <string>(); string commandText = "SELECT * FROM tbl_activity_template_type WHERE BUSINESS_UNIT = @BUSINESS_UNIT AND NAME = @NAME"; ErrorObj err = new ErrorObj(); try { //Construct The Call talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@BUSINESS_UNIT", businessUnit)); talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@NAME", Name)); talentSqlAccessDetail.CommandElements.CommandText = commandText; err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { outputDataTable = talentSqlAccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } return(GetCurrentValues(outputDataTable, configs)); }
/// <summary> /// Deletes Configurations /// </summary> /// <param name="paymentCode"></param> /// <param name="givenTransaction"></param> /// <returns></returns> /// <remarks></remarks> private int DeleteData(string paymentCode, SqlTransaction givenTransaction) { int affectedRows = 0; TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); ErrorObj err = new ErrorObj(); string commandText = "DELETE FROM tbl_payment_type WHERE payment_type_code = @PAYMENT_TYPE_CODE"; talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteNonQuery; talentSqlAccessDetail.CommandElements.CommandText = commandText; talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@PAYMENT_TYPE_CODE", paymentCode)); if (givenTransaction == null) { err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005); } else { err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005, givenTransaction); } if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { affectedRows = System.Convert.ToInt32(talentSqlAccessDetail.ResultDataSet.Tables[0].Rows[0][0]); } talentSqlAccessDetail = null; return(affectedRows); }
/// <summary> /// Return the activities list view model based on the input model. /// Construct and call the Talent.Common layer. /// </summary> /// <param name="inputModel">Activities List input model</param> /// <returns>The activities list view model formatted correctly</returns> public ActivitiesListViewModel GetActivitiesListSearchResults(ActivitiesListInputModel inputModel) { ActivitiesListViewModel viewModel = new ActivitiesListViewModel(); TalentActivities talActivites = new TalentActivities(); Mapper.CreateMap <ActivitiesListInputModel, DEActivities>(); ErrorObj err = new ErrorObj(); List <ActivitiesList> results = new List <ActivitiesList>(); Agent agentDefinition = new Agent(); viewModel.Draw = inputModel.Draw; talActivites.De = Mapper.Map <DEActivities>(inputModel); talActivites.De.ActivityOrderDirection = inputModel.Order[0].Dir.ToString(); talActivites.Settings = Environment.Settings.DESettings; err = talActivites.CustomerActivitiesSearch(); viewModel.Error = Data.PopulateErrorObject(err, talActivites.ResultDataSet, talActivites.Settings, 2); if (!viewModel.Error.HasError) { foreach (DataRow row in talActivites.ResultDataSet.Tables["CustomerActivitiesHeader"].Rows) { row["DescriptiveUserName"] = agentDefinition.GetAgentDescriptiveNameByAgentUserCode(row["ActivityUserName"].ToString()); } results = Data.PopulateObjectListFromTable <ActivitiesList>(talActivites.ResultDataSet.Tables["CustomerActivitiesHeader"]); viewModel.DataTableList = results; viewModel.RecordsFiltered = (int)talActivites.ResultDataSet.Tables["StatusResults"].Rows[0]["RecordsReturned"]; } return(viewModel); }
public override DataTable RetrieveDTForList(System.Collections.Generic.List <DataColumn> dataColumns, System.Collections.Generic.List <KeyColumn> variableKeyColumns) { DataTable outputDataTable = new DataTable(); TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); var columns = (from c in dataColumns select c.Name).Union(from c in variableKeyColumns select c.Name); string commandText = string.Format("SELECT {0} FROM tbl_payment_type", string.Join(", ", columns.ToArray())); try { //Construct The Call talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; ErrorObj err = new ErrorObj(); talentSqlAccessDetail.CommandElements.CommandText = commandText; err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { outputDataTable = talentSqlAccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } return(outputDataTable); }
/// <summary> /// XML Comment /// </summary> /// <param name="businessUnit"></param> /// <param name="configs"></param> /// <returns></returns> /// <remarks></remarks> private Dictionary <string, string> RetrieveCurrentValuesData(System.Collections.Generic.List <ConfigurationItem> configs) { DataTable outputDataTable = new DataTable(); TalentDB2Access talentDB2AccessDetail = new TalentDB2Access(); ErrorObj err = new ErrorObj(); try { string commandText = "SELECT * FROM CD00A WHERE CONO0A = @CompanyCode"; //Construct The Call talentDB2AccessDetail.Settings = settings; talentDB2AccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentDB2AccessDetail.CommandElements.CommandText = commandText; talentDB2AccessDetail.CommandElements.CommandParameter.Clear(); talentDB2AccessDetail.CommandElements.CommandParameter.Add(ConstructDB2Parameter("@CompanyCode", companyCode, 3)); err = talentDB2AccessDetail.DB2Access(DestinationDatabase.TALENTTKT); if ((!(err.HasError)) && (!(talentDB2AccessDetail.ResultDataSet == null))) { outputDataTable = talentDB2AccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { } finally { talentDB2AccessDetail = null; } return(GetCurrentValues(outputDataTable, configs)); }
/// <summary> /// Checks to see if the price code of a basketItem is a free of charge price code /// </summary> /// <param name="basketItem"></param> /// <returns>a boolean</returns> private bool isPriceCodeFoC(DEBasketItem basketItem) { bool priceCodeFoc = false; ErrorObj err = new ErrorObj(); TalentProduct talProduct = new TalentProduct(); talProduct.Settings = Environment.Settings.DESettings; talProduct.De.ProductCode = basketItem.Product; talProduct.De.PriceCode = basketItem.PRICE_CODE; talProduct.De.AllowPriceException = false; err = talProduct.ProductDetails(); if (!err.HasError) { if (talProduct.ResultDataSet != null && talProduct.ResultDataSet.Tables["PriceCodes"].Rows.Count > 0) { foreach (DataRow row in talProduct.ResultDataSet.Tables["PriceCodes"].Rows) { if (row["PriceCode"].ToString() == basketItem.PRICE_CODE) { priceCodeFoc = Talent.Common.Utilities.CheckForDBNull_Boolean_DefaultFalse(row["FreeOfCharge"]); break; } } } } return(priceCodeFoc); }
public CompanySearchViewModel CompanySearch(CompanySearchInputModel inputModel) { CompanySearchViewModel viewModel = new CompanySearchViewModel(); // Draw parameter needs to be returned to the datatable so we can determin if we need // to store the record count. viewModel.Draw = inputModel.Draw; TalentSearch talentSearch = new TalentSearch(); Mapper.CreateMap <CompanySearchInputModel, DECompanySearch>(); talentSearch.CompanySearch = Mapper.Map <DECompanySearch>(inputModel); Mapper.CreateMap <CompanySearchInputModel, DECompany>(); talentSearch.CompanySearch.Company = Mapper.Map <DECompany>(inputModel); talentSearch.Settings = Environment.Settings.DESettings; ErrorObj err = talentSearch.PerformCompanySearch(); CompanySearchLists SearchResults = new CompanySearchLists(); SearchResults.Errors = Data.PopulateErrorObject(err, talentSearch.ResultDataSet, talentSearch.Settings, null); if (!SearchResults.Errors.HasError) { SearchResults.Companies = Data.PopulateObjectListFromTable <CompanySearch.Company>(talentSearch.ResultDataSet.Tables["SearchResults"]); // Populate the datatablelist in the base view model with our lists viewModel.DataTableList = new List <CompanySearchLists>(); viewModel.DataTableList.Add(SearchResults); viewModel.RecordsFiltered = (int)talentSearch.ResultDataSet.Tables["StatusResults"].Rows[0]["RecordsReturned"]; viewModel.RecordsTotal = SearchResults.Companies.Count; } return(viewModel); }
public TicketExchangeSelectionViewModel TicketingExchangeSelectionGetSeats(TicketExchangeSelectionInputModel inputModel) { TicketExchangeSelectionViewModel viewModel = new TicketExchangeSelectionViewModel(true); TalentTicketExchange ticketExchange = new TalentTicketExchange(); ticketExchange.Dep.Customer = inputModel.CustomerNumber; ticketExchange.Dep.ProductCode = inputModel.ProductCode; ticketExchange.Settings = Environment.Settings.DESettings; ticketExchange.Settings.Cacheing = false; ErrorObj err = ticketExchange.GetTicketExchangeSeatSelectionForProduct(); viewModel.Error = Data.PopulateErrorObject(err, ticketExchange.ResultDataSet, ticketExchange.Settings, null); if (!viewModel.Error.HasError) { if (ticketExchange.ResultDataSet.Tables["TicketExchangeCustomerSeats"].Rows.Count > 0 && ticketExchange.ResultDataSet.Tables["TicketExchangeProductInfomation"].Rows.Count > 0) { // Product setting Values from TicketExchangeProductInfomation viewModel = Data.PopulateObjectFromRow <TicketExchangeSelectionViewModel>(ticketExchange.ResultDataSet.Tables["TicketExchangeProductInfomation"].Rows[0], viewModel); // List of seats from TicketExchangeCustomerSeats viewModel.TicketExchangeSeatList = Data.PopulateObjectListFromTable <TicketExchangeItem>(ticketExchange.ResultDataSet.Tables["TicketExchangeCustomerSeats"]); // Initialise original status from call. viewModel.setOriginalWorkProperties(); } } return(viewModel); }
/// <summary> /// Generate the word document for the given call id /// </summary> /// <param name="inputModel">The given hospitality booking enquiry input model</param> /// <returns>Status of document creation request</returns> public HospitalityBookingEnquiryViewModel GenerateDocumentForBooking(HospitalityBookingEnquiryInputModel inputModel) { HospitalityBookingEnquiryViewModel viewModel = new HospitalityBookingEnquiryViewModel(true); DataSet dsDocumentBooking = new DataSet(); ErrorObj err = new ErrorObj(); DESettings settings = Environment.Settings.DESettings; viewModel = RetrieveHospitalityBookings(inputModel); if (!viewModel.Error.HasError) { dsDocumentBooking = createDocumentForBooking(inputModel); viewModel.Error = Data.PopulateErrorObject(err, dsDocumentBooking, settings, GlobalConstants.STATUS_RESULTS_TABLE_NAME, 2); if (!viewModel.Error.HasError) { DataTable dtStatusResult = dsDocumentBooking.Tables[GlobalConstants.STATUS_RESULTS_TABLE_NAME]; DataTable dtDocumentInformation = dsDocumentBooking.Tables["DocumentInformation"]; if (dtStatusResult.Rows.Count > 0 && !string.IsNullOrEmpty(dtStatusResult.Rows[0]["ReturnCode"].ToString())) { viewModel.GenerateDocumentRequestSuccess = false; } else { viewModel.GenerateDocumentRequestSuccess = true; viewModel.CallIdForDocumentProduction = inputModel.CallIdForDocumentProduction; viewModel.MergedWordDocument = dtDocumentInformation.Rows[0].ItemArray[1].ToString(); } } } return(viewModel); }
/// <summary> /// XML Comment /// </summary> /// <param name="companyCode"></param> /// <param name="type51"></param> /// <returns></returns> /// <remarks></remarks> public DataTable SelectByCompAndType(string companyCode, string type51) { //how to get company code, type code and active flag string sqlStatement = string.Empty; sqlStatement = " SELECT CODE51, DESC51, VALU51 FROM MD501 WHERE CONO51 = @CompanyCode AND TYPE51 = @Type AND ACTR51 = 'A' "; DataTable outputDataTable = new DataTable(); TalentDB2Access talentDB2AccessDetail = new TalentDB2Access(); try { talentDB2AccessDetail.Settings = settings; talentDB2AccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentDB2AccessDetail.CommandElements.CommandParameter.Clear(); talentDB2AccessDetail.CommandElements.CommandParameter.Add(ConstructDB2Parameter("@CompanyCode", companyCode, 3)); talentDB2AccessDetail.CommandElements.CommandParameter.Add(ConstructDB2Parameter("@Type", type51, 4)); ErrorObj err = new ErrorObj(); talentDB2AccessDetail.CommandElements.CommandText = sqlStatement; err = talentDB2AccessDetail.DB2Access(DestinationDatabase.TALENTTKT); if ((!(err.HasError)) && (!(talentDB2AccessDetail.ResultDataSet == null))) { outputDataTable = talentDB2AccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentDB2AccessDetail = null; } return(outputDataTable); }
public override List <ConfigurationEntity> RetrieveAllValues(string businessUnit, string[] defaultKeys, string[] variableKeys, string displayName = "") { DataTable outputDataTable = new DataTable(); TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); string commandText = "SELECT distinct default_name,value FROM dbo.tbl_ecommerce_module_defaults_bu WHERE business_unit = @BUSINESS_UNIT" + (displayName != string.Empty ? " AND DEFAULT_NAME like \'%\' + @DEFAULT_NAME + \'%\'" : ""); ErrorObj err = new ErrorObj(); try { //Construct The Call talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentSqlAccessDetail.CommandElements.CommandParameter.Clear(); talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@BUSINESS_UNIT", businessUnit)); if (displayName != string.Empty) { talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@DEFAULT_NAME", displayName)); } talentSqlAccessDetail.CommandElements.CommandText = commandText; err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { outputDataTable = talentSqlAccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } return(GetConfigurationData(outputDataTable, defaultKeys, variableKeys)); }
/// <summary> /// Deletes payment type information from MD501 /// </summary> /// <param name="type51"></param> /// <param name="code51"></param> /// <param name="givenTransaction"></param> /// <returns></returns> public int DeleteData(string type51, string code51, iDB2Transaction givenTransaction = null) { int affectedRows = 0; TalentDB2Access talentDB2AccessDetail = new TalentDB2Access(); ErrorObj err = new ErrorObj(); try { string commandText = "UPDATE MD501 SET ACTR51 = 'D',USER51=@USER51,PGMD51=@PGMD51,UPDT51=@UPDT51 WHERE CONO51 = @CompanyCode AND TYPE51 = @Type51 AND CODE51 = @Code51"; talentDB2AccessDetail.Settings = settings; talentDB2AccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteNonQuery; talentDB2AccessDetail.CommandElements.CommandText = commandText; talentDB2AccessDetail.CommandElements.CommandParameter.Add(ConstructDB2Parameter("@CompanyCode", companyCode, 3)); talentDB2AccessDetail.CommandElements.CommandParameter.Add(ConstructDB2Parameter("@Type51", type51, 4)); talentDB2AccessDetail.CommandElements.CommandParameter.Add(ConstructDB2Parameter("@Code51", code51, 15)); talentDB2AccessDetail.CommandElements.CommandParameter.Add(ConstructDB2Parameter("@USER51", settings.AgentName, 10)); talentDB2AccessDetail.CommandElements.CommandParameter.Add(ConstructDB2Parameter("@PGMD51", settings.StoredProcedure, 10)); talentDB2AccessDetail.CommandElements.CommandParameter.Add(ConstructDB2Parameter("@UPDT51", settings.iSeriesTodaysDate, iDB2DbType.iDB2Decimal)); //Execute affectedRows = DB2Access(talentDB2AccessDetail, givenTransaction); } catch (Exception) { throw; } finally { talentDB2AccessDetail = null; } return(affectedRows); }
/// <summary> /// Returns web API url from database /// </summary> /// <returns></returns> /// <remarks></remarks> public string GetSystemDefaultsURL() { TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); string commandText = "SELECT VALUE FROM DBO.TBL_ECOMMERCE_MODULE_DEFAULTS_BU WHERE BUSINESS_UNIT = @BUSINESS_UNIT AND DEFAULT_NAME = \'SYSTEM_DEFAULTS_URL\'"; ErrorObj err = new ErrorObj(); string retVal = string.Empty; try { //Construct The Call talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@BUSINESS_UNIT", businessUnit)); talentSqlAccessDetail.CommandElements.CommandText = commandText; err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.SQL2005); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { System.Data.DataTable with_3 = talentSqlAccessDetail.ResultDataSet.Tables[0]; if (with_3.Rows.Count > 0) { retVal = with_3.Rows[0]["VALUE"].ToString(); } } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } return(retVal); }
public ConfigurationEntity GetConfigurationEntity(string configId) { string commandText = "SELECT * FROM tbl_config_detail WHERE config_id=@CONFIG_ID"; DataTable outputDataTable = new DataTable(); TalentDataAccess talentSqlAccessDetail = new TalentDataAccess(); try { //Construct The Call talentSqlAccessDetail.Settings = settings; talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet; talentSqlAccessDetail.CommandElements.CommandParameter.Add(Utilities.ConstructParameter("@CONFIG_ID", configId)); ErrorObj err = new ErrorObj(); talentSqlAccessDetail.CommandElements.CommandText = commandText; err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.TALENT_CONFIG); if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null))) { outputDataTable = talentSqlAccessDetail.ResultDataSet.Tables[0]; } } catch (Exception) { throw; } finally { talentSqlAccessDetail = null; } if (outputDataTable.Rows.Count > 0) { return(ConfigurationEntity.GetEntity(outputDataTable.Rows[0])); } return(null); }