예제 #1
0
 /// <summary>
 /// 根据工号获取司机信息
 /// </summary>
 /// <param name="ucode"></param>
 /// <returns></returns>
 public DriverInfoEntity GetDriverInfoByUcode(string ucode)
 {
     AdjDBObject adjDbObject = new AdjDBObject();
     string sql = "SELECT * FROM [dbo].[D_DriverInfo] (NOLOCK) WHERE Ucode = @Ucode";
     adjDbObject.GetSqlStringCommand(sql);
     adjDbObject.AddInParameter("@Ucode", DbType.String, ucode);
     try
     {
         using (IDataReader dr = adjDbObject.ExecuteReader())
         {
             List<DriverInfoEntity> users = GlobalFunction.GetEntityList<DriverInfoEntity>(dr);
             if (users != null)
             {
                 return users[0];
             }
             else
             {
                 return null;
             }
         }
     }
     catch (Exception e)
     {
         LogHelper lh = new LogHelper();
         lh.log(e.ToString(), HttpContext.Current.Server.MapPath("Log/error"));
         return null;
     }
 }
예제 #2
0
 /// <summary>
 /// 获取城市信息  兼容老版本 适应新版本 费劲
 /// </summary>
 /// <param name="cityname"></param>
 /// <returns></returns>
 public ChengShiModel GetChengShiInfo(string cityname)
 {
     try
     {
         ChengShiModel csm = new ChengShiModel();
         Citys cEntity = null;
         AdjDBObject adjDbObject = new AdjDBObject();
         string cmdtext = "select top 1  d.CityPriceId as id,CityName as name,d.Remark as notice,StartMileage as firstkm from D_CityPrice d WITH(NOLOCK) join D_CityPriceDetail dc with(nolock) on d.CityPriceId=dc.CityPriceId where CityName like '%" + cityname + "%'";
         adjDbObject.GetSqlStringCommand(cmdtext);
         // adjDbObject.AddInParameter("@cityname", DbType.String, cityname);
         using (IDataReader datareader = adjDbObject.ExecuteReader())
         {
             List<Citys> reList = GlobalFunction.GetEntityList<Citys>(datareader);
             if (reList != null)
             {
                 cEntity = reList[0];
                 csm.Name = cEntity.Name;
                 csm.FirstKm = cEntity.FirstKm;
                 csm.Notice = cEntity.Notice;
                 cmdtext = "select StartTime as TStart,EndTime as TEnd,StartPrice as Price from D_CityPriceDetail WITH(NOLOCK) where [CityPriceId]=" + cEntity.Id;
                 adjDbObject.GetSqlStringCommand(cmdtext);
                 using (IDataReader datareader1 = adjDbObject.ExecuteReader())
                 {
                     List<PriceItems> reList1 = GlobalFunction.GetEntityList<PriceItems>(datareader1);
                     if (reList1 != null)
                     {
                         csm.PriceItems = reList1;
                     }
                 }
             }
         }
         return csm;
     }
     catch (Exception ex)
     {
         return null;
     }
 }
예제 #3
0
 /// <summary>
 /// ADO获取实体BY SIGN
 /// </summary>
 /// <param name="sign"></param>
 /// <returns></returns>
 public T_ParterEntity GetParterModelBySign(string sign)
 {
     T_ParterEntity pEntity = null;
     AdjDBObject adjDbObject = new AdjDBObject();
     string cmdtext = "select * from dbo.T_Parter (nolock) WHERE  sign=@sign";
     adjDbObject.GetSqlStringCommand(cmdtext);
     adjDbObject.AddInParameter("@sign", DbType.String, sign);
     using (IDataReader datareader = adjDbObject.ExecuteReader())
     {
         List<T_ParterEntity> reList = GlobalFunction.GetEntityList<T_ParterEntity>(datareader);
         if (reList != null)
         {
             pEntity = reList[0];
         }
     }
     return pEntity;
 }
예제 #4
0
 public IList<ChengShiName> GetChengShiName(string cityname)
 {
     IList<ChengShiName> citys = null;
     AdjDBObject adjDbObject = new AdjDBObject();
     try
     {
         string sql = "SELECT CityName as name FROM dbo.D_CityPrice WITH(NOLOCK) ";
         adjDbObject.GetSqlStringCommand(sql);
         using (IDataReader datareader = adjDbObject.ExecuteReader())
         {
             citys = GlobalFunction.GetEntityList<ChengShiName>(datareader);
         }
     }
     catch (Exception ex)
     {
         citys = null;
     }
        return citys;
 }
예제 #5
0
 /// <summary>
 /// 根据电话号码获取客户实体
 /// </summary>
 /// <param name="phone">电话号码</param>
 /// <returns></returns>
 public CustomerInfoEntity GetClientInfoByPhone(string phone)
 {
     CustomerInfoEntity tuijian = null;
        // AdjDBObject dbObject = new AdjDBObject("NewAidaijia");
     AdjDBObject adjDbObject = new AdjDBObject();
     string cmdtext = "select * from D_CustomerInfo WITH(NOLOCK) where cellphone=@phone";
     adjDbObject.GetSqlStringCommand(cmdtext);
     adjDbObject.AddInParameter("@phone", DbType.String, phone);
     using (IDataReader datareader = adjDbObject.ExecuteReader())
     {
         List<CustomerInfoEntity> reList = GlobalFunction.GetEntityList<CustomerInfoEntity>(datareader);
         if (reList != null)
         {
             tuijian = reList[0];
         }
     }
     return tuijian;
 }
예제 #6
0
        /// <summary>
        /// 根据ID获取司机工号
        /// </summary>
        /// <returns></returns>
        public string GetUcodeById(string uid)
        {
            string result = string.Empty;
            AdjDBObject adjDbObject = new AdjDBObject();
            string sql = "SELECT top 1 Ucode FROM [dbo].[D_DriverInfo] (NOLOCK) WHERE  id= @uid";
            adjDbObject.GetSqlStringCommand(sql);
            adjDbObject.AddInParameter("@uid", DbType.String, uid);
            try
            {
                using (IDataReader dr = adjDbObject.ExecuteReader())
                {
                    if (dr.Read())
                    {
                        result = dr[0].ToString();
                    }
                    return result;
                }
            }
            catch (Exception)
            {

                return "";
            }
        }