public async Task <EmailAddressDto> Get(Guid personId, Guid id) { using (busyIndicatorService.Show()) { return(await emailAddressService.Get(personId, id)); } }
protected void btnSubmit_Click(object sender, EventArgs e) { bool isUpdate = false; //Create an instance of the EmailAddressService using (IContainer factory = ObjectFactory.Container.GetNestedContainer("ADV")) { IEmailAddressService emailService = factory.GetInstance <IEmailAddressService>(); EmailAddressDTO emailAddress = new EmailAddressDTO(); if (Session["EmailEditId"] != null) { emailAddress = emailService.Get(Convert.ToInt32(Session["EmailEditId"].ToString())); isUpdate = true; } emailAddress.Priority = chknPriority.Checked; emailAddress.EmailAddress = txtEmailAddr.Text; emailAddress.AddressTypeId = Convert.ToInt32(ddlAddressType.SelectedValue); emailAddress.BeginsOn = Convert.ToDateTime(txtBeginsOn.Text); if (txtEndsOn.Text.HasValue()) { emailAddress.EndsOn = Convert.ToDateTime(txtEndsOn.Text); } try { EmailAddressDTO ret = isUpdate ? emailService.Update(Convert.ToInt32(txtUserId.Text), emailAddress) : emailService.Create(Convert.ToInt32(txtUserId.Text), emailAddress); if (ret == null) { ParentPortlet.ShowFeedback(FeedbackType.Error, "Error occured while creating email address."); } } catch (MissingDataException ex) { ParentPortlet.ShowFeedback(FeedbackType.Error, ex.Message); } } ClearData(); GetJxAddresses(); }
private void GgEmailAddressList_EditCommand(object source, DataGridCommandEventArgs e) { Session["EmailEditId"] = ggEmailAddressList.DataKeys[e.Item.ItemIndex].ToString(); pnlAddUpdate.Visible = true; EmailAddressDTO emailAddress; using (IContainer factory = ObjectFactory.Container.GetNestedContainer("ADV")) { IEmailAddressService emailService = factory.GetInstance <IEmailAddressService>(); emailAddress = emailService.Get(Convert.ToInt32(Session["EmailEditId"].ToString())); } txtEmailAddr.Text = emailAddress.EmailAddress; txtBeginsOn.Text = emailAddress.BeginsOn.ToString(); txtEndsOn.Text = emailAddress.EndsOn != null?emailAddress.EndsOn.ToString() : string.Empty; ddlAddressType.SelectedValue = emailAddress.AddressTypeId.ToString(); chknPriority.Checked = emailAddress.Priority; }