protected void rptServices_ItemCommand(object source, RepeaterCommandEventArgs e) { switch (e.CommandName.ToLower()) { case "edit": #region -- Lấy thông tin dịch vụ ActiveCost = Module.GetObject <AgencyLocation>(Convert.ToInt32(e.CommandArgument)); txtServiceName.Text = ActiveCost.Name; if (ActiveCost.Parent != null) { ddlSuppliers.SelectedValue = ActiveCost.Parent.Id.ToString(); } else { ddlSuppliers.SelectedIndex = 0; } #endregion btnDelete.Visible = true; btnDelete.Enabled = true; labelFormTitle.Text = ActiveCost.Name; break; default: break; } }
public static AgencyLocation ToAgencyLocation(this ViewAgencyProfileView viewData) { if (viewData == null) { return(null); } var agencyLocation = new AgencyLocation { HoursOfOperation = viewData.HoursOfOperation, PrimaryEmail = viewData.PrimaryEmail, PrimaryPhone = viewData.PrimaryPhone, PhysicalAddress = new AgencyAddress { Address1 = viewData.PhysicalAddress1, Address2 = viewData.PhysicalAddress2, City = viewData.PhysicalCity, County = new County { Code = viewData.PhysicalCountyFIPS }, State = viewData.State, Zip = viewData.PhysicalZip }, }; return(agencyLocation); }
protected void btnAdd_Click(object sender, EventArgs e) { ActiveCost = new AgencyLocation(); txtServiceName.Text = String.Empty; ddlSuppliers.SelectedIndex = 0; btnDelete.Visible = false; btnDelete.Enabled = false; }
protected void btnSave_Click(object sender, EventArgs e) { ActiveCost.Name = txtServiceName.Text; if (ddlSuppliers.SelectedIndex > 0) { ActiveCost.Parent = Module.GetObject <AgencyLocation>(Convert.ToInt32(ddlSuppliers.SelectedValue)); } else { ActiveCost.Parent = null; } // Kiểm tra trong View State Module.SaveOrUpdate(ActiveCost); ActiveCost = ActiveCost; rptServices.DataSource = Module.GetObject <AgencyLocation>(Expression.IsNull("Parent"), 0, 0); rptServices.DataBind(); }
protected void rptServices_ItemDataBound(object sender, RepeaterItemEventArgs e) { AgencyLocation service = e.Item.DataItem as AgencyLocation; if (service != null) { using (LinkButton lbtEdit = e.Item.FindControl("lbtEdit") as LinkButton) { if (lbtEdit != null) { // Gán text và command argument, điều này cũng có thể làm ngay trên aspx lbtEdit.Text = service.Name; lbtEdit.CommandArgument = service.Id.ToString(); } } var rptChild = e.Item.FindControl("rptChild") as Repeater; if (rptChild != null) { rptChild.DataSource = service.Child; rptChild.DataBind(); } } }
public static AgencyLocation ToAgencyLocation(this EditAgencyViewData viewData) { if (viewData == null) { return(null); } var agencyLocation = new AgencyLocation { ActiveInactiveDate = viewData.ActiveInactiveDate, Comments = viewData.Comments, ContactFirstName = viewData.SponsorFirstName, ContactMiddleName = viewData.SponsorMiddleName, ContactLastName = viewData.SponsorLastName, ContactTitle = viewData.SponsorTitle, CreatedBy = viewData.CreatedBy, CreatedDate = viewData.CreatedDate, Fax = viewData.Fax, HoursOfOperation = viewData.HoursOfOperation, IsActive = viewData.IsActive, IsMainOffice = true, LastUpdatedBy = viewData.LastUpdatedBy, LastUpdatedDate = viewData.LastUpdatedDate, LocationName = viewData.Name, PrimaryEmail = viewData.PrimaryEmail, PrimaryPhone = viewData.PrimaryPhone, SecondaryEmail = viewData.SecondaryEmail, SecondaryPhone = viewData.SecondaryPhone, TDD = viewData.TDD, TollFreePhone = viewData.TollFreePhone, TollFreeTDD = viewData.TollFreeTDD, //Added by Lavanya AvailableLanguages = viewData.AvailableLanguages, HideAgencyFromSearch = viewData.HideAgencyFromSearch, //end PhysicalAddress = new AgencyAddress { Address1 = viewData.PhysicalAddress1, Address2 = viewData.PhysicalAddress2, City = viewData.PhysicalCity, County = new County { Code = viewData.PhysicalCountyFIPS }, CreatedBy = viewData.CreatedBy, CreatedDate = viewData.CreatedDate, LastUpdatedBy = viewData.LastUpdatedBy, LastUpdatedDate = viewData.LastUpdatedDate, State = viewData.State, Zip = viewData.PhysicalZip, //Added by Lavanya Longitude = viewData.Longitude, Latitude = viewData.Latitude //end }, MailingAddress = new AgencyAddress { Address1 = viewData.MailingAddress1, Address2 = viewData.MailingAddress2, City = viewData.MailingCity, CreatedBy = viewData.CreatedBy, CreatedDate = viewData.CreatedDate, LastUpdatedBy = viewData.LastUpdatedBy, LastUpdatedDate = viewData.LastUpdatedDate, State = viewData.MailingState, Zip = viewData.MailingZip }, }; return(agencyLocation); }