public static ReportDataSet GetReportDataset(int pViewid, int pCustomerId, eViewType pViewType, int pAccountId = 0, string pDatabaseConnection = "") { /** * reason for this is that web portal calls does not recognize user session instance. * so we needed to override the connection string to accept both web portal and application level. */ if (string.IsNullOrEmpty(pDatabaseConnection)) pDatabaseConnection = UserSession.ProviderConnection; else { pDatabaseConnection = pDatabaseConnection.Replace(""", "'"); pDatabaseConnection = pDatabaseConnection.Replace("metadata=res://*/BrightPlatform.csdl|res://*/BrightPlatform.ssdl|res://*/BrightPlatform.msl;provider=System.Data.SqlClient;provider connection string=", ""); pDatabaseConnection = pDatabaseConnection.Replace("\"", ""); } ReportDataSet adt = new ReportDataSet(); accountTableAdapter ata = new accountTableAdapter(); contactTableAdapter cta = new contactTableAdapter(); customersTableAdapter _taCustomer = new customersTableAdapter(); ata.Connection = new System.Data.SqlClient.SqlConnection(pDatabaseConnection); cta.Connection = new System.Data.SqlClient.SqlConnection(pDatabaseConnection); _taCustomer.Connection = new System.Data.SqlClient.SqlConnection(pDatabaseConnection); if (pViewType == eViewType.AccountsContactsWithDialogData) { ata.Fill(adt.account, pViewid, pAccountId); cta.Fill(adt.contact, pViewid, pAccountId); } else if (pViewType == eViewType.AccountsContactsWithCallAttempts) { ata.FillByGetReportAccountDataWithCallAttempts(adt.account, pViewid, pAccountId); cta.FillByGetReportContactDataWithCallAttempts(adt.contact, pViewid, pAccountId); } _taCustomer.Fill(adt.customers, pCustomerId); return adt; }
private void SavePriceChanges() { CustomerAdapter = new customersTableAdapter(); customersDataTable customerDT = CustomerAdapter.GetCustomerDataByID(CustomerID); customersRow cRow = (customersRow)customerDT.Rows[0]; if (!string.IsNullOrWhiteSpace(txtNewPrice.Text)) { float.TryParse(txtNewPrice.Text, out _price); cRow.stdHourlyPrice = _price; } if (!string.IsNullOrWhiteSpace(txtNewPrice.Text)) { float.TryParse(txtNewOvertime1.Text, out _overtime1); cRow.stdOvertime1 = _overtime1; } if (!string.IsNullOrWhiteSpace(txtNewPrice.Text)) { float.TryParse(txtNewOvertime2.Text, out _overtime2); cRow.stdOvertime2 = _overtime2; } CustomerAdapter.Update(customerDT); CustomerAdapter.Dispose(); ActivitiesAdapter = new activitiesTableAdapter(); activitiesDataTable ActivitiesTable; activitiesRow row; foreach (TreeNode Parent in treeViewHourlyRate.Nodes) { if (Parent.Checked == true) { ActivitiesTable = ActivitiesAdapter.GetActivityPriceDataByID((int)Parent.Tag); row = (activitiesRow)ActivitiesTable.Rows[0]; if (!string.IsNullOrWhiteSpace(txtNewPrice.Text)) { float.TryParse(txtNewPrice.Text, out _price); row.price = _price; } if (!string.IsNullOrWhiteSpace(txtNewOvertime1.Text)) { float.TryParse(txtNewOvertime1.Text, out _overtime1); row.overtime1 = _overtime1; } if (!string.IsNullOrWhiteSpace(txtNewOvertime2.Text)) { float.TryParse(txtNewOvertime2.Text, out _overtime2); row.overtime2 = _overtime2; } ActivitiesAdapter.Update(ActivitiesTable); ActivitiesAdapter.Dispose(); } foreach (TreeNode child in Parent.Nodes) { if (child.Checked == true) { ActivitiesTable = ActivitiesAdapter.GetActivityPriceDataByID((int)child.Tag); row = (activitiesRow)ActivitiesTable.Rows[0]; if (!string.IsNullOrWhiteSpace(txtNewPrice.Text)) { float.TryParse(txtNewPrice.Text, out _price); row.price = _price; } if (!string.IsNullOrWhiteSpace(txtNewOvertime1.Text)) { float.TryParse(txtNewOvertime1.Text, out _overtime1); row.overtime1 = _overtime1; } if (!string.IsNullOrWhiteSpace(txtNewOvertime2.Text)) { float.TryParse(txtNewOvertime2.Text, out _overtime2); row.overtime2 = _overtime2; } ActivitiesAdapter.Update(ActivitiesTable); ActivitiesAdapter.Dispose(); } } } }