public async Task <ActionResult <InfoResult <AcStaffDtos> > > AddStaff(AcStaffDtos acStaffDtos) { var NewDepartment = (await _IAcDepartmentService.Search(u => u.Name == acStaffDtos.DeparmentName)).FirstOrDefault(); acStaffDtos.DepartmentId = NewDepartment.Id; var staffList = await _IAcStaffService.Search(t => true); int max = 0; foreach (var item in staffList) { if (item.Id > max) { max = item.Id; } } acStaffDtos.Id = max + 1; InfoResult <AcStaffDtos> messageModel = new InfoResult <AcStaffDtos>(); var data = await _IAcStaffService.Add(_mapper.Map <AcStaff>(acStaffDtos)); if (data > 0) { messageModel.Msg = "添加成功!"; messageModel.Code = 200; messageModel.Success = true; } else { messageModel.Msg = "添加失败!"; messageModel.Code = 400; messageModel.Success = false; } return(Ok(messageModel)); }
public async Task <ActionResult <InfoResult <AcDeparmentDtos> > > Adddepartment(AcDeparmentDtos acDeparmentDtos) { var departmentList = await _IAcDepartmentService.Search(t => true); int max = 0; foreach (var item in departmentList) { if (item.Id > max) { max = item.Id; } } acDeparmentDtos.Id = max + 1; InfoResult <AcDeparmentDtos> messageModel = new InfoResult <AcDeparmentDtos>(); var data = await _IAcDepartmentService.Add(_IMapper.Map <AcDepartment>(acDeparmentDtos)); if (data > 0) { messageModel.Msg = "添加成功!"; messageModel.Code = 200; messageModel.Success = true; } else { messageModel.Msg = "添加失败!"; messageModel.Code = 400; messageModel.Success = false; } return(Ok(messageModel)); }
public async Task <ActionResult <InfoResult <string> > > DeleteStaff(AcStaffDtos acStaffDtos) { var NewStaff = (await _IAcStaffService.Search(u => u.Id == acStaffDtos.Id)).FirstOrDefault(); InfoResult <AcStaffDtos> messageModel = new InfoResult <AcStaffDtos>(); if (NewStaff != null) { if (NewStaff.Status == 0) { messageModel.Msg = "该员工已处于离职状态"; return(Ok(messageModel)); } else { //将员工状态修改为离职 NewStaff.Status = 0; var data = (await _IAcStaffService.Search(t => true)).ToList(); var data2 = _mapper.Map <List <AcStaffDtos> >(data); foreach (var item in data2) { if (item.Status == 0) { item.StatusStr = "离职"; } } return(await _IAcStaffService.Edit(NewStaff) > 0 ? new InfoResult <string>("修改成功!") : new InfoResult <string>("修改失败!")); } } return(Ok(messageModel)); }
public async Task <ActionResult <InfoResult <AcUserinfo> > > Adduser(AcUserInfoManageDtos acUserinfo) { var userList = await _IAcUserinfoService.Search(t => true); int max = 0; foreach (var item in userList) { if (item.Id > max) { max = item.Id; } } acUserinfo.Id = max + 1; acUserinfo.Status = 1; InfoResult <AcUserinfo> messageModel = new InfoResult <AcUserinfo>(); var data = await _IAcUserinfoService.Add(_mapper.Map <AcUserinfo>(acUserinfo)); if (data > 0) { messageModel.Msg = "添加成功!"; messageModel.Code = 200; messageModel.Success = true; } else { messageModel.Msg = "添加失败!"; messageModel.Code = 400; messageModel.Success = false; } return(Ok(messageModel)); }
private InfoResult FinishResolve(InfoResult r, int?userId, bool?autowatch) { if (r.File == null) { r.Status = HttpStatusCode.NotFound; r.StatusDescription = "Video Not Found"; return(r); } if (userId.HasValue && autowatch.HasValue && userId.Value != 0) { r.User = Repo.Instance.JMMUser.GetByID(userId.Value); if (r.User == null) { r.Status = HttpStatusCode.NotFound; r.StatusDescription = "User Not Found"; return(r); } } r.Mime = r.File.ContentType; if (string.IsNullOrEmpty(r.Mime) || r.Mime.Equals("application/octet-stream", StringComparison.InvariantCultureIgnoreCase)) { r.Mime = MimeTypes.GetMimeType(r.File.FullName); } r.Status = HttpStatusCode.OK; return(r); }
public async Task <ActionResult <InfoResult <string> > > DeleteAccount(AcUserInfoManageDtos acUserInfoDtos) { var NewAccount = (await _IAcUserinfoService.Search(u => u.Id == acUserInfoDtos.Id)).FirstOrDefault(); InfoResult <AcUserInfoManageDtos> messageModel = new InfoResult <AcUserInfoManageDtos>(); if (NewAccount != null) { if (NewAccount.Status == 0) { messageModel.Msg = "该账户已处于注销状态"; return(Ok(messageModel)); } else { //将账户状态修改为冻结 NewAccount.Status = 0; var data = (await _IAcUserinfoService.Search(t => true)).ToList(); var data2 = _mapper.Map <List <AcUserInfoManageDtos> >(data); foreach (var item in data2) { if (item.Status == 0) { item.Statustr = "冻结"; } } return(await _IAcUserinfoService.Edit(NewAccount) > 0 ? new InfoResult <string>("注销成功!") : new InfoResult <string>("注销失败!")); } } return(Ok(messageModel)); }
public async Task <ActionResult <InfoResult <AcNoticeDtos> > > Addnotice(AcNoticeDtos acNoticeDtos) { var noticeList = await _IAcNoticeService.Search(t => true); int max = 0; foreach (var item in noticeList) { if (item.Id > max) { max = item.Id; } } acNoticeDtos.Id = max + 1; acNoticeDtos.Createdate = DateTime.Now.ToString(); InfoResult <AcNoticeDtos> messageModel = new InfoResult <AcNoticeDtos>(); var data = await _IAcNoticeService.Add(_mapper.Map <AcNotice>(acNoticeDtos)); if (data > 0) { messageModel.Msg = "添加成功!"; messageModel.Code = 200; messageModel.Success = true; } else { messageModel.Msg = "添加失败!"; messageModel.Code = 400; messageModel.Success = false; } return(Ok(messageModel)); }
private InfoResult parseInfoResult(string str) { object jsonParsed = MiniJSON.Json.Deserialize(str); if (jsonParsed != null) { Hashtable jsonMap = jsonParsed as Hashtable; InfoResult data = new InfoResult(); if (jsonMap.ContainsKey("pID")) { data.pID = int.Parse(jsonMap["pID"].ToString()); } if (jsonMap.ContainsKey("channelID")) { data.channelID = int.Parse(jsonMap["channelID"].ToString()); } if (jsonMap.ContainsKey("appID")) { data.appID = int.Parse(jsonMap["appID"].ToString()); } return(data); } return(null); }
public async Task <ActionResult <IEnumerable <PrProductStockDtos> > > DeleteProductinfo(List <PrProductStockDtos> delList) { int data = 0; InfoResult <PrProductStockDtos> messageModel = new InfoResult <PrProductStockDtos>(); foreach (var item in delList) { try { data = await _IPrProductService.Delete(_mapper.Map <PrProduct>(item)); } catch { messageModel.Success = false; messageModel.Code = 201; messageModel.Msg = "删除失败!"; return(Ok(messageModel)); } } if (data > 0) { messageModel.Code = 400; messageModel.Success = true; messageModel.Msg = "删除成功"; } else { messageModel.Code = 400; messageModel.Success = false; messageModel.Msg = "删除失败!"; } return(Ok(messageModel)); }
private InfoResult ResolveVideoLocal(int videolocalid, int?userId, bool?autowatch) { try { InfoResult r = new InfoResult(); SVR_VideoLocal loc = Repo.Instance.VideoLocal.GetByID(videolocalid); if (loc == null) { r.Status = HttpStatusCode.NotFound; r.StatusDescription = "Video Not Found"; return(r); } r.VideoLocal = loc; r.File = loc.GetBestFileLink(); return(FinishResolve(r, userId, autowatch)); } catch (Exception e) { logger.Error("An error occurred while serving a file: " + e); var resp = new InfoResult(); resp.Status = HttpStatusCode.InternalServerError; resp.StatusDescription = e.Message; return(resp); } }
public async Task <ActionResult <InfoResult <AcRolePermission> > > EdRolePermission(int role, string permissios) { int[] permissio = JsonConvert.DeserializeObject <int[]>(permissios); var cusList = await _IAcRolePermissionService.Search(t => true); int max = 0; foreach (var item in cusList) { if (item.Id > max) { max = item.Id; } } int Id = max + 1; int d = 0; int result = 0; List <int> newArr = new List <int>(); foreach (var item in permissio) { if (newArr.IndexOf(item) == -1) { newArr.Add(item); } } var data1 = (await _IAcRolePermissionService.Search(t => t.RoleId == role)).ToList(); foreach (var item in data1) { d += await _IAcRolePermissionService.Delete(item); } foreach (var item in newArr) { AcRolePermission acRolePermission = new AcRolePermission(); acRolePermission.Id = Id; acRolePermission.RoleId = role; acRolePermission.PermissionId = item; result = await _IAcRolePermissionService.Add(acRolePermission); Id += 1; } InfoResult <AcRolePermission> messageModel = new InfoResult <AcRolePermission>(); if (result > 0) { messageModel.Msg = "授权成功!"; messageModel.Code = 400; messageModel.Success = true; } else { messageModel.Msg = "授权失败!"; messageModel.Code = 201; messageModel.Success = false; } return(Ok(messageModel)); }
private InfoResult ResolveFilename(string filenamebase64, int?userId, bool?autowatch) { InfoResult r = new InfoResult(); string fullname = Base64DecodeUrl(filenamebase64); r.VideoLocal = null; r.File = SVR_VideoLocal.ResolveFile(fullname); return(FinishResolve(r, userId, autowatch)); }
public Stream StreamVideo(int videolocalid, int?userId, bool?autowatch, string fakename) { InfoResult r = ResolveVideoLocal(videolocalid, userId, autowatch); if (r.Status != HttpStatusCode.OK && r.Status != HttpStatusCode.PartialContent) { return(new StreamWithResponse(r.Status, r.StatusDescription)); } return(StreamFromIFile(r, autowatch)); }
public Stream StreamVideoFromFilename(string base64filename, int?userId, bool?autowatch, string fakename) { InfoResult r = ResolveFilename(base64filename, userId, autowatch); if (r.Status != HttpStatusCode.OK && r.Status != HttpStatusCode.PartialContent) { return(new StreamWithResponse(r.Status, r.StatusDescription)); } return(StreamFromIFile(r, autowatch)); }
public async Task <ActionResult <InfoResult <string> > > Updatenotice(AcNoticeDtos acNoticeDtos) { var NewNotice = (await _IAcNoticeService.Search(u => u.Id == acNoticeDtos.Id)).FirstOrDefault(); InfoResult <AcNoticeDtos> messageModel = new InfoResult <AcNoticeDtos>(); if (NewNotice != null) { NewNotice.Title = acNoticeDtos.Title; NewNotice.Detail = acNoticeDtos.Detail; return(await _IAcNoticeService.Edit(NewNotice) > 0 ? new InfoResult <string>("修改成功!") : new InfoResult <string>("修改失败!")); } return(Ok(messageModel)); }
public async Task <ActionResult <InfoResult <string> > > Updatedepartment(AcDeparmentDtos acDeparmentDtos) { var NewDepartment = (await _IAcDepartmentService.Search(u => u.Id == acDeparmentDtos.Id)).FirstOrDefault(); InfoResult <AcDeparmentDtos> messageModel = new InfoResult <AcDeparmentDtos>(); if (NewDepartment != null) { NewDepartment.Name = acDeparmentDtos.Name; NewDepartment.Remark = acDeparmentDtos.remark; return(await _IAcDepartmentService.Edit(NewDepartment) > 0 ? new InfoResult <string>("修改成功!") : new InfoResult <string>("修改失败!")); } return(Ok(messageModel)); }
private void OnGetSDKInfo(InfoResult info) { CenterServerManager.Instance.AppID = info.appID; CenterServerManager.Instance.ChannelID = info.channelID; CenterServerManager.Instance.Channel_id = info.channelID; // 互冠的pid与appid保持一致 这里使用logoName来判断 CenterServerManager.Instance.Pid = User_Config.logoName.Equals("hg_jdjh") ? info.appID : info.pID; CenterServerManager.Instance.GetCdnData(GameManager.localVersion.ToString(), (version, updateUrl) => { Debug.Log(string.Format("cdn version: {0}", version)); string[] temps = version.Split(':'); CheckVersion(temps[0]); }); }
public void OnGetSDKInfo(string jsonData) { Debug.Log("Callback->OnGetSDKInfo"); InfoResult data = parseInfoResult(jsonData); if (data == null) { Debug.Log("The data parse error." + jsonData); return; } if (SDKInterface.Instance.OnGetSDKInfo != null) { SDKInterface.Instance.OnGetSDKInfo.Invoke(data); } }
private InfoResult ResolveVideoLocal(int videolocalid, int?userId, bool?autowatch) { InfoResult r = new InfoResult(); SVR_VideoLocal loc = RepoFactory.VideoLocal.GetByID(videolocalid); if (loc == null) { r.Status = HttpStatusCode.BadRequest; r.StatusDescription = "Video Not Found"; return(r); } r.VideoLocal = loc; r.File = loc.GetBestFileLink(); return(FinishResolve(r, userId, autowatch)); }
public Task <ApiResult <RouteDataResult> > GetRoutes() { var apiResult = new ApiResult <RouteDataResult>(); var data = new InfoResult(); data.Userid = Guid.NewGuid().ToString(); data.UserName = "******"; data.Mobile = "guojiaqiu"; data.Email = "15810803044"; data.Roles = new string[] { "admin" }; return(Task.FromResult(apiResult)); }
public object InfoVideoFromFilename(string base64filename, int?userId, bool?autowatch, string fakename) { InfoResult r = ResolveFilename(base64filename, userId, autowatch); if (r.Status != HttpStatusCode.OK && r.Status != HttpStatusCode.PartialContent) { return(StatusCode((int)r.Status, r.StatusDescription)); } Response.Headers.Add("Server", SERVER_VERSION); Response.Headers.Add("Accept-Ranges", "bytes"); Response.Headers.Add("Content-Range", "bytes 0-" + (r.File.Size - 1) + "/" + r.File.Size); Response.ContentType = r.Mime; Response.ContentLength = r.File.Size; Response.StatusCode = (int)r.Status; return(Ok()); }
public Stream InfoVideoFromFilename(string base64filename, int?userId, bool?autowatch, string fakename) { InfoResult r = ResolveFilename(base64filename, userId, autowatch); StreamWithResponse s = new StreamWithResponse(r.Status, r.StatusDescription); if (r.Status != HttpStatusCode.OK && r.Status != HttpStatusCode.PartialContent) { return(s); } s.Headers.Add("Server", ServerVersion); s.Headers.Add("Accept-Ranges", "bytes"); s.Headers.Add("Content-Range", "bytes 0-" + (r.File.Size - 1) + "/" + r.File.Size); s.ContentType = r.Mime; s.ContentLength = r.File.Size; return(s); }
static int get_appID(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); InfoResult obj = (InfoResult)o; int ret = obj.appID; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index appID on a nil value")); } }
static int set_pID(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); InfoResult obj = (InfoResult)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.pID = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index pID on a nil value")); } }
public RocketChatConnection(IRestClient restClient) { Client = restClient; var request = new RestRequest("api/v1/info", Method.GET) { RequestFormat = DataFormat.Json }; var response = Client.Execute <RequestResult <InfoResult> >(request); if (!response.IsSuccessful) { throw new Exception("Response is not successful"); } Info = response.Data.Info; }
public async Task <ActionResult> Info(string id) { InfoResult infoResult = imageService.GetInfo(id); if (infoResult.Status == "not found") { return(NotFound()); } if (infoResult.Status == "ok") { return(Json(infoResult.ImageInfo)); } else { return(BadRequest(infoResult.Status)); } }
public async Task <ActionResult <InfoResult <string> > > UpdateUser(AcUserInfoManageDtos acUserInfoDtos) { var NewUser = (await _IAcUserinfoService.Search(u => u.Id == acUserInfoDtos.Id)).FirstOrDefault(); InfoResult <AcUserInfoManageDtos> messa1geModel = new InfoResult <AcUserInfoManageDtos>(); if (NewUser != null) { NewUser.Account = acUserInfoDtos.Account; NewUser.Id = acUserInfoDtos.Id; NewUser.Pwd = acUserInfoDtos.Pwd; NewUser.RoleId = acUserInfoDtos.RoleId; NewUser.StaffId = acUserInfoDtos.StaffId; NewUser.Status = acUserInfoDtos.Status; return(await _IAcUserinfoService.Edit(NewUser) > 0 ? new InfoResult <string>("修改成功!") : new InfoResult <string>("修改失败!")); } return(Ok(messa1geModel)); }
public async Task <ActionResult <InfoResult <AcUserinfo> > > EdUserInfo(String userInfo) { AcUserInfoDtos permissio = JsonConvert.DeserializeObject <AcUserInfoDtos>(userInfo); var resert = _IMapper.Map <AcUserinfo>(permissio); var data = await _IAcUserinfoService.Edit(resert); InfoResult <AcUserinfo> messageModel = new InfoResult <AcUserinfo>(); if (data > 0) { messageModel.Msg = "授权成功!"; messageModel.Code = 400; messageModel.Success = true; } else { messageModel.Msg = "授权失败!"; messageModel.Code = 201; messageModel.Success = false; } return(Ok(messageModel)); }
public async Task <ActionResult <InfoResult <string> > > UpdateStaff(AcStaffDtos acStaffDtos) { var NewStaff = (await _IAcStaffService.Search(u => u.Id == acStaffDtos.Id)).FirstOrDefault(); InfoResult <AcStaffDtos> messageModel = new InfoResult <AcStaffDtos>(); if (NewStaff != null) { NewStaff.Id = acStaffDtos.Id; NewStaff.Name = acStaffDtos.Name; NewStaff.Sex = (sbyte)acStaffDtos.Sex; NewStaff.No = acStaffDtos.No; NewStaff.Address = acStaffDtos.Address; NewStaff.Tel = acStaffDtos.Tel; NewStaff.DepartmentId = acStaffDtos.DepartmentId; NewStaff.Status = (sbyte)acStaffDtos.Status; return(await _IAcStaffService.Edit(NewStaff) > 0 ? new InfoResult <string>("修改成功!") : new InfoResult <string>("修改失败!")); } return(Ok(messageModel)); }
public async Task <ActionResult <InfoResult <AcNoticeDtos> > > Deletenotice(AcNoticeDtos acNoticeDtos) { var data = await _IAcNoticeService.Delete(_mapper.Map <AcNotice>(acNoticeDtos)); InfoResult <AcNoticeDtos> messageModel = new InfoResult <AcNoticeDtos>(); if (data > 0) { messageModel.Code = 200; messageModel.Success = true; messageModel.Msg = "删除成功"; } else { messageModel.Code = 400; messageModel.Success = false; messageModel.Msg = "删除失败!"; } return(Ok(messageModel)); }