/// <summary> /// Bind Type of Hosts /// </summary> private void GetHostType() { FranchisorDAL objDAL = new FranchisorDAL(); var listProspectType = objDAL.GetProspectType(string.Empty, 3); EProspectType[] ptype = null; if (listProspectType != null) { ptype = listProspectType.ToArray(); } if (ptype.Length > 0) { ddlHostType.Items.Add(new ListItem("Select Type", "0")); for (int count = 0; count < ptype.Length; count++) { ddlHostType.Items.Add(new ListItem(ptype[count].Name.ToString(), ptype[count].ProspectTypeID.ToString())); } } }
/// <summary> /// This method searches for the hosttype by name entered. /// </summary> /// <param name="searchtext"></param> private void SearchHostType(string searchtext) { //FranchisorService service = new FranchisorService(); //HealthYes.Web.UI.FranchisorService.EProspectType[] hosttype = service.GetProspectTypeByName(searchtext); FranchisorDAL objFranchisorDal = new FranchisorDAL(); Falcon.Entity.Other.EProspectType[] hosttype = null; //mode - 2 for Get Prospect Type By Name var listHostType = objFranchisorDal.GetProspectType(searchtext, 2); if (listHostType != null) { hosttype = listHostType.ToArray(); } //HostTypeService.HostTypeService service = new HostTypeService.HostTypeService(); //HostTypeService.EHostType[] hosttype; //hosttype = service.GetHostTypeByName(searchtext); DataTable dtHostType = new DataTable(); dtHostType.Columns.Add("HostTypeID"); dtHostType.Columns.Add("name"); dtHostType.Columns.Add("description"); dtHostType.Columns.Add("Active"); if (hosttype.Length > 0) { for (int icount = 0; icount < hosttype.Length; icount++) { if (hosttype[icount].Active.ToString().Equals("True")) { dtHostType.Rows.Add(new object[] { hosttype[icount].ProspectTypeID, hosttype[icount].Name, hosttype[icount].Description, "Active" }); } else { dtHostType.Rows.Add(new object[] { hosttype[icount].ProspectTypeID, hosttype[icount].Name, hosttype[icount].Description, "Deactivated" }); } } if ((SortDirection)ViewState["SortHostType"] == SortDirection.Descending) { dtHostType.DefaultView.Sort = "name desc"; } else { dtHostType.DefaultView.Sort = "name asc"; } dtHostType = dtHostType.DefaultView.ToTable(); grdHostType.DataSource = dtHostType; ViewState["DSGRID"] = dtHostType; grdHostType.DataBind(); txtName.Text = ""; txtDescription.Text = ""; hfHostTypeID.Value = ""; btnActivate.Enabled = true; btnDeActivate.Enabled = true; btnEdit.Enabled = true; btnDelete.Enabled = true; grdHostType.Visible = true; divGrdHostType.Style.Add(HtmlTextWriterStyle.Display, "block"); } else { divErrorMsg.Visible = true; divErrorMsg.InnerText = "No Records Found"; //ClientScript.RegisterStartupScript(typeof(string), "jscode", "DisableAll();", true); btnActivate.Enabled = false; btnDeActivate.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; grdHostType.Visible = false; divGrdHostType.Style.Add(HtmlTextWriterStyle.Display, "none"); } }