public ClientProfilePage(BusinessClient client, BusinessClientsListViewModel parentViewModel) { InitializeComponent(); VM = new BusinessClientViewModel(client, parentViewModel); this.BindingContext = VM; this.Title = VM.UserName; }
static void Main(string[] args) { try { MergeLog.Loginformation("Main - Start"); //Create Mutex object & its related varibale to avoid running multiple instances const string appName = "SingleCSVInstanceApp"; bool createdNew; mutex = new Mutex(true, appName, out createdNew); MergeLog.Loginformation("Mutex thread created."); if (!createdNew) { //Prompt the message to enduser and close the current instance MessageBox.Show("Application is already running."); MergeLog.Loginformation("Mutex thread identified already win form instance is running."); return; } //Identify the Windows form exe is launched with/without parameters if (args.Length > 0) { //Declare client object and which will create all required object at runtime BusinessClient businessClient = new BusinessClient(); //Read the saved selection of CSV files and destination paths MergeCSVData data = PackageConfig.ReadMergeCSVData(); //Validating saved tool configuration values if (string.IsNullOrEmpty(data.CSVFilePath1.Trim()) || string.IsNullOrEmpty(data.CSVFilePath2.Trim()) || string.IsNullOrEmpty(data.HeaderExists.Trim()) || string.IsNullOrEmpty(data.JsonFilePath.Trim())) { //Prompt the validation message to enduser and close the current instance MessageBox.Show("Invalid Configuration values. Please use UI execution.", "MergeCSVTool"); MergeLog.Loginformation("Invalid Configuration values."); return; } // Call the merge method businessClient.MergeCsvToJson(data); MessageBox.Show("Given CSV files are merged successfully.", "MergeCSVTool"); } else { //Open Merge win form Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MergeCSVToJson()); } MergeLog.Loginformation("Main - End"); } catch (Exception ex) { MergeLog.LogError(ex); MessageBox.Show(ex.Message, "MergeCSVTool"); } }
private void btnUpdateClient_Click(object sender, EventArgs e) { panel3.Enabled = true; panel3.Visible = true; BusinessClient client = new BusinessClient(); source.DataSource = client.GetCustomTable(); dgvBusinessClients.DataSource = source; }
public void UpdateBusinessClient(BusinessClient client) { try { BusinessClientDAL clientData = new BusinessClientDAL(); clientData.UpdateBusinessClient(client); } catch (Exception e) { MessageBox.Show($"Error: {e.Message}"); } }
protected void btnDelete_Click(object sender, EventArgs e) { BusinessClient bc = new BusinessClient(); bc.Id = Convert.ToInt32(Session["id"]); BusinessClientMgr bcMgr = new BusinessClientMgr(); bcMgr.DeleteBusinessClient(bc); Server.Transfer("BCProfileDeleted.aspx"); }
//ServiceFactory factory = ServiceFactory.GetInstance(); public void StoreNewBusinessClient(BusinessClient bc) { try { IBusinessClient bcSvc = (IBusinessClient)GetService(typeof(IBusinessClient).Name); bcSvc.StoreBusinessClient(bc); } catch (InterfaceNotFoundException) { throw new Exception("Submission failed. Try again."); } }
public frmEditBusinessClient(BusinessClient businessClient) { InitializeComponent(); //MessageBox.Show(businessClient.ToString()); this.businessClient = businessClient; tbNameBusiness.Text = businessClient.Name; tbContactBusiness.Text = businessClient.ContactNum; tbClientID.Text = businessClient.ClientIdentifier; }
public void DeleteBusinessClient(BusinessClient bc) { try { IBusinessClient bcSvc = (IBusinessClient)GetService(typeof(IBusinessClient).Name); bcSvc.DeleteBusinessClient(bc); } catch (InterfaceNotFoundException) { throw new Exception("Delete failed. Try again"); } }
public Client ReadChild(Request parent) { DataHandler dh = new DataHandler(); string qry = string.Format ( "SELECT R.ClientID, BC.name, IC.name, IC.surname, C.contactNum, C.ClientIdentifier " + "FROM Request R " + "LEFT OUTER JOIN Client C ON C.ClientID = R.ClientID " + "LEFT OUTER JOIN IndividualClient IC ON IC.IndividualClientID = C.ClientID " + "LEFT OUTER JOIN BusinessClient BC ON BC.BusinessClientID = C.ClientID " + "WHERE RequestID = {0}", parent.Id ); SqlDataReader read = dh.Select(qry); Client newClient = null; if (read.HasRows) { while (read.Read()) { if (read.IsDBNull(1)) { Console.WriteLine(read.GetInt32(0)); Console.WriteLine(read.GetString(2)); Console.WriteLine(read.GetString(3)); newClient = new IndividualClient( read.GetString(4), read.GetString(2), read.GetString(3), read.IsDBNull(5) ? null : read.GetString(5) ); } else { newClient = new BusinessClient( read.GetString(4), read.GetString(1), read.IsDBNull(5) ? null : read.GetString(5) ); } newClient.Id = read.GetInt32(0); } } dh.Dispose(); return(newClient); }
private static void addBusinessList() { var loop = 1000; var tw = new Stopwatch(); Console.WriteLine($"============{DateTime.Now}============"); tw.Start(); using (HttpClient http = new HttpClient()) { var dto = new List <BusinessDto>(); for (var i = 0; i < loop; i++) { var item = new BusinessDto(); item.Name = "金康4"; item.Address = "中国武汉"; item.Tel = "888888"; item.Email = "*****@*****.**"; dto.Add(item); } var json = JsonConvert.SerializeObject(dto); var content = new StringContent(json, Encoding.UTF8, "application/json"); var res = http.PostAsync($"{RestApiHost}/api/business/addlist", content).Result.Content.ReadAsStringAsync().Result; Console.WriteLine($"call restapi:{res}"); } tw.Stop(); Console.WriteLine(DateTime.Now + "==>use time:" + tw.ElapsedMilliseconds + "ms"); Console.WriteLine($"============{DateTime.Now}============"); tw.Restart(); var channel = new Channel(GrpcApiHost, ChannelCredentials.Insecure); var client = new BusinessClient(channel); var data = new BusinessListCreationData(); for (var i = 0; i < loop; i++) { var item = new BusinessCreationData(); item.Name = "金康4g"; item.Address = "中国武汉"; item.Tel = "888888"; item.Email = "*****@*****.**"; data.BusinessesCreationData.Add(item); } var result = client.AddList(data); Console.WriteLine($"call grpcapi:{result.Message}"); tw.Stop(); Console.WriteLine(DateTime.Now + "==>use time::" + tw.ElapsedMilliseconds + "ms"); }
void LoadServiceContractRequests() { lvServiceContractRequests.Items.Clear(); NewContractRequestController newContractRequestController = new NewContractRequestController(); foreach (NewContractRequest newContractRequest in newContractRequestController.Read()) { if (newContractRequest.Status != "Open") { continue; } Client client = newContractRequest.Client; if (client is IndividualClient) { IndividualClient iClient = client as IndividualClient; ListViewItem listViewItem = new ListViewItem(new string[] { String.Format("{0} {1}", iClient.Name, iClient.Surname), "Individual Client", newContractRequest.ServiceContract.Description, newContractRequest.DateCreated.ToShortDateString(), newContractRequest.Status }); listViewItem.Tag = newContractRequest; lvServiceContractRequests.Items.Add(listViewItem); } else { BusinessClient bClient = client as BusinessClient; ListViewItem listViewItem = new ListViewItem(new string[] { bClient.Name, "Business Client", newContractRequest.ServiceContract.Description, newContractRequest.DateCreated.ToShortDateString(), newContractRequest.Status }); listViewItem.Tag = newContractRequest; lvServiceContractRequests.Items.Add(listViewItem); } } }
public BusinessClient RetrieveBusinessClient(BusinessClient bc) { try { IBusinessClient bcSvc = (IBusinessClient)GetService(typeof(IBusinessClient).Name); BusinessClient getBc = bcSvc.GetBusinessClient(bc); bc = getBc; } catch (ImplementationNotFoundException) { throw new Exception("Submission failed. Try again."); } return(bc); }
public IActionResult Index() { var user = HttpContext.Session.GetString("user"); if (user == null) { return(Redirect("/auth/login")); } else { BusinessClient cs = new BusinessClient(); ViewData["clients"] = cs.getClientsFromDb(); return(View()); } }
private void btnViewContractB_Click(object sender, EventArgs e) { if (lstClientsB.SelectedItems.Count > 0) { BusinessClient client = lstClientsB.SelectedItems[0].Tag as BusinessClient; //MessageBox.Show(this.ToString() + client.ToString()); frmViewBusinessContract viewBusinessContrFrm = new frmViewBusinessContract(client); viewBusinessContrFrm.ShowDialog(); } else { MessageBox.Show("Please select a field to view", "SELECT A FIELD", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnRetrieve_Click(object sender, EventArgs e) { BusinessClient bc = new BusinessClient(); BusinessClientMgr bcMgr = new BusinessClientMgr(); bc = bcMgr.RetrieveBusinessClient(bc); txtCompanyName.Text = bc.CompanyName; txtPointOfContact.Text = bc.PointOfContact; txtAddressOne.Text = bc.Address1; txtAddressTwo.Text = bc.Address2; txtCity.Text = bc.City; cbxState.Text = bc.State; txtZip.Text = bc.Zip; txtPhone.Text = bc.Phone; txtEmail.Text = bc.Email; }
public void StoreBusinessClientTest() { BusinessClient bc = new BusinessClient(); bc.CompanyName = "Google"; bc.PointOfContact = "John Doe"; bc.Address1 = "2342 Google Dr."; bc.Address2 = "Suite 2013"; bc.City = "Mountain View"; bc.State = "CA"; bc.Zip = "93445"; bc.Phone = "312-222-3244"; bc.Email = "*****@*****.**"; IBusinessClient iBC = new BusinessClientImpl(); iBC.StoreBusinessClient(bc); }
public void ValidateBusinessClientTest() { BusinessClient client = new BusinessClient(); client.CompanyName = "Google"; client.PointOfContact = "Marissa Mayer"; client.Address1 = "100 Google Way"; client.Address2 = " "; client.City = "Mountain View"; client.State = "CA"; client.Zip = "95130"; client.Phone = "510-234-5642"; client.Email = "*****@*****.**"; bool validate = client.ValidateBusinessClient(); Assert.IsTrue(validate, "BusinessClient Validation Test Failed"); }
protected void Page_Load(object sender, EventArgs e) { BusinessClient bc = new BusinessClient(); BusinessClientMgr bcMgr = new BusinessClientMgr(); bc = bcMgr.QueryBusinessClient(bc); Session.Add("id", bc.Id); lblCompanyName.Text = String.Format("{0}", bc.CompanyName); lblPOC.Text = String.Format("{0}", bc.PointOfContact); lblADdressOne.Text = String.Format("{0}", bc.Address1); lblAddressTwo.Text = String.Format("{0}", bc.Address2); lblCity.Text = String.Format("{0}", bc.City); lblState.Text = String.Format("{0}", bc.State); lblZip.Text = String.Format("{0}", bc.Zip); lblPhone.Text = String.Format("{0}", bc.Phone); lblEmail.Text = String.Format("{0}", bc.Email); }
private void btnAddBC_Click(object sender, EventArgs e) { try { BusinessClientBLL clientData = new BusinessClientBLL(); BusinessClient client = new BusinessClient(); client.clientID = txtID.Text; client.CompanyName = txtName.Text; client.Phone = txtPhone.Text; client.Email = txtEmail.Text; client.AddressID = txtAddress.Text; client.ContractID = txtContract.Text; clientData.InsertBusinessClient(client); } catch (Exception exp) { MessageBox.Show($"Error AddClient Form {exp.Message}"); } }
public RedirectResult Update(int id, string salutation, string firstname, string lastname, string gender, string dateofBirth, string address1, string address2, int phone1, int phone2, string email) { BusinessClient cs = new BusinessClient(); Clients newClient = new Clients(); newClient.id = id; newClient.salutation = salutation; newClient.firstname = firstname; newClient.lastname = lastname; newClient.gender = gender; newClient.dateofbirth = dateofBirth; newClient.address1 = address1; newClient.address2 = address2; newClient.phone1 = phone1; newClient.phone2 = phone2; newClient.email = email; cs.updateClientToDB(newClient); return(Redirect("/Client")); }
private void btnEditB_Click(object sender, EventArgs e) { //Business = true; //Hide(); //frmEditBusinessClient form = new fr(); //form.ShowDialog(); if (lstClientsB.SelectedItems.Count > 0) { BusinessClient client = lstClientsB.SelectedItems[0].Tag as BusinessClient; frmEditBusinessClient editFrmB = new frmEditBusinessClient(client); editFrmB.ShowDialog(); LoadBusinessClient(); } else { MessageBox.Show("Please select a field to edit", "SELECT A FIELD", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void btnCreate_Click(object sender, EventArgs e) { BusinessClient bc = new BusinessClient(); bc.CompanyName = txtCompany.Text; bc.PointOfContact = txtPOC.Text; bc.Address1 = txtAddressOne.Text; bc.Address2 = txtAddressTwo.Text; bc.City = txtCity.Text; bc.State = ddlStateList.SelectedValue; bc.Zip = txtZip.Text; bc.Email = txtEmail.Text; bc.Phone = txtPhone.Text; BusinessClientMgr bcMgr = new BusinessClientMgr(); bcMgr.StoreNewBusinessClient(bc); Server.Transfer("BusinessClientProfile.aspx"); }
public void RemoveBusinessClientTest() { BusinessClient client = new BusinessClient(); client.CompanyName = "Google"; client.PointOfContact = "Marissa Mayer"; client.Address1 = "100 Google Way"; client.Address2 = " "; client.City = "Mountain View"; client.State = "CA"; client.Zip = "95130"; client.Phone = "510-234-5642"; client.Email = "*****@*****.**"; Assign obj = new Assign(); obj.RemoveBusinessClient(client); BusinessClient actualClient = client; Assert.AreEqual(client, actualClient); }
private void btnDeleteClient_Click(object sender, EventArgs e) { int ID = (int)dgvBusinessClients.Rows[dgvBusinessClients.CurrentRow.Index].Cells["ClientID"].Value; DialogResult result = MessageBox.Show("Are you sure you want to delete Client " + ID, "Delete Client", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { BusinessClient client = new BusinessClient(); client.DeleteBusinessClient(ID); MessageBox.Show("Client " + ID + " was deleted"); } else { MessageBox.Show("Client was not deleted"); } BusinessClient client1 = new BusinessClient(); source.DataSource = client1.GetCustomTable(); dgvBusinessClients.DataSource = source; }
public static async Task Main(string[] args) { //Création des Clients BusinessClient client1 = new BusinessClient("Baudar", "Martin", 35); BusinessClient client2 = new BusinessClient("Jushet", "Lara", 23); BusinessClient client3 = new BusinessClient("Mopre", "José", 32); BusinessClient client4 = new BusinessClient("Laudet", "Marie", 44); BusinessClient client5 = new BusinessClient("Tedal", "Théo", 56); //Fin de Création des Clients //Création des factures BusinessFacture facture1 = new BusinessFacture(client5, 7281, new DateTime(2020, 12, 01), new DateTime(2020, 12, 30), 325, 120); BusinessFacture facture2 = new BusinessFacture(client4, 9712, new DateTime(2020, 12, 03), new DateTime(2020, 01, 03), 130, 130); BusinessFacture facture3 = new BusinessFacture(client3, 8891, new DateTime(2020, 12, 04), new DateTime(2020, 01, 14), 585, 250); BusinessFacture facture4 = new BusinessFacture(client2, 9202, new DateTime(2020, 12, 06), new DateTime(2020, 01, 28), 1020, 350); BusinessFacture facture5 = new BusinessFacture(client1, 9120, new DateTime(2020, 12, 07), new DateTime(2020, 12, 22), 80, 80); //Fin de création des factures //Création de l'objet BusinessData BusinessData businessData = new BusinessData(); businessData.addFactures(facture1); businessData.addFactures(facture2); businessData.addFactures(facture3); businessData.addFactures(facture4); businessData.addFactures(facture5); var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add <App>("app"); builder.Services.AddSingleton <BusinessData>(sp => businessData); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); await builder.Build().RunAsync(); }
/// <summary> /// /// </summary> /// <param name="bc"></param> public BusinessClient QueryBusinessClient(BusinessClient bc) { try { conn = new SqlConnection(connString); conn.Open(); SqlDataReader reader = null; string query = "SELECT Id, CompanyName, POC, AddressOne, AddressTwo, City, State, Zip, Phone, Email FROM tblBusinessClient"; SqlCommand cmd = new SqlCommand(query, conn); reader = cmd.ExecuteReader(); while (reader.Read()) { bc.Id = reader.GetInt32(reader.GetOrdinal("Id")); bc.CompanyName = reader.GetString(reader.GetOrdinal("CompanyName")); bc.PointOfContact = reader.GetString(reader.GetOrdinal("POC")); bc.Address1 = reader.GetString(reader.GetOrdinal("AddressOne")); bc.Address2 = reader.GetString(reader.GetOrdinal("AddressTwo")); bc.City = reader.GetString(reader.GetOrdinal("City")); bc.State = reader.GetString(reader.GetOrdinal("State")); bc.Zip = reader.GetString(reader.GetOrdinal("Zip")); bc.Phone = reader.GetString(reader.GetOrdinal("Phone")); bc.Email = reader.GetString(reader.GetOrdinal("Email")); } } catch (SqlException) { throw new Exception("Something went wrong with SQL and/or database"); } finally { conn.Close(); } return(bc); }
/// <summary> /// /// </summary> /// <param name="bc"></param> public void DeleteBusinessClient(BusinessClient bc) { try { conn = new SqlConnection(connString); conn.Open(); string insert = "DELETE FROM tblBusinessClient WHERE Id ='" + bc.Id + "'"; SqlCommand cmd = new SqlCommand(insert, conn); cmd.ExecuteNonQuery(); } catch (SqlException) { throw new Exception("Database is not opened."); } finally { conn.Close(); } }
private void btnNewBusiness_Click(object sender, EventArgs e) { newbusicontact = txtnewbusicontact.Text; newbusinessclient = txtBusinessNameNew.Text; clientID = tbClientID.Text; BusinessClientController businessClientController = new BusinessClientController(); BusinessClient businessClient = new BusinessClient( newbusicontact, newbusinessclient, clientID ); if (newbusicontact.Equals("")) { MessageBox.Show("Please enter business contact details", "EMPTY FIELDS!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (newbusinessclient.Equals("")) { MessageBox.Show("Please enter a business client name", "EMPTY FIELDS!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { businessClientController.Create(businessClient); MessageBox.Show("Business Client add successful, returning to Client Menu", " BUSINESS CLIENT ADDED", MessageBoxButtons.OK, MessageBoxIcon.Information); Hide(); frmClientMenu form = new frmClientMenu(); form.ShowDialog(); Show(); } }
private static void addBusiness() { var tw = new Stopwatch(); Console.WriteLine($"============{DateTime.Now}============"); tw.Start(); using (HttpClient http = new HttpClient()) { //var json = "{\"name\":\"金康3\",\"address\":\"中国武汉\",\"tel\":\"400888999\",\"email\":\"[email protected]\"}"; var dto = new BusinessDto(); dto.Name = "jk"; dto.Address = "中国武汉"; dto.Tel = "888888"; dto.Email = "*****@*****.**"; var json = JsonConvert.SerializeObject(dto); var content = new StringContent(json, Encoding.UTF8, "application/json"); var res = http.PostAsync($"{RestApiHost}/api/business/add", content).Result.Content.ReadAsStringAsync().Result; Console.WriteLine($"call restapi:{res}"); } tw.Stop(); Console.WriteLine(DateTime.Now + "==>use time:" + tw.ElapsedMilliseconds + "ms"); Console.WriteLine($"============{DateTime.Now}============"); tw.Restart(); var channel = new Channel(GrpcApiHost, ChannelCredentials.Insecure); var client = new BusinessClient(channel); var data = new BusinessCreationData(); data.Name = "金康3g"; data.Address = "中国武汉"; data.Tel = "888888"; data.Email = "*****@*****.**"; var result = client.Add(data); Console.WriteLine($"call grpcapi:{result.Message}"); tw.Stop(); Console.WriteLine(DateTime.Now + "==>use time::" + tw.ElapsedMilliseconds + "ms"); }
private frmAddServiceContractToClient(NewContractRequestLogic newContractRequestLogic) { InitializeComponent(); this.newContractRequestLogic = newContractRequestLogic; Client client = newContractRequestLogic.newContractRequest.Client; if (client is IndividualClient) { IndividualClient iClient = client as IndividualClient; lblClient.Text = iClient.ToString(); } else { BusinessClient bClient = client as BusinessClient; lblClient.Text = bClient.ToString(); } lblServiceContract.Text = newContractRequestLogic.newContractRequest.ServiceContract.ToString(); updateErrorLabel(); }