C# Code

 public virtual IEnumerable<T> GetAllForAutocomplete(string filedName,string fieldvalue)
        {
            string strWhereCondition = "where ";
            if ((PetaPoco.Internal.PocoData.ForType(typeof(T))).Columns.ContainsKey(filedName))
            {
                if ((PetaPoco.Internal.PocoData.ForType(typeof(T))).Columns.ContainsKey("IsDeleted"))
                {
                    strWhereCondition += "IsDeleted=0 ";
                }

                strWhereCondition += "AND " + filedName + " = '" + fieldvalue+"'";
            }
            var dbresult = _unitOfWork.Db.Fetch<T>(strWhereCondition);

            return dbresult;
        }
***************************************************************************
 public virtual IEnumerable<T> GetAllByParam(IDictionary<string, string> data)
        {
            string strWhereCondition = "";
            if ((PetaPoco.Internal.PocoData.ForType(typeof(T))).Columns.ContainsKey("IsDeleted"))
            {
                strWhereCondition = "where IsDeleted=0";
            }
            var dbresult = _unitOfWork.Db.Fetch<T>(strWhereCondition);

            return dbresult;
        }
***************************************************************************

            IEnumerable<CompanyModel> companyList = companyService.GetAllByName(search);
          var  result= from x in companyList   select new { id = x.Id,
                                     value = x.Id,
                                     name = x.CompanyName};

            //var suggestedUsers = from x in db.People
            //                     where x.LastName.StartsWith(prefixText)
            //                     select new { id = x.BusinessEntityID,
            //                         value = x.LastName + “, ”+ x.FirstName,
            //                         firstname = x.FirstName,
            //                         lastname = x.LastName };

          return Json(result, JsonRequestBehavior.AllowGet);
        }

Comments

Popular posts from this blog

Travel RESUME CV

Tablig