public void DifferentClientContactsCanStillBeEqual() { ClientContact contact1 = new ClientContact(Name, Phone, Email); ClientContact contact2 = new ClientContact(Name, Phone, Email); Assert.AreEqual(contact1, contact2); }
private ClientContact convertToClientContactObject(DataRow dr) { ClientContact clientContact = new ClientContact(); clientContact.Id = dr.Field <int>("ID"); clientContact.Cid = dr.Field <int>("CID"); clientContact.Add1 = dr.Field <string>("Add1"); clientContact.Street = dr.Field <string>("Street"); clientContact.City = dr.Field <string>("City"); clientContact.State = dr.Field <string>("State"); clientContact.Area = dr.Field <string>("Area"); clientContact.Pin = dr.Field <string>("Pin"); clientContact.Email = dr.Field <string>("Email"); clientContact.SpouseEmail = dr.Field <string>("SpouseEmail"); clientContact.PrimaryEmail = dr.Field <string>("PrimaryEmail"); clientContact.Mobile = dr.Field <string>("MobileNo"); clientContact.Spousemobile = dr.Field <string>("SpouseMobileNo"); clientContact.PrimaryMobile = dr.Field <string>("PrimaryMobileNo"); clientContact.UpdatedOn = dr.Field <DateTime>("UpdatedOn"); clientContact.UpdatedBy = dr.Field <int>("UpdatedBy"); clientContact.UpdatedByUserName = dr.Field <string>("UpdatedByUserName"); clientContact.PreferedTime = dr.Field <string>("PreferedTime"); clientContact.Country = dr.Field <string>("Country"); return(clientContact); }
public void Test_AddRelatedObjects() { ClientCandidate candidate = new ClientCandidate(); ClientCandidateWorkProfile workProfile = candidate.WorkProfiles.AddNew(); workProfile.CompanyName = "HirePro"; ClientContact contact = new ClientContact(); candidate.Contact = contact; contact.Address = "277 5th Cross 6th Block Koramangala"; Assert.IsTrue(candidate.IsDirty); Assert.IsTrue(candidate.WorkProfiles.IsDirty); Assert.IsTrue(candidate.Contact.IsDirty); Assert.IsTrue(candidate.IsValid); Assert.IsTrue(candidate.WorkProfiles.IsValid); Assert.IsTrue(candidate.Contact.IsValid); Assert.IsTrue(candidate.IsNew); Assert.IsTrue(candidate.Contact.IsNew); Assert.AreEqual(candidate.WorkProfiles.Count, 1); Assert.AreEqual(candidate.WorkProfiles.NewItems.Count, 1); Assert.AreEqual(candidate.WorkProfiles.ModifiedItems.Count, 0); Assert.AreEqual(candidate.WorkProfiles.DeletedItems.Count, 0); }
public void Test_Save() { ClientCandidate candidate = new ClientCandidate(); ClientCandidateWorkProfile workProfile = candidate.WorkProfiles.AddNew(); workProfile.CompanyName = "HirePro"; ClientContact contact = new ClientContact(); candidate.Contact = contact; contact.Address = "277 5th Cross 6th Block Koramangala"; MemoryRepository <ClientCandidate> .Save(candidate); Assert.IsFalse(candidate.IsNew); Assert.IsFalse(candidate.IsDirty); Assert.IsFalse(candidate.WorkProfiles.IsDirty); Assert.IsFalse(candidate.Contact.IsDirty); Assert.IsTrue(candidate.IsValid); Assert.IsFalse(candidate.IsSavable); Assert.IsFalse(candidate.CanSave()); Assert.IsNotNull(candidate.WorkProfiles); Assert.AreEqual(candidate.WorkProfiles.Count, 1); Assert.IsNotNull(candidate.Contact); }
public ClientContact Get(int clientId) { ClientContact clientContactObj = new ClientContact(); try { FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization(); string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_CLIENT_CONTACT_API, clientId); RestAPIExecutor restApiExecutor = new RestAPIExecutor(); var restResult = restApiExecutor.Execute <Client>(apiurl, null, "GET"); if (jsonSerialization.IsValidJson(restResult.ToString())) { clientContactObj = jsonSerialization.DeserializeFromString <ClientContact>(restResult.ToString()); } return(clientContactObj); } catch (Exception ex) { Logger.LogDebug(ex); return(null); } }
public IActionResult Post([FromBody] ClientAddr clientAddr) { try { if (clientAddr.Id == Guid.Empty) { ClientContact clientContact = _unitOfWork.ClientContacts.SingleOrDefault(c => c.Id == clientAddr.ClientContactId, true); if (clientContact.Id != Guid.Empty) { //var userId = User.FindFirstValue("sub"); var clientAddress = _mapper.Map <ClientAddress>(clientAddr); _unitOfWork.ClientAddresses.Add(clientAddress); _unitOfWork.Complete(); return(Created(new Uri($"{Request.Path}/{clientAddress.Id}", UriKind.Relative), _mapper.Map <ClientAddr>(clientAddress))); } } } catch (Exception e) { string message = e.Message; } return(BadRequest()); }
public App.CustomModels.CustomContact GetClientContact(int id) { OMMDataContext context = new OMMDataContext(); ClientContact contact = context.ClientContacts.SingleOrDefault(P => P.ID == id); return(MapClientContactObject(contact)); }
public ClientContact Update(ClientContact e) { DB.ClientContacts.Attach(e); DB.ObjectStateManager.ChangeObjectState(e, System.Data.EntityState.Modified); Save(); return(e); }
public async Task <IActionResult> Edit(int id, [Bind("clientId,firstName,lastName,phoneNumber,emailAddress,preferredContact")] ClientContact ClientContact) { if (id != ClientContact.clientId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ClientContact); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientContactExists(ClientContact.clientId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(ClientContact)); }
private void button4_Click(object sender, EventArgs e) { var rs = MessageBox.Show( "Bạn có chắc là muốn cáºp nháºt và lÆ°u dữ liệu không?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (rs == DialogResult.OK) { string[] listClients = new string[dataGridView1.Rows.Count]; for (int rows = 0; rows < dataGridView1.Rows.Count; rows++) { ClientContact client = new ClientContact { FindN = (dataGridView1.Rows[rows].Cells[1].Value == null) ? "" : dataGridView1.Rows[rows].Cells[1].ToString().Substring(0, 1), Name = (dataGridView1.Rows[rows].Cells[1].Value == null) ? "" : dataGridView1.Rows[rows].Cells[1].Value.ToString(), Phone = (dataGridView1.Rows[rows].Cells[2].Value == null) ? "" : dataGridView1.Rows[rows].Cells[2].Value.ToString(), Email = (dataGridView1.Rows[rows].Cells[3].Value == null) ? "" : dataGridView1.Rows[rows].Cells[3].Value.ToString(), }; int stt = rows + 1; string cli = stt.ToString() + " #" + client.Name + " #" + client.Phone + " #" + client.Email; listClients[rows] = cli; } ; File.WriteAllLines(pathClientDataFile, listClients, Encoding.UTF8); } else { MessageBox.Show("Bạn đã không lÆ°u"); } Close(); }
public async Task <IActionResult> Edit(int id, [Bind("ClientContactID,ClientID,Name,PositionID")] ClientContact clientContact) { if (id != clientContact.ClientContactID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(clientContact); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientContactExists(clientContact.ClientContactID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["ClientID"] = new SelectList(_context.Clients, "ClientID", "Name", clientContact.ClientID); ViewData["PositionID"] = new SelectList(_context.Positions, "PositionID", "iPosition", clientContact.PositionID); return(View(clientContact)); }
public bool AddClientContact(ClientContactViewModel contact) { bool success = false; int count = this._context .Client_Contact .Where(r => r.ClientId == contact.ClientId && r.Name.ToLower() == contact.Name.ToLower()) .Count(); if (count == 0) { success = true; string phone = contact.CandiatePhone; if (!string.IsNullOrEmpty(phone)) { phone = phone.Replace("(", ""); phone = phone.Replace(")", ""); phone = phone.Replace("-", ""); } ClientContact theContact = new ClientContact { Name = contact.Name, Email = contact.Email, Phone = phone, ClientId = contact.ClientId, CurrentUser = contact.CurrentUser }; this._context.Client_Contact.Add(theContact); this._context.SaveChanges(); } return(success); }
public IActionResult Patch(string id, [FromBody] JsonPatchDocument <ClientCon> clientConPatch) { try { if (Guid.TryParse(id, out Guid parsedId)) { //var userId = User.FindFirstValue("sub"); ClientContact clientContact = _unitOfWork.ClientContacts.Get(parsedId); ClientCon clientCon = _mapper.Map <ClientCon>(clientContact); clientConPatch.ApplyTo(clientCon); _mapper.Map(clientCon, clientContact); _unitOfWork.Complete(); return(CreatedAtRoute("Get", new { id = _mapper.Map <ClientCon>(clientContact).Id }, _mapper.Map <ClientCon>(clientContact))); } } catch (Exception e) { string message = e.Message; } return(BadRequest()); }
public static List <ClientContact> GetClientContact(string pathDataFile) { List <ClientContact> listClients = new List <ClientContact>(); if (File.Exists(pathDataFile)) { string[] listLines = File.ReadAllLines(pathDataFile); foreach (string line in listLines) { string[] rs = line.Split(new char[] { '#' }); ClientContact client = new ClientContact { FindN = rs[1].Substring(0, 1), Name = rs[1], Phone = rs[2], Email = rs[3] }; listClients.Add(client); } return(listClients); } else { throw new Exception(pathDataFile); return(null); } }
public async Task <ActionResult> Create([FromBody] CreateClientContactDTO clientContactDTO) { ClientContact clientContact = _mapper.Map <ClientContact>(clientContactDTO); await _clientContactRepository.CreateAsync(clientContact); return(CreatedAtRoute("GetClientContactById", new { clientContact.Id }, clientContact)); }
public async Task <ActionResult> SendMail(int id, string subject, string messageBody, string idName) { string email; string name; if ("trainerId".Equals(idName)) { Trainor trainer = db.Trainors.Find(id); if (trainer != null && trainer.Email != null) { email = trainer.Email; name = trainer.FirstName + " " + trainer.Lastname; } else { var errorMessage = (trainer == null ? "Specified trainer was not found" : "Specified trainer doesn't have an email address assigned"); return(Content("{\"Type\":\"Warn\", \"Message\":\"" + errorMessage + "\"}")); } } else { ClientContact clientContact = db.ClientContacts.Find(id); if (clientContact != null && clientContact.ContactEmail != null) { email = clientContact.ContactEmail; name = clientContact.ContactName; } else { var errorMessage = (clientContact == null ? "Specified client contact was not found" : "Specified client contact doesn't have an email address assigned"); return(Content("{\"Type\":\"Warn\", \"Message\":\"" + errorMessage + "\"}")); } } string modifiedMessage = messageBody.Replace("\n", "<br/>").Replace(Environment.NewLine, "<br/>"); //System.Web.HttpUtility.HtmlEncode(messageBody); var body = "<p>Email From: {0} ({1})</p><p>Message:</p><p>{2}</p>"; var message = new MailMessage(); message.To.Add(new MailAddress(email)); message.To.Add(new MailAddress("*****@*****.**")); message.Subject = subject; message.Body = string.Format(body, senderName, senderEmailAddress, modifiedMessage); message.IsBodyHtml = true; using (var smtp = new SmtpClient()) { try { await smtp.SendMailAsync(message); var successMessage = "Email Successfully sent to " + name; logger.InfoFormat("Email Successfully sent to {0}", name); return(Content("{\"Type\":\"Success\", \"Message\":\"" + successMessage + "\"}")); } catch (Exception e) { return(Content("{\"Type\":\"Success\", \"Message\":\"" + e.Message + "\"}")); } } }
public void Test2() { Orgnzr.Models.ClientContact client = new ClientContact(); client.firstName = "Sam"; Assert.AreEqual("Sam", client.firstName); }
public void Test1() { Orgnzr.Models.ClientContact client = new ClientContact(); client.clientId = 1; Assert.AreEqual(1, client.clientId); }
public void Test6() { Orgnzr.Models.ClientContact client = new ClientContact(); client.preferredContact = preferredContact.Text; Assert.AreEqual(preferredContact.Text, client.preferredContact); }
public ActionResult DeleteConfirmed(int id) { ClientContact clientContact = db.ClientContacts.Find(id); db.ClientContacts.Remove(clientContact); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Test5() { Orgnzr.Models.ClientContact client = new ClientContact(); client.emailAddress = "*****@*****.**"; Assert.AreEqual("*****@*****.**", client.emailAddress); }
public void Test4() { Orgnzr.Models.ClientContact client = new ClientContact(); client.phoneNumber = "2317158121"; Assert.AreEqual("2317158121", client.phoneNumber); }
public void Test3() { Orgnzr.Models.ClientContact client = new ClientContact(); client.lastName = "Church"; Assert.AreEqual("Church", client.lastName); }
public void ConstructorSetsValues() { ClientContact contact = new ClientContact(Name, Phone, Email); contact.Name.ShouldBe(Name); contact.Phone.ShouldBe(Phone); contact.Email.ShouldBe(Email); }
public PartialViewResult Edit(ClientContact r) { if (ModelState.IsValid) { r = Repo.Update(r); return(PartialView("View", r)); } return(PartialView("Edit", r)); }
public ActionResult Edit(ClientContact input, HttpPostedFileWrapper file) { var model = db.ClientContacts.SingleOrDefault(f => f.Id == input.Id); if (ModelState.IsValid) { if (CcUser.RoleId == (int)FixedRoles.Admin) { model.ReasonForContact = input.ReasonForContact; model.CcStaffContact = input.CcStaffContact; model.ContactDate = input.ContactDate; model.Contacted = input.Contacted; model.ContactedUsing = input.ContactedUsing; if (model.Filename != null) { if (file != null || input.Filename == null) { var abs = Server.MapPath(model.RelativeFilePath); if (System.IO.File.Exists(abs)) { System.IO.File.Delete(abs); } } input.Filename = null; } if (file != null) { model.Filename = file.FileName; file.SaveAs(Server.MapPath(model.RelativeFilePath)); } } model.ResponseRecievedDate = input.ResponseRecievedDate; try { db.SaveChanges(); } catch (Exception ex) { log.Error(ex.Message, ex); ModelState.AddModelError(string.Empty, ex.Message); } } if (ModelState.IsValid) { return(this.RedirectToAction("Details", "Clients", new { id = model.ClientId })); } else { return(EditView(model)); } }
public static void Initialize(contactContext context) { context.Database.EnsureCreated(); // Look for any students. if (context.Contacts.Any() && context.Product.Any()) { return; // DB has been seeded } //initialization of the contacts table for the ClientContact entity var clients = new ClientContact[] { new ClientContact { clientId = 1, firstName = "Carson", lastName = "Alexander", emailAddress = "*****@*****.**", phoneNumber = "222-333-4444", preferredContact = preferredContact.Text }, new ClientContact { clientId = 2, firstName = "Carson", lastName = "Backster", emailAddress = "*****@*****.**", phoneNumber = "222-333-4445", preferredContact = preferredContact.Email }, new ClientContact { clientId = 3, firstName = "Carson", lastName = "Ladasma", emailAddress = "*****@*****.**", phoneNumber = "222-333-4446", preferredContact = preferredContact.Phone }, new ClientContact { clientId = 4, firstName = "Carson", lastName = "O'Patches", emailAddress = "*****@*****.**", phoneNumber = "222-333-4447", preferredContact = preferredContact.Text }, new ClientContact { clientId = 5, firstName = "Carson", lastName = "Smith", emailAddress = "*****@*****.**", phoneNumber = "222-333-4448", preferredContact = preferredContact.Text }, }; foreach (ClientContact c in clients) { context.Contacts.Add(c); } context.SaveChanges(); //initialization of the inventory table for the Inventory entity var Product = new Product[] { new Product { productID = 1, productName = "Billion Dollar Beauty Sponge", productDescription = "Blue sponge for cleaning makeup", productCategory = "Tools", productBrand = "Billion Dollar Brows", buyPrice = 10.00, sellPrice = 15.00 }, new Product { productID = 2, productName = "Bronzilla", productDescription = "Tan packaging with half naked woman", productCategory = "Face", productBrand = "The Balm", buyPrice = 13.50, sellPrice = 17.00 }, new Product { productID = 3, productName = "First Love", productDescription = "Medium pink with black cap", productCategory = "Lips", productBrand = "Major Shade", buyPrice = 16.00, sellPrice = 20.00 }, }; foreach (Product item in Product) { context.Product.Add(item); } context.SaveChanges(); }
public ActionResult PhotoGrapherContact(ClientContact Contact) { cn.AddContact(Contact); TempData["msg"] = "<script>alert('Contact Sent Successfully,FeedBack Soon');</script>"; //Current Url Redirect return(Redirect(HttpContext.Request.UrlReferrer.AbsoluteUri)); }
public async Task <IActionResult> Create([Bind("clientId,firstName,lastName,phoneNumber,emailAddress,preferredContact")] ClientContact clientContact) { if (ModelState.IsValid) { _context.Add(clientContact); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(clientContact)); }
ActionResult EditView(ClientContact model) { if (CcUser.RoleId == (int)FixedRoles.Admin) { return(View("EditAdmin", model)); } else { return(View("Edit", model)); } }
private void attach_ClientContacts(ClientContact entity) { this.SendPropertyChanging("ClientContacts"); entity.Client = this; }
public static ClientContact CreateClientContact(int ID, int clientContact_Client, byte[] rowVersion) { ClientContact clientContact = new ClientContact(); clientContact.Id = ID; clientContact.ClientContact_Client = clientContact_Client; clientContact.RowVersion = rowVersion; return clientContact; }
public void AddToClientContacts(ClientContact clientContact) { base.AddObject("ClientContacts", clientContact); }
private void detach_ClientContacts(ClientContact entity) { this.SendPropertyChanging("ClientContacts"); entity.RbContactType = null; }
private void detach_ClientContacts_ModifyPersonId(ClientContact entity) { this.SendPropertyChanging("ClientContacts_ModifyPersonId"); entity.Person_ModifyPersonId = null; }
private void attach_ClientContacts_CreatePersonId(ClientContact entity) { this.SendPropertyChanging("ClientContacts_CreatePersonId"); entity.Person_CreatePersonId = this; }