/// <summary> /// 添加新用户 /// </summary> /// <returns></returns> public bool AddCustomerInfo(CustomerInfoEntity accident) { bool isok = true; AdjDBObject adjdbobject = new AdjDBObject(); try { string cmdtext = "INSERT INTO dbo.D_CustomerInfo( CustomerId ,CustomerName ,RecommendCode ,Cellphone ,Email ,HomeAddress ,CustomerType ,AccountType ,IsNewCustomer ,LastCalledAddress ,Amount ,BusinessmanId ,create_time ,create_user,ParentPhone ) VALUES(@CustomerId ,@CustomerName ,@RecommendCode ,@Cellphone, @Email, @HomeAddress, @CustomerType ,@AccountType ,@IsNewCustomer, @LastCalledAddress, @Amount ,@BusinessmanId ,@create_time, @create_user,@ParentPhone )"; adjdbobject.GetSqlStringCommand(cmdtext); adjdbobject.AddInParameter("@CustomerId", DbType.String, accident.CustomerId); adjdbobject.AddInParameter("@CustomerName", DbType.String, accident.CustomerName); adjdbobject.AddInParameter("@RecommendCode", DbType.String, accident.RecommendCode); adjdbobject.AddInParameter("@Cellphone", DbType.String, accident.Cellphone); adjdbobject.AddInParameter("@ParentPhone", DbType.String, accident.ParentPhone); adjdbobject.AddInParameter("@Email", DbType.String, ""); adjdbobject.AddInParameter("@HomeAddress", DbType.String, accident.HomeAddress); adjdbobject.AddInParameter("@CustomerType", DbType.Int32, accident.CustomerType); adjdbobject.AddInParameter("@AccountType", DbType.Int32, accident.AccountType); adjdbobject.AddInParameter("@IsNewCustomer", DbType.Int32, accident.IsNewCustomer); adjdbobject.AddInParameter("@LastCalledAddress", DbType.String, accident.LastCalledAddress); adjdbobject.AddInParameter("@Amount", DbType.Decimal, accident.Amount); adjdbobject.AddInParameter("@BusinessmanId", DbType.Int32, accident.BusinessmanId); adjdbobject.AddInParameter("@create_time", DbType.DateTime, DateTime.Now); adjdbobject.AddInParameter("@create_user", DbType.String, "ThirdPartyAPI"); adjdbobject.Execute(); } catch (Exception ex) { isok = false; } return isok; }
public bool addCoupon(string couponsCode, double couponsValue, string partyid, CustomerInfoEntity ci) { AdjDBObject adjDbObject = new AdjDBObject(); StringBuilder sb = new StringBuilder(); sb.AppendLine("insert into d_youhui"); sb.AppendLine("(BatchId,cardcode,Money,Youhuima,Type,UseState,property,usecount,Remark ,Addtime,CREATE_USER,ExpiredDate,UsePeople,UserPeopleId,UserType)"); sb.AppendLine("values"); sb.AppendLine("(@BatchId,@cardcode,@Money,@Youhuima,@Type,@UseState,@property,@usecount,@Remark ,@Addtime,@CREATE_USER,@ExpiredDate,@UsePeople,@UserPeopleId,@UserType)"); adjDbObject.GetSqlStringCommand(sb.ToString()); adjDbObject.AddInParameter("@BatchId",System.Data.DbType.Int32,0); adjDbObject.AddInParameter("@cardcode", System.Data.DbType.String, couponsCode); adjDbObject.AddInParameter("@Money", System.Data.DbType.Decimal, couponsValue); adjDbObject.AddInParameter("@Youhuima", System.Data.DbType.String, couponsCode); adjDbObject.AddInParameter("@Type", System.Data.DbType.Int32, 0); adjDbObject.AddInParameter("@UseState", System.Data.DbType.Int32, 0); adjDbObject.AddInParameter("@property", System.Data.DbType.Int32, 20); adjDbObject.AddInParameter("@usecount", System.Data.DbType.Int32, 0); adjDbObject.AddInParameter("@Remark", System.Data.DbType.String, partyid); adjDbObject.AddInParameter("@Addtime", System.Data.DbType.DateTime, DateTime.Now); adjDbObject.AddInParameter("@CREATE_USER", System.Data.DbType.String, "Third Party"); adjDbObject.AddInParameter("@ExpiredDate", System.Data.DbType.DateTime, DateTime.Now.AddYears(1)); adjDbObject.AddInParameter("@UsePeople", System.Data.DbType.String, ""); adjDbObject.AddInParameter("@UserPeopleId", System.Data.DbType.String, ci.CustomerId); adjDbObject.AddInParameter("@UserType", System.Data.DbType.String, 1); return adjDbObject.Execute() > 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; } }
/// <summary> /// 判断优惠券是否存在 /// </summary> /// <param name="couponCode"></param> /// <returns></returns> public bool isExistCoupon(string couponCode) { AdjDBObject adjDbObject = new AdjDBObject(); adjDbObject.GetSqlStringCommand("select count(1) from d_youhui where Youhuima = @Youhuima"); adjDbObject.AddInParameter("@Youhuima", System.Data.DbType.String, couponCode); return Convert.ToInt32(adjDbObject.ExecuteScalar()) > 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; } }
/// <summary> /// 获取订单预约种子数 /// </summary> /// <returns></returns> public int SelectSeqOrder() { AdjDBObject adjdbobject = new AdjDBObject(); try { string cmdtext = "INSERT INTO D_SeqOrder DEFAULT VALUES SELECT @@IDENTITY"; adjdbobject.GetSqlStringCommand(cmdtext); return int.Parse(adjdbobject.ExecuteScalar().ToString()); } catch (Exception ex) { return 0; } }
/// <summary> /// 添加派单 /// </summary> /// <param name="model">派单实体</param> /// <returns></returns> public bool AddDistributeOrderInfo(DistributeOrderInfoEntity model) { AdjDBObject adjDbObject = new AdjDBObject(); bool isok = true; try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into D_DistributeOrderInfo("); strSql.Append("PartyId,DistributeUser,Cellphone,Address,SuccessTime,Ucode,lng,lat,CustomerId,CustomerName,CustomerType,DistributeOrderId,AccountType,FromCellphone,AppointmentTime,create_time,create_user,update_time,update_user,delete_flag,delete_time,delete_user,AppointOrderId,OrderId,BusinessType,OrderFrom,OrderType,Status,DistributeUserType"); strSql.Append(") values ("); strSql.Append("@PartyId,@DistributeUser,@Cellphone,@Address,@SuccessTime,@Ucode,@lng,@lat,@CustomerId,@CustomerName,@CustomerType,@DistributeOrderId,@AccountType,@FromCellphone,@AppointmentTime,GETDATE(),@create_user,@update_time,@update_user,@delete_flag,@delete_time,@delete_user,@AppointOrderId,@OrderId,@BusinessType,@OrderFrom,@OrderType,@Status,@DistributeUserType"); strSql.Append(") "); adjDbObject.GetSqlStringCommand(strSql.ToString()); adjDbObject.AddInParameter("@partyId", DbType.String, model.PartyId); adjDbObject.AddInParameter("@DistributeUser", DbType.String, model.DistributeUser); adjDbObject.AddInParameter("@Cellphone", DbType.String, model.Cellphone); adjDbObject.AddInParameter("@Address", DbType.String, model.Address); adjDbObject.AddInParameter("@SuccessTime", DbType.DateTime, model.SuccessTime); adjDbObject.AddInParameter("@Ucode", DbType.String, model.Ucode); adjDbObject.AddInParameter("@lng", DbType.Decimal, model.Lng); adjDbObject.AddInParameter("@lat", DbType.Decimal, model.Lat); adjDbObject.AddInParameter("@CustomerId", DbType.String, model.CustomerId); adjDbObject.AddInParameter("@CustomerName", DbType.String, model.CustomerName); adjDbObject.AddInParameter("@CustomerType", DbType.Int32, model.CustomerType); adjDbObject.AddInParameter("@DistributeOrderId", DbType.String, model.DistributeOrderId); adjDbObject.AddInParameter("@AccountType", DbType.Int32, model.AccountType); adjDbObject.AddInParameter("@FromCellphone", DbType.String, model.Fromcellphone); adjDbObject.AddInParameter("@AppointmentTime", DbType.DateTime, model.AppointmentTime); adjDbObject.AddInParameter("@create_user", DbType.String, model.Create_user); adjDbObject.AddInParameter("@update_time", DbType.DateTime, model.Update_time); adjDbObject.AddInParameter("@update_user", DbType.String, model.Update_user); adjDbObject.AddInParameter("@delete_flag", DbType.Boolean, model.Delete_flag); adjDbObject.AddInParameter("@delete_time", DbType.DateTime, model.Delete_time); adjDbObject.AddInParameter("@delete_user", DbType.String, model.Delete_user); adjDbObject.AddInParameter("@AppointOrderId", DbType.String, model.AppointOrderId); adjDbObject.AddInParameter("@OrderId", DbType.String, model.OrderId); adjDbObject.AddInParameter("@BusinessType", DbType.Int32, model.BusinessType); adjDbObject.AddInParameter("@OrderFrom", DbType.Int32, model.OrderFrom); adjDbObject.AddInParameter("@OrderType", DbType.Int32, model.OrderType); adjDbObject.AddInParameter("@Status", DbType.Int32, model.Status); adjDbObject.AddInParameter("@DistributeUserType", DbType.Int32, model.DistributeUserType); adjDbObject.Execute(); } catch (Exception ex) { isok = false; } return isok; }
/// <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; }
public void getOrderCellphone_Ucode(string orderid, out string cellphone, out string ucode) { cellphone = ""; ucode = ""; AdjDBObject adjDbObject = new AdjDBObject(); adjDbObject.GetSqlStringCommand("select cellphone,ucode from D_OrderInfo where orderid = @orderid"); adjDbObject.AddInParameter("@orderid", DbType.String, orderid); DataTable dt = adjDbObject.ExecuteDataSet().Tables[0]; if (dt.Rows.Count > 0) { cellphone = dt.Rows[0]["cellphone"].ToString(); ucode = dt.Rows[0]["ucode"].ToString(); } else { throw new Exception("没有该订单"); } }
/// <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; }
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; }
/// <summary> /// 根据sign获取当天访问量 /// </summary> /// <param name="sign"></param> /// <returns></returns> public int GetcountBysign(string sign) { int cou = 0; try { AdjDBObject adjDbObject = new AdjDBObject(); string cmdtext = "select count(*) as counts from T_ParterDyLog where sign=@sign and addtime between'" + DateTime.Now.ToString("yyyy-MM-dd") + "' and '" + DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + "' "; adjDbObject.GetSqlStringCommand(cmdtext); adjDbObject.AddInParameter("@sign", DbType.String, sign); cou = int.Parse(adjDbObject.ExecuteScalar().ToString()); } catch (Exception ex) { cou = 0; } return cou; }
/// <summary> /// 新增一条投诉记录 /// </summary> /// <param name="complain"></param> /// <returns></returns> public int addComplain(D_OrderComplaint complain) { AdjDBObject db = new AdjDBObject(); StringBuilder sb = new StringBuilder(); sb.AppendLine("insert into D_OrderComplaint "); sb.AppendLine("(OrderId ,CustomerId,CustomerName,Cellphone,Ucode,DriverName,ComplaintType,ComplaintContent,create_time,create_user,delete_flag)"); sb.AppendLine("values"); sb.AppendLine("(@OrderId ,@CustomerId,@CustomerName,@Cellphone,@Ucode,@DriverName,1,@ComplaintContent,getdate(),@create_user,0)"); db.GetSqlStringCommand(sb.ToString()); db.AddInParameter("@OrderId",System.Data.DbType.String,complain.OrderId); db.AddInParameter("@CustomerId", System.Data.DbType.String, complain.CustomerId); db.AddInParameter("@CustomerName", System.Data.DbType.String, complain.CustomerName); db.AddInParameter("@Cellphone", System.Data.DbType.String, complain.Cellphone); db.AddInParameter("@Ucode", System.Data.DbType.String, complain.Ucode); db.AddInParameter("@DriverName", System.Data.DbType.String, complain.DriverName); db.AddInParameter("@ComplaintContent", System.Data.DbType.String, complain.ComplaintContent); db.AddInParameter("@create_user", System.Data.DbType.String, complain.CreateUser); return db.Execute(); }
public bool CreateDistributeOrderStatusChangeLog(DistributeOrderStatusChangeLogEntity model) { try { AdjDBObject adjDbObject = new AdjDBObject(); string sql = "INSERT INTO D_DistributeOrderStatusChangeLog(DistributeOrderId,Status,StatusText,create_time,create_user )VALUES(@DistributeOrderId,@Status,@StatusText,getdate(),@create_user )"; adjDbObject.GetSqlStringCommand(sql); adjDbObject.AddInParameter("@DistributeOrderId", DbType.String, model.DistributeOrderId); adjDbObject.AddInParameter("@Status", DbType.Int32, model.Status); adjDbObject.AddInParameter("@StatusText", DbType.String, model.StatusText); adjDbObject.AddInParameter("@create_user", DbType.String, model.Create_user); adjDbObject.Execute(); return true; } catch (Exception) { return false; } }
/// <summary> /// 是否首次生成订单 /// </summary> /// <param name="phone"></param> /// <returns></returns> public int IsPayinfoFirst(string phone) { int count = 0; try { AdjDBObject adjDbObject = new AdjDBObject(); string sqlCou = "SELECT COUNT(1) as count FROM dbo.D_OrderInfo (nolock) WHERE state=30 AND cellphone=@phone"; adjDbObject.GetSqlStringCommand(sqlCou); adjDbObject.AddInParameter("@phone", DbType.String, phone); using (DataTable dt = adjDbObject.ExecuteDataSet().Tables[0]) { count = int.Parse(dt.Rows[0]["count"].ToString()); } return count; } catch (Exception ex) { return 0; } }
// 1216|sign|UCode|7a31f99279327f8b75506acbf0503973 public string execute(string request) { string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[3].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[1].ToLower()); if (parter != null) { AdjDBObject db = new AdjDBObject(); string sql = "select Ucode, DriverName,'" + ConfigHelper.ImagePath + "/' + Photo Photo,DrivedYears,DriveCount,NewGrade,SatisfactionRate from d_driverinfo where UCode = @UCode"; db.GetSqlStringCommand(sql); db.AddInParameter("@UCode", System.Data.DbType.String, req[2]); DataTable dt = db.ExecuteDataSet().Tables[0]; if (dt.Rows.Count > 0) { return JsonConvert.SerializeObject(new { Ucode = dt.Rows[0]["Ucode"].ToString(), DriverName = dt.Rows[0]["DriverName"].ToString(), DrivedYears = dt.Rows[0]["DrivedYears"].ToString(), Photo = dt.Rows[0]["Photo"].ToString(), DriveCount = dt.Rows[0]["DriveCount"].ToString(), NewGrade = dt.Rows[0]["NewGrade"].ToString(), SatisfactionRate = dt.Rows[0]["SatisfactionRate"].ToString() }); } throw new Exception("没有该司机!"); } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
public List<SjComment> GetPingLuns(string ucode) { AdjDBObject adjDbObject = new AdjDBObject(); try { List<SjComment> ret = null; string cmdtext = "SELECT Ucode,Evaluate,CustomerName,Cellphone,Comment,Create_time FROM dbo.D_DriverComment where Status=2 AND Ucode=@ucode ORDER BY create_time DESC"; adjDbObject.GetSqlStringCommand(cmdtext); adjDbObject.AddInParameter("@ucode", DbType.String, ucode); using (DataSet ds = adjDbObject.ExecuteDataSet()) { if (ds.Tables[0].Rows.Count > 0) { ret = GlobalFunction.GetEntityListByTable<SjComment>(ds.Tables[0]); } } return ret; } catch (Exception) { return null; } }
// 1215|sign|orderid|7a31f99279327f8b75506acbf0503973 public string execute(string request) { string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[3].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[1].ToLower()); if (parter != null) { AdjDBObject db = new AdjDBObject(); string sql = "SELECT Id,OrderId,OrderStatus,StatusText,create_time FROM D_OrderStatusChangeLog where OrderId = @OrderId"; db.GetSqlStringCommand(sql); db.AddInParameter("@OrderId",System.Data.DbType.String,req[2]); DataTable dt = db.ExecuteDataSet().Tables[0]; List<OrderHistory> list = new List<OrderHistory>(); for (int i = 0; i < dt.Rows.Count; i++) { list.Add(new OrderHistory() { orderid = dt.Rows[i]["OrderId"].ToString(), OrderStatus = Convert.ToInt32(dt.Rows[i]["OrderStatus"]), StatusText = dt.Rows[i]["StatusText"].ToString(), create_time = Convert.ToDateTime(dt.Rows[i]["create_time"]) }); } return JsonConvert.SerializeObject(list); } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
/// <summary> /// 创建派单明细 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool CreateDistributeOrderDetail(DistributeOrderDetailEntity model) { try { AdjDBObject adjDbObject = new AdjDBObject(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into D_DistributeOrderDetail("); strSql.Append("delete_time,delete_user,DistributeOrderId,Status,Ucode,create_time,create_user,update_time,update_user,delete_flag"); strSql.Append(") values ("); strSql.Append("NULL,NULL,@DistributeOrderId,@Status,@Ucode,GETDATE(),@create_user,NULL,NULL,NULL"); strSql.Append(") "); adjDbObject.GetSqlStringCommand(strSql.ToString()); adjDbObject.AddInParameter("@DistributeOrderId", DbType.String, model.DistributeOrderId); adjDbObject.AddInParameter("@Status", DbType.Int32, model.Status); adjDbObject.AddInParameter("@Ucode", DbType.String, model.Ucode); adjDbObject.AddInParameter("@create_user", DbType.String, model.Create_user); adjDbObject.Execute(); return true; } catch (Exception) { return false; } }
/// <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 ""; } }
public bool UpdateOnDoService(int OnDoService, string ucode) { bool isok = false; string sql = "UPDATE dbo.D_DriverInfo SET OnDOService = @OnDOService WHERE Ucode = @Ucode"; AdjDBObject adjDbObject = new AdjDBObject(); adjDbObject.GetSqlStringCommand(sql); adjDbObject.AddInParameter("@OnDOService", DbType.Int32, OnDoService); adjDbObject.AddInParameter("@Ucode", DbType.String, ucode); int i = adjDbObject.Execute(); if (i != 0) { isok = true; } return isok; }
/// <summary> /// 获取派单编号种子 /// </summary> /// <returns></returns> public int SelectSeqOrder() { AdjDBObject adjDbObject = new AdjDBObject(); try { adjDbObject.GetSqlStringCommand("INSERT INTO D_SeqOrder DEFAULT VALUES SELECT @@IDENTITY"); object obj = adjDbObject.ExecuteScalar(); if (obj != null) return Convert.ToInt32(obj); else return 0; } catch (Exception) { return 0; } }