public Base <object> List(ExpressQuery queryModel) { Meta meta = new Meta(); PageModel <Express> list = new PageModel <Express>(); if (queryModel.flag == "1") { list = ExpressService.List(queryModel, ref meta); } if (queryModel.flag == "2" || queryModel.flag == "3") { //取token值 TokenReponse repository = new TokenReponse(); Token token = repository.First(queryModel.Token); if (token == null) { meta.ErrorCode = ErrorCode.LoginError.GetHashCode().ToString(); meta.ErrorMsg = EnumHelper.GetDescriptionFromEnumValue(ErrorCode.LoginError); } else { queryModel.UserID = token.UserId; list = ExpressService.List(queryModel, ref meta); } } Base <object> response = new Base <object> { Body = list, Meta = meta }; return(response); }
public Base <object> About(string ID) { ExpressQuery queryModel = new ExpressQuery(); queryModel.ID = ID; Meta meta = new Meta(); Base <object> response = new Base <object> { Body = Teage.Common.SerializableHelper.SerializableToString(ExpressService.Query(queryModel, ref meta)), Meta = meta }; return(response); }
//后台列表 public PageModel <Express> HostList(ExpressQuery queryInfo, ref Meta meta) { return(Try(context => { string sql = "SELECT * FROM Express WHERE 1=1 "; List <SqlParameter> paramList = new List <SqlParameter>(); //查询 if (!string.IsNullOrEmpty(queryInfo.ExpressName)) { sql += " AND ExpressName like @vName"; paramList.Add(new SqlParameter("@vName", "%" + queryInfo.ExpressName + "%")); } return context.QuerySql <Express>(sql, queryInfo, paramList.ToArray()); })); }
//查询一条数据 public List <Express> Query(ExpressQuery queryInfo, ref Meta meta) { var model = new List <Express>(); Try(context => { string sql = "SELECT TOP 1 * FROM Express WHERE 1=1 "; List <SqlParameter> paramList = new List <SqlParameter>(); //详情显示 条件 if (!string.IsNullOrEmpty(queryInfo.ID)) { sql += " AND ID like @ID"; paramList.Add(new SqlParameter("@ID", "%" + queryInfo.ID + "%")); } model = context.Database.SqlQuery <Express>(sql, paramList.ToArray()).ToList(); }); return(model); }
//优递列表 public PageModel <Express> List(ExpressQuery queryInfo, ref Meta meta) { return(Try(context => { string sql = "SELECT * FROM Express WHERE 1=1 "; List <SqlParameter> paramList = new List <SqlParameter>(); //查询 if (!string.IsNullOrEmpty(queryInfo.ExpressName)) { sql += " AND ExpressName like @vName"; paramList.Add(new SqlParameter("@vName", "%" + queryInfo.ExpressName + "%")); } //列表显示 条件 if (!string.IsNullOrEmpty(queryInfo.flag)) { if (queryInfo.flag == "1") { sql += " and TypeID=0 "; } else if (queryInfo.flag == "2") { sql += " AND UserID like @UserID"; paramList.Add(new SqlParameter("@UserID", "%" + queryInfo.UserID + "%")); } else if (queryInfo.flag == "3") { sql += " AND HamalUserID like @UserID"; paramList.Add(new SqlParameter("@UserID", "%" + queryInfo.UserID + "%")); } } if (!string.IsNullOrEmpty(queryInfo.ID)) { sql += " AND ID like @ID"; paramList.Add(new SqlParameter("@ID", "%" + queryInfo.ID + "%")); } return context.QuerySql <Express>(sql, queryInfo, paramList.ToArray()); })); }
private void simpleQuery_Click(object sender, EventArgs e) { string shipNum = ""; if (textEdit1.Text != "") { WaitDialogForm waitFrm = new WaitDialogForm(Constants.WAIT_LOAD_DATA); shipNum = textEdit1.Text.ToString(); //ShunfengQuery sn = new ShunfengQuery("023044268555");//(shipNum);023044268555 //ResultInfo back = sn.query(); ResultInfo back = ExpressQuery.Query("ShengTong", "368009597493");//("yuantong", "2221570574");//("ShunFeng", "023044268555");//("ShengTong","368009597493"); addGridviewList(back); waitFrm.Close(); //YuantongEmail email = new YuantongEmail("2221570574"); //ResultInfo yuant = email.query(); } else { XtraMessageBox.Show("请输入物流单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } //YuantongEmail email = new YuantongEmail("2221570574"); //ResultInfo yuant = email.query(); }