/// <summary>
 /// Method to search tributes based on the entered criteria.
 /// </summary>
 /// <param name="objTribute">TributeSearch entity containing search criteria.</param>
 /// <returns>List of Tributes.</returns>
 public List<TributeSearch> SearchTributes(TributeSearch objTribute)
 {
     return FacadeManager.TributeManager.SearchTribute(objTribute);
 }
        /// <summary>
        /// Method to get the search tributes based on the entered criteria.
        /// </summary>
        /// <param name="objTribute">Filled TributeSearch entity containing search criteria.</param>
        /// <returns>List of tributes.</returns>
        public List<TributeSearch> SearchTributes(object[] objTribute)
        {
            List<TributeSearch> objTributeList = new List<TributeSearch>();
            TributeSearch objTrib = (TributeSearch)objTribute[0];

            object[] objParam = {objTrib.SearchTributeId, objTrib.TributeName, objTrib.UserName, objTrib.SearchUserId,
                                    objTrib.City, objTrib.State, objTrib.Country, objTrib.TypeDescription,
                                    objTrib.TributeStatus, objTrib.CreatedAfter, objTrib.CreatedBefore,
                                    objTrib.PurchasedAfter, objTrib.PurchasedBefore,objTrib.ApplicationType};

            DataSet dsTributes = GetDataSet("usp_SearchTribute", objParam);

            if (dsTributes.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in dsTributes.Tables[0].Rows)
                {
                    TributeSearch obj = new TributeSearch();
                    //add data to tribute object
                    //Tributes objTributes = new Tributes();
                    obj.TributeId = int.Parse(dr["TributeId"].ToString());
                    obj.TributeName = dr["TributeName"].ToString();
                    obj.City = dr["City"].ToString();
                    obj.TypeDescription = dr["TributeTypeName"].ToString();
                    obj.CreatedDate = DateTime.Parse(dr["CreatedDate"].ToString());
                    obj.CreationDate = DateTime.Parse(dr["CreatedDate"].ToString()).ToString("MMMM dd, yyyy");
                    //set tribute entity to TributeSearch.Tributes
                    //obj.Tributes = objTributes;

                    //set tribute serach entity
                    obj.StateName = dr["StateName"].ToString();
                    obj.CountryName = dr["CountryName"].ToString();
                    obj.TributeStatus = dr["TributeStatus"].ToString();
                    obj.EndDate = dr["EndDate"].ToString() == string.Empty ? string.Empty : DateTime.Parse(dr["EndDate"].ToString()).ToString("MMMM dd, yyyy");
                    obj.IsActive = bool.Parse(dr["IsActive"].ToString());
                    //set usertributeId ---03-Feb-09---- ANKI
                    obj.UserTributeId = int.Parse(dr["CreatedBy"].ToString());
                    obj.TributeUrl = dr["TributeUrl"].ToString();
                    //add data to list
                    objTributeList.Add(obj);
                    //objTributes = null;
                    obj = null;
                }
            }

            return objTributeList;
        }
    private TributeSearch GetTributeObject()
    {
        TributeSearch objTribute = new TributeSearch();

        //Tributes objTrib = new Tributes();
        objTribute.TributeName = txtTributeName.Text.Replace("?", "_").Replace("*", "%").Trim();
        objTribute.City = txtCity.Text.Replace("?", "_").Replace("*", "%").Trim();
        objTribute.State = int.Parse(ddlStateProvince.SelectedValue);
        objTribute.Country = int.Parse(ddlCountry.SelectedValue);
        //to get selected tribute types
        string selTypes = string.Empty;
        for (int i = 0; i < chklstTypes.Items.Count; i++)
        {
            if (chklstTypes.Items[i].Selected)
            {
                selTypes = selTypes + chklstTypes.Items[i].Value + ",";
            }
        }

        if (!Equals(selTypes, string.Empty))
            objTribute.TypeDescription = selTypes.Remove(selTypes.LastIndexOf(","));

        //to set values to tribute in tributesearch entity
        //objTribute.Tributes = objTrib;

        objTribute.SearchTributeId = txtTributeId.Text.Trim();
        objTribute.UserName = txtUserName.Text.Trim();
        objTribute.SearchUserId = txtUserId.Text.Trim();
        objTribute.ApplicationType = ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower();

        //to get selected tribute status
        string selStatus = string.Empty;
        for (int i = 0; i < chklstStatus.Items.Count; i++)
        {
            if (chklstStatus.Items[i].Selected)
            {
                if (i == 3)
                    chklstStatus.Items[i].Value = "0";
                selStatus = selStatus + chklstStatus.Items[i].Value+ ",";
            }
        }
            if (chklstStatus.Items[0].Selected)
            {
                selStatus = selStatus + "8,";
            }
            if (chklstStatus.Items[1].Selected)
            {
                selStatus = selStatus + "5,7,";
            }
            if (chklstStatus.Items[2].Selected)
            {
                selStatus = selStatus + "4,6,";
            }

        if (!Equals(selStatus, string.Empty))
            objTribute.TributeStatus = selStatus.Remove(selStatus.LastIndexOf(","));

        if (drpBeforeDay.SelectedValue != string.Empty && drpBeforeMonth.SelectedValue != string.Empty && txtBeforeYear.Text != string.Empty)
            objTribute.CreatedBefore = DateTime.Parse(drpBeforeMonth.SelectedValue + "/" + drpBeforeDay.SelectedValue + "/" + txtBeforeYear.Text);

        if (drpAfterDay.SelectedValue != string.Empty && drpAfterMonth.SelectedValue != string.Empty && txtAfterYear.Text != string.Empty)
            objTribute.CreatedAfter = DateTime.Parse(drpAfterMonth.SelectedValue + "/" + drpAfterDay.SelectedValue + "/" + txtAfterYear.Text);

        if (drpPurchasedBeforeDay.SelectedValue != string.Empty && drpPurchasedBeforeMonth.SelectedValue != string.Empty && txtPurchasedBeforeYear.Text != string.Empty)
            objTribute.PurchasedBefore = DateTime.Parse(drpPurchasedBeforeMonth.SelectedValue + "/" + drpPurchasedBeforeDay.SelectedValue + "/" + txtPurchasedBeforeYear.Text);

        if (drpPurchasedAfterDay.SelectedValue != string.Empty && drpPurchasedAfterMonth.SelectedValue != string.Empty && txtPurchasedAfterYear.Text != string.Empty)
            objTribute.PurchasedAfter = DateTime.Parse(drpPurchasedAfterMonth.SelectedValue + "/" + drpPurchasedAfterDay.SelectedValue + "/" + txtPurchasedAfterYear.Text);

        return objTribute;
    }
Exemplo n.º 4
0
 /// <summary>
 /// Method to search tributes based on the entered criteria.
 /// </summary>
 /// <param name="objTribute">Filled TributeSearch entity containing search criteria.</param>
 /// <returns>List of tributes.</returns>
 public List<TributeSearch> SearchTribute(TributeSearch objTribute)
 {
     TributeResource objTributeResource = new TributeResource();
     object[] objParam = { objTribute };
     return objTributeResource.SearchTributes(objParam);
 }