public DataSet getActivityList(ReqData <getActivityListEntity> pEntity) { string sql = @" select COUNT(*) as EventVipTickCount,isnull(SUM(case status when 1 then 0 end),0) as StatusCount ,EventID into #Temp_B from EventVipTicket where IsDelete=0 and CustomerId='{0}' group by EventID; select * into #Temp_C from ( select row_number()over( order by btss desc,bt)as ID,* from (select case when DATEDIFF(DD,GETDATE(),BeginTime)>-1 then 1 else 0 end as btss, abs(DATEDIFF(DD,GETDATE(),BeginTime)) as bt,L.EventID as ActivityID, L.Title as ActivityTitle,L.CityID as ActivityCity, Convert(nvarchar(16),L.BeginTime,120) as BeginTime,Convert(nvarchar(16),L.EndTime,120) as EndTime, cast(DATEDIFF(mi,getdate(),L.BeginTime)*1.0/24/60 as decimal(18,5)) as BeginDay, cast(DATEDIFF(mi,getdate(),L.EndTime)*1.0/60/24 as decimal(18,5)) as EndDay,CreateTime ,b.EventVipTickCount as UserCount,b.StatusCount from LEvents as L left join #Temp_B as b on b.EventID=l.EventID where L.CustomerId='{0}' and L.IsDelete=0) as ASBC) as ABCDE where ID>{1} and ID<={2}; drop table #Temp_B; select * from #Temp_C select count(*) as Counts from LEvents where CustomerId='{0}' and IsDelete=0; select v.VIPID,v.VipName,evt.EventID,evt.Status from EventVipTicket as evt inner join Vip as v on v.Status=3 and v.VIPID=evt.VipID and v.IsDelete=0 inner join #Temp_C as c on c.ActivityID=evt.EventID where evt.CustomerId='{0}' and evt.IsDelete=0 order by evt.CreateTime drop table #Temp_C;"; sql = string.Format(sql, pEntity.common.customerId, pEntity.special.pageSize * (pEntity.special.page - 1), pEntity.special.pageSize * (pEntity.special.page)); return(this.SQLHelper.ExecuteDataset(sql)); }
public HttpResponseMessage Create(ReqData req) { ResData res = new ResData(); try { var data = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); //string Content, int Level, string AnswerA, string AnswerB, string AnswerC, string AnswerD, int IsResult string Content = data.Content.ToString(); string Level = data.Level.ToString(); string AnswerA = data.AnswerA.ToString(); string AnswerB = data.AnswerB.ToString(); string AnswerC = data.AnswerC.ToString(); string AnswerD = data.AnswerD.ToString(); string IsResult = data.IsResult.ToString(); int check = QuestionM.Create(Content, Level, AnswerA, AnswerB, AnswerC, AnswerD, IsResult); res.Code = 1; res.Message = "Thành công"; res.Detail = check; res.StatusCode = HttpStatusCode.OK; } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage GetMoney(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string QuestionLevel = Content.QuestionLevel.ToString(); string money = PlayM.GetMoney(QuestionLevel); res.Code = 1; res.Message = "Thành công"; res.Detail = money; res.StatusCode = HttpStatusCode.OK; } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage GetQuestionLevel(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); int Level = int.Parse(Content.Level.ToString()); QuestionM QM = QuestionM.GetQuestionLevel(Level); if (QM.QuestionID > 0) { res.Code = 1; res.Message = "Lấy dữ liệu OK"; res.Detail = QM; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Không có dữ liệu"; res.Detail = QM; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage Support5050(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string QuestionID = Content.QuestionID.ToString(); string support = PlayM.Support5050(QuestionID); res.Code = 1; res.Message = "Thành công"; res.Detail = support; res.StatusCode = HttpStatusCode.OK; } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage GetListHistory(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string AccountID = Content.AccountID.ToString(); List <HistoryM> history = HistoryM.GetListHistory(AccountID); if (history != null && history.Count > 0) { res.Code = 1; res.Message = "Thành công"; res.Detail = history; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Thông thành công"; res.Detail = history; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage Register(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string Fullname = Content["Fullname"].ToString(); string Username = Content["Username"].ToString(); string Password = Content["Password"].ToString(); int RegisRes = AccountM.Register(Fullname, Username, Password); if (RegisRes == 1) { res.Code = 1; res.Message = "Đăng ký thành công"; res.Detail = req.Content; res.StatusCode = HttpStatusCode.OK; } else if (RegisRes == 2) { res.Code = 2; res.Message = "Tên đăng nhập đã tồn tại"; res.Detail = req.Content; res.StatusCode = HttpStatusCode.OK; } else if (RegisRes == 3) { res.Code = 3; res.Message = "Họ và tên không được để trống"; res.Detail = req.Content; res.StatusCode = HttpStatusCode.OK; } else if (RegisRes == 4) { res.Code = 4; res.Message = "Tên đăng nhập không được để trống"; res.Detail = req.Content; res.StatusCode = HttpStatusCode.OK; } else if (RegisRes == 5) { res.Code = 5; res.Message = "Mật khẩu không được để trống"; res.Detail = req.Content; res.StatusCode = HttpStatusCode.OK; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
// GET: WebFunction/Login public ActionResult Index(ReqData <LoginIP> data) { LoginIPService bll_login = new LoginIPService(); data.DataList = bll_login.LoadEntities(data, c => true, c => c.loginTime, false).ToList(); data.PageUrl = Utils.GetUrl(); data.GetPageList(); return(View(data)); }
public ActionResult Index(ReqData <Lang> data) { PageInfo info = new PageInfo(); data.DataList = bll_Lang.LoadEntities(data, c => true, c => c.id, false).ToList(); data.PageUrl = Utils.GetUrl(); data.GetPageList(); return(View(data)); }
// GET: WebFunction/AddCode public ActionResult Index(ReqData <TreeView <DT_DataItemDetail> > data) { DT_DataItemDetailService _DataItemDetailService = new DT_DataItemDetailService(); data.DropList = Utils.BingDrop(_DataItemService.LoadEntities(c => true).ToList(), "Id", "ItemName", data.MsgStr); data.DataList = Utils.GetTree(_DataItemDetailService.LoadEntities(c => true).ToList(), "Id", "ParentId", "0", false); return(View(data)); }
public JsonResult GetCategoryGmktResult(ReqData data) { CommonBiz biz = new CommonBiz(); List<CategoryGmktInfoT> categories = biz.GetGmktCategory(data.Step, data.ParentCode); ReqResult result = new ReqResult(); result.ReturnForm = data.ReturnForm; result.CategoryGmkt = new List<CategoryGmktInfoT>(); result.CategoryGmkt = categories; return Json(result); }
public reqNewsEntity getEventstatsDetailByNewsID(ReqData <getNewsDetailByNewsIDEntity> pEntity) { reqNewsEntity pNewsEntity = new reqNewsEntity(); DataSet ds = this.itemService.getEventstatsDetailByNewsID(pEntity); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { NewsDetailEntity[] entity = DataLoader.LoadFrom <NewsDetailEntity>(ds.Tables[0]); pNewsEntity.News = entity[0]; } return(pNewsEntity); }
/// <summary> /// 根据ID查询视频详细 /// </summary> /// <param name="pEntity"></param> /// <returns></returns> public reqLEventsAlbumEntity GetEventAlbumByAlbumID(ReqData <getLEventsAlbumEntity> pEntity) { reqLEventsAlbumEntity pAlbumEntity = new reqLEventsAlbumEntity(); DataSet ds = this._currentDAO.GetEventAlbumByAlbumID(pEntity); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { LEventsAlbumDetail[] entity = DataLoader.LoadFrom <LEventsAlbumDetail>(ds.Tables[0]); pAlbumEntity.Album = entity[0]; } return(pAlbumEntity); }
public IEnumerable <int> Get() { var data = new ReqData(); var dd = new DateTime(2020, 01, 08); data.ReDate = dd; data.ReNid = "119850540652"; data.CompanyId = 1; var a = new MAppTable(_context); var res = a.SrchAppTableData(data); return(new int[] { res }); }
// التاكد من ان الزبون ليس لديه حجز مسبق ام لا في نفس التاريخ او نفس الشركة public int SrchAppTableData(ReqData dt) { var res = _context.AppTable.Where(s => s.ReNid == dt.ReNid && s.CompanyId == dt.CompanyId || s.ReNid == dt.ReNid && s.ReDate == dt.ReDate); if (res == null) { return(0); } else { return(1); } }
public static void WriteLog(LoggingSessionInfo currentUserInfo, string ifName, ReqData ReqContent, Default.LowerRespData respObj, string specialParams) { try { if (ReqContent == null) { ReqContent = new ReqData(); ReqContent.common = new ReqCommonData(); } SysVisitLogsBLL logService = new SysVisitLogsBLL(currentUserInfo); SysVisitLogsEntity logObj = new SysVisitLogsEntity(); logObj.LogsID = CPOS.Common.Utils.NewGuid(); logObj.Locale = ReqContent.common.locale; logObj.UserID = ReqContent.common.userId; logObj.SessionID = ReqContent.common.sessionId; logObj.Version = ReqContent.common.version; logObj.Plat = ReqContent.common.plat; logObj.DeviceToken = ReqContent.common.deviceToken; logObj.OSInfo = ReqContent.common.osInfo; logObj.ChannelId = ReqContent.common.channel; logObj.WeiXinId = ReqContent.common.weiXinId; logObj.OpenId = ReqContent.common.openId; logObj.LogType = ifName; logObj.ResultCode = respObj.code; logObj.ResultDescription = respObj.description; logObj.SpecialParams = specialParams; logObj.IpAddress = GetClientIP(); if (logObj.UserID == null) { logObj.UserID = currentUserInfo.UserID; } if (logObj.UserID == null) { logObj.UserID = "1"; } logService.Create(logObj); } catch (Exception ex) { respObj.exception = "日志写入错误: ";//+ ex.ToString() Loggers.Debug(new DebugLogInfo() { Message = ifName + " " + respObj.exception }); } }
public DataSet getNewsDetailByNewsID(ReqData <getNewsDetailByNewsIDEntity> pEntity) { string sql = @"select L.NewsId,L.NewsType,L.NewsTitle,L.NewsSubTitle,L.Content, convert(nvarchar(10),L.PublishTime,120)as PublishTime,L.ContentUrl, L.ImageUrl,L.ThumbnailImageUrl,L.Author,L.BrowseCount,L.PraiseCount,L.CollCount,nc.NewsCountID from LNews as L left join NewsCount as nc on nc.NewsID=l.NewsID and nc.IsDelete=l.IsDelete and nc.VipID='{1}' and nc.CountType='3' where l.NewsId='{0}'; update LNews set BrowseCount=isnull(BrowseCount,0)+1 where NewsID='{0}';"; sql = string.Format(sql, pEntity.special.NewsID, pEntity.common.userId); return(this.SQLHelper.ExecuteDataset(sql)); }
public async Task <JsonResult> FetchData(ReqData req) { var appModule = await _appModuleRepository.Get(req.AppId); var docTypeService = new DocumentTypeServices(_appModuleRepository); ObjectId documentTypeId; ObjectId.TryParse(req.DocumentTypeId, out documentTypeId); var documentName = await docTypeService.FindDocumentTypeName(req.AppId, documentTypeId); var rootDocumentName = documentName; var org = await _organisationRepository.Get(appModule.OrganisationId); var dataService = new DataService(ConfigurationManager.ConnectionStrings["MongoDB"].ConnectionString, org.Id.ToString(), documentName); //var data = await dataService.Get(dataId, ""); BsonDocument data; if (!string.IsNullOrEmpty(req.SubDocumentTypeId)) { ObjectId subDocumentTypeId; ObjectId.TryParse(req.SubDocumentTypeId, out subDocumentTypeId); documentName = await docTypeService.FindDocumentTypeName(req.AppId, subDocumentTypeId); var subDocumentHierarchy = await docTypeService.FindSubDocumentHierarchy(req.AppId, documentTypeId, documentName, rootDocumentName); data = await dataService.Get(req.DataId, subDocumentHierarchy); } else { data = await dataService.Get(req.DataId); } var jsonWriterSettings = new JsonWriterSettings { OutputMode = JsonOutputMode.Strict }; var result = new JsonGenericResult { IsSuccess = true, Result = data.ToJson(jsonWriterSettings) }; return(Json(result)); }
/// <summary> /// 根据ID查询视频详细 /// </summary> /// <param name="pEntity"></param> /// <returns></returns> public DataSet GetEventAlbumByAlbumID(ReqData <getLEventsAlbumEntity> pEntity) { string pSql = @"select AlbumId,ImageUrl,Title,Intro,Description as VideoUrl,es.BrowseNum as BrowseCount ,es.PraiseNum as PraiseCount,es.BookmarkNum as BookmarkCount,es.ShareNum as ShareCount from LEventsAlbum as Lea left join EventStats as es on es.ObjectID=lea.AlbumId and es.IsDelete=lea.IsDelete where Lea.IsDelete=0 and Lea.AlbumId='{0}' update EventStats set BrowseNum=isnull(BrowseNum,0)+1 where ObjectID='{0}' insert into EventStatsDetail(DetailID,ObjectID,ObjectType,CountType,VipID,CustomerID,CreateBy,IsDelete) values(newID(),'{0}','1','1','{1}','{2}','{1}','0')" ; pSql = string.Format(pSql, pEntity.special.AlbumID, pEntity.common.userId, CurrentUserInfo.ClientID); return(this.SQLHelper.ExecuteDataset(pSql)); }
public List <Response> GetByDate([FromBody] ReqData data) { List <Response> resp = new List <Response>(); using (SqlConnection conn = new SqlConnection(Settings.Default.Connection)) using (SqlCommand comm = new SqlCommand("dbo.GetByDate", conn) { CommandType = System.Data.CommandType.StoredProcedure }) { comm.Parameters.Add( new SqlParameter { ParameterName = "@From", SqlDbType = System.Data.SqlDbType.Date, Value = data.From }); comm.Parameters.Add( new SqlParameter { ParameterName = "@Till", SqlDbType = System.Data.SqlDbType.Date, Value = data.Till }); conn.Open(); using (SqlDataReader reader = comm.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { resp.Add(new Response { Id = reader[0].ToString(), Payment = $"{reader[1].ToString()} {reader[2].ToString()}", Status = reader[3].ToString() } ); } } } } return(resp); }
/// <summary> /// 默认首页 /// </summary> /// <param name="data"></param> /// <returns></returns> public ActionResult Default(ReqData <string> data) { Dictionary <int, string> dic = new Dictionary <int, string>(); // 添加下拉框 foreach (var item in Enum.GetValues(typeof(Icon))) { dic.Add((int)item, item.ToString()); } ViewBag.icon = Utils.BingDrop(dic, data.Icon ?? -1, false); ViewBag.MsgStr = data.MsgStr; LoginInfo info = Utils.GetLoginInfo(); ViewBag.m = Request.ServerVariables; return(View(info)); }
/// <summary> /// 装载数据节点 /// </summary> /// <returns></returns> public DistributeDataNodeManagerParams GetDistributeDataNodeManagerParams() { DistributeDataNodeManagerParams distManagerParam = new DistributeDataNodeManagerParams(); //分布式管理参数 //调用节点中心服务获取数据节点 DataRow drServ = this.GetServiceConfigOne("framenodesecu", "1.0", "normal", "frameNode", this.serviceConfig); string FramenodeSecurity = drServ["url_addr"].ToString().TrimStart('/') + "/" + drServ["servcodename"].ToString().TrimStart('/'); this.reqdata = new ReqData(); this.reqdata.reqdata = "1"; string resdatanode = DynamicInvokeWCF.Create <IFrameNodeSecurity>(FramenodeSecurity).GetDataNodeCollection(json.Serialize(this.reqdata)); this.resdata = json.Deserialize <RespData>(resdatanode); if (this.resdata.respflag == "1") { distManagerParam = json.Deserialize <DistributeDataNodeManagerParams>(this.resdata.respdata); } return(distManagerParam); }
public DataSet getNewsList(ReqData <getNewsListEntity> pEntity) { string pWhere = ""; string sql = @"select NewsId,NewsType,NewsTitle,NewsSubTitle,'' as Content,convert(nvarchar(10),PublishTime,120)as PublishTime,ContentUrl, ImageUrl,ThumbnailImageUrl,Author,[BrowseCount],[PraiseCount],CollCount from ( select row_number()over( order by CreateTime desc)as ID,* from (select NewsId,NewsType,NewsTitle,NewsSubTitle,'' as Content,convert(nvarchar(10),PublishTime,120)as PublishTime,ContentUrl, ImageUrl,ThumbnailImageUrl,Author,CreateTime,[BrowseCount],[PraiseCount],CollCount from LNews where CustomerId='{0}' and IsDelete=0 {3}) as ASBC) as aaa where ID>{1} and ID<={2}; select count(*) as TableCount from LNews where CustomerId='{0}' and IsDelete=0 {3}"; if (!string.IsNullOrEmpty(pEntity.special.NewsType)) { pWhere = "and NewsType= '" + pEntity.special.NewsType + "'"; } sql = string.Format(sql, pEntity.common.customerId, pEntity.special.pageSize * (pEntity.special.page - 1), pEntity.special.pageSize * (pEntity.special.page), pWhere); return(this.SQLHelper.ExecuteDataset(sql)); }
public DataSet getTopList(ReqData <getTopListEntity> pEntity) { string sql = ""; string pWhere = ""; if (pEntity.special.Type == 1) { sql = @"select Top {0} NewsId,NewsTitle,1 as Type,NewsType,ImageUrl,Convert(nvarchar(20),PublishTime,120) as PublishTime,ThumbnailImageUrl,CreateTime from LNews where CustomerId='{1}' and IsDelete=0 and IsTop=1 {2} order by CreateTime desc"; if (!string.IsNullOrEmpty(pEntity.special.NewsType) && pEntity.special.NewsType != "0") { pWhere = "and NewsType='" + pEntity.special.NewsType + "'"; } } else if (pEntity.special.Type == 2) { pWhere = ""; sql = @"select top {0} EventID as NewsId,Title as NewsTitle,2 as Type,'0' as NewsType,ImageUrl, Convert(nvarchar(20),BeginTime,120) as PublishTime,ImageUrl as ThumbnailImageUrl,CreateTime from LEvents where CustomerId='{1}' and IsDelete=0 and IsTop=1 {2} order by CreateTime desc "; } else { sql = @"select top {0} * from ( select NewsId,NewsTitle,1 as Type,NewsType,ImageUrl,Convert(nvarchar(20),PublishTime,120) as PublishTime,ThumbnailImageUrl,CreateTime from LNews where CustomerId='{1}' and IsDelete=0 and IsDefault=1 {2} union all select EventID as NewsId,Title as NewsTitle,2 as Type ,'0' as NewsType,ImageUrl, Convert(nvarchar(20),BeginTime,120) as PublishTime,ImageUrl as ThumbnailImageUrl,CreateTime from LEvents where CustomerId='{1}' and IsDelete=0 and IsDefault=1 ) as abcd order by CreateTime desc"; if (!string.IsNullOrEmpty(pEntity.special.NewsType) && pEntity.special.NewsType != "0") { pWhere = "and NewsType='" + pEntity.special.NewsType + "'"; } } sql = string.Format(sql, pEntity.special.pageSize, pEntity.common.customerId, pWhere); return(this.SQLHelper.ExecuteDataset(sql)); }
public string getUserByLogin(ReqData <getUserByLoginEntity> pEntity) { string sql = ""; if (pEntity.special.IsLogin) { sql = @"declare @VipLoginID nvarchar(100) select @VipLoginID=VIPID from Vip where (VipName='{0}' or Email='{0}' or Phone='{0}') and VipPasswrod='{1}' and ClientID='{2}' and IsDelete=0; if @VipLoginID<>'' begin select @VipLoginID end else begin select '-1' end"; sql = string.Format(sql, pEntity.special.LoginName, pEntity.special.PassWord, pEntity.common.customerId); } else { sql = @"declare @VipID nvarchar(100) select @VipID=VIPID from Vip where VipName='{0}' and ClientID='{2}' and IsDelete=0; if @VipID<>'' begin select '-2' end else begin set @VipID=newID() insert VIP(vipID,VipName,VipPasswrod,ClientID,IsDelete) values(@VipID,'{0}','{1}','{2}',0) insert VIPRoleMapping(RoleID,VipID) values('{3}',@VipID); select @VipID end"; sql = string.Format(sql, pEntity.special.LoginName, pEntity.special.PassWord, pEntity.common.customerId, pEntity.common.roleid); } return(this.SQLHelper.ExecuteScalar(sql).ToString()); }
public DataSet getActivityByActivityID(ReqData <getActivityByActivityIDEntity> pEntity) { string sql = @"SELECT EventID as ActivityID,Title as ActivityTitle,Organizer as ActivityCompany, BeginTime,EndTime,cast(DATEDIFF(mi,getdate(),BeginTime)*1.0/24/60 as decimal(18,5)) as BeginDay, cast(DATEDIFF(mi,getdate(),EndTime)*1.0/60/24 as decimal(18,5)) as EndDay,Address as ActivityAddr, Content as ActivityLinker,PhoneNumber as ActivityPhone,'' as ActivityUp,Description as ActivityContent FROM LEvents where EventID='{0}'; select TicketID,COUNT(ticketID) as TicketCount into #Temp_A from EventVipTicket where EventID='{0}' and IsDelete=0 group by ticketID ; select convert(nvarchar(50),t.TicketID) as TicketID,t.TicketName,t.TicketRemark,t.TicketPrice,t.TicketNum,t.TicketSort,(t.TicketNum-isnull(evt.TicketCount,0)) as TicketMore from Ticket as t left join #Temp_A as evt on evt.TicketID=t.TicketID where t.EventID='{0}' and t.IsDelete=0; drop table #Temp_A select COUNT(*) as EventVipTickCount,isnull(SUM(case status when 1 then 0 end),0) as StatusCount from EventVipTicket where EventId='{0}' and IsDelete=0; select TicketID from EventVipTicket where EventId='{0}' and IsDelete=0 and SginVipID='{1}';"; sql = string.Format(sql, pEntity.special.ActivityID, pEntity.common.userId); return(this.SQLHelper.ExecuteDataset(sql)); }
public HttpResponseMessage UpdateHistory(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string HistoryID = Content.HistoryID.ToString(); string AccountID = Content.AccountID.ToString(); int Level = int.Parse(Content.Level.ToString()); string Total = Content.Total.ToString(); int Type = int.Parse(Content.Type.ToString()); int historyM = HistoryM.UpdateHistory(HistoryID, AccountID, Level, Total, Type); if (historyM > 0) { res.Code = 1; res.Message = "Cập nhật history thành công"; res.Detail = historyM; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Cập nhật history không thành công"; res.Detail = historyM; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage UpdateHistoryDetail(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string DetailID = Content.DetailID.ToString(); string HistoryID = Content.HistoryID.ToString(); string QuestionID = Content.QuestionID.ToString(); string AnswerLevel = Content.AnswerLevel.ToString(); int historyM = HistoryM.UpdateHistoryDetail(DetailID, HistoryID, QuestionID, AnswerLevel); if (historyM > 0) { res.Code = 1; res.Message = "Cập nhật history detail thành công"; res.Detail = historyM; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Cập nhật history không detail thành công"; res.Detail = historyM; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage Login(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string Username = Content.Username.ToString(); string Password = Content.Password.ToString(); AccountM AM = AccountM.Login(Username, Password); if (AM.AccountID > 0) { res.Code = 1; res.Message = "Đăng nhập thành công"; res.Detail = AM; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Tên đăng nhập hoặc mật khẩu không đúng"; res.Detail = AM; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
/// <summary> /// 发送http请求获取返回结果 /// </summary> /// <param name="url"></param> /// <param name="req"></param> /// <param name="reqType">post get</param> /// <param name="reqMethord"></param> /// <param name="token"></param> /// <returns></returns> public RespData RequestHttp(string url, string req, string reqType, string reqMethord, string token) { JavaScriptSerializer json = new JavaScriptSerializer(); string resstr = @""; Req reqTemp = new Req(); ReqData resqq = new ReqData(); resqq.reqdata = req; resqq.reqtype = reqType; reqTemp.req = json.Serialize(resqq); #region 原生态方式 var request = HttpWebRequest.Create(url) as HttpWebRequest; request.ContentType = "application/json"; request.Method = reqMethord.ToUpper(); request.Timeout = 60000; request.ReadWriteTimeout = request.Timeout; request.Headers.Add("token", token); byte[] sendData = Encoding.UTF8.GetBytes(json.Serialize(reqTemp)); if (sendData != null && sendData.Length > 0) { using (var streamRequst = request.GetRequestStream()) { streamRequst.Write(sendData, 0, sendData.Length); } } else { request.ContentLength = 0; } try { var response = request.GetResponse(); using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) { resstr = reader.ReadToEnd().TrimStart("\u005C\u0022".ToCharArray()).TrimEnd("\u005C\u0022".ToCharArray()).Replace("\\", ""); reader.Close(); } } catch (Exception exs) { throw exs; } #endregion #region webclient方式 //using (System.Net.WebClient wc = new System.Net.WebClient()) //{ // wc.Headers.Add("Content-Type", "application/json"); // wc.Headers.Add("token", token); // if (reqMethord.ToUpper() == "POST") // { // Req reqTemp = new Req(); // ReqData resqq = new ReqData(); // resqq.reqdata = req; // resqq.reqtype = reqType; // reqTemp.req = json.Serialize(resqq); // byte[] sendData = Encoding.UTF8.GetBytes(json.Serialize(reqTemp)); // wc.Headers.Add("ContentLength", sendData.Length.ToString()); // byte[] recData = wc.UploadData(url, reqMethord.ToUpper(), sendData); // resstr = Encoding.UTF8.GetString(recData).TrimStart("\u005C\u0022".ToCharArray()).TrimEnd("\u005C\u0022".ToCharArray()).Replace("\\", "");; // } // else // { // resstr = wc.DownloadString(url); // } //} #endregion return(json.Deserialize <RespData>(resstr)); }
// GET: WebFunction/Crawler public ActionResult Index(ReqData <News> data) { return(View(data)); }
public JsonResult SetCreateGepItem(ReqData dataList) { if (dataList == null) return Json(false); MemberContext member = ViewBag.memberContext; string[] ItemNo = dataList.ArrayNo.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] ItemImage = dataList.ArrayImage.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (ItemNo.Length != ItemImage.Length) return Json(false); List<GepItemsData> reqItem = new List<GepItemsData>(); for (int i = 0; i < ItemNo.Length; i++) { GepItemsData item = new GepItemsData(); item.img = ItemImage[i]; item.src_info = new src_info(); item.src_info.no = ItemNo[i]; reqItem.Add(item); } string msg = ""; try { msg = new GmarketItemBiz().SetGEPItems(reqItem, member.LoginID); } catch { msg = "알 수 없는 오류로 작업에 실패하였습니다."; } var result = new { result_msg = msg }; return Json(result); }