public API_Response DownLoad_Mfile(string motherPathName, string fileName) { API_Response api = new API_Response(); #region MyRegion try { //Service_Main client = new Service_Main(); api.Status = "API正常"; api.ErrorMsg = ""; byte[] tempResult = client.DownLoad_Mfile(motherPathName, fileName); int[] r = new int[tempResult.Length];//手动转成数组,不适用byte[]传递 for (int i = 0; i < r.Length; i++) { r[i] = tempResult[i]; } api.Data = r; } catch (Exception ex) { api.Status = "API异常"; api.ErrorMsg = ex.Message; api.Data = null; } #endregion return(api); }
public API_Response UpLoad_Mfile(int id, IFormFile file) { API_Response api = new API_Response(); string path = System.AppDomain.CurrentDomain.BaseDirectory + @"\AllUserUpLoad\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } //string fullfilename = string.Format(@"{0}\{1}{2}", path, DateTime.Now.ToString("yyyyMMddHHmmss"), file.FileName);//这个有用,一会还得删掉 //using (var stream = System.IO.File.Create(fullfilename)) //{ // file.CopyTo(stream); //} Stream fs = file.OpenReadStream(); byte[] byteArray = new byte[fs.Length]; fs.Read(byteArray, 0, byteArray.Length); #region MyRegion try { //Service_Main client = new Service_Main(); api.Status = "API正常"; api.ErrorMsg = ""; api.Data = client.UpLoad_Mfile(id, byteArray, file.FileName); } catch (Exception ex) { api.Status = "API异常"; api.ErrorMsg = ex.Message; api.Data = null; } #endregion return(api); }
public API_Response GetMessageS_Single_ByID(int id) { API_Response api = new API_Response(); #region MyRegion try { //Service_MainClient client = new Service_MainClient(); api.Status = "API正常"; api.ErrorMsg = ""; api.Data = client.GetMessageS_Sigle_ByID(id); } catch (Exception ex) { api.Status = "API异常"; api.ErrorMsg = ex.Message; api.Data = null; } #endregion return(api); }
public API_Response SayHello() { API_Response api = new API_Response(); #region MyRegion try { //Service_Main client = new Service_Main(); api.Status = "API正常"; api.ErrorMsg = ""; api.Data = client.SayHello(); } catch (Exception ex) { api.Status = "API异常"; api.ErrorMsg = ex.Message; api.Data = null; } #endregion return(api); }
public API_Response CreateNew_ShiYan(int uid, ShiYanCreateType type, int hrID, string m_Setting_Arguments, int look_uid, string motherPath) { API_Response api = new API_Response(); #region MyRegion try { //Service_Main client = new Service_Main(); api.Status = "API正常"; api.ErrorMsg = ""; api.Data = client.CreateNew_ShiYan(uid, type, hrID, m_Setting_Arguments, look_uid, motherPath); } catch (Exception ex) { api.Status = "API异常"; api.ErrorMsg = ex.Message; api.Data = null; } #endregion return(api); }
public API_Response GetTag_By_HRID_And_XIEYI(int hrID, ShiYanXieYi xieyi) { API_Response api = new API_Response(); #region MyRegion try { //Service_Main client = new Service_Main(); api.Status = "API正常"; api.ErrorMsg = ""; api.Data = client.GetTag_By_HRID_And_XIEYI(hrID, xieyi); } catch (Exception ex) { api.Status = "API异常"; api.ErrorMsg = ex.Message; api.Data = null; } #endregion return(api); }
public API_Response DeleteFolder(string motherPathName) { API_Response api = new API_Response(); #region MyRegion try { //Service_Main client = new Service_Main(); api.Status = "API正常"; api.ErrorMsg = ""; api.Data = client.DeleteFolder(motherPathName); } catch (Exception ex) { api.Status = "API异常"; api.ErrorMsg = ex.Message; api.Data = null; } #endregion return(api); }
public API_Response SetSendDataStr(string message, int id) { API_Response api = new API_Response(); #region MyRegion try { //Service_Main client = new Service_Main(); api.Status = "API正常"; api.ErrorMsg = ""; api.Data = client.SetSendDataStr(message, id); } catch (Exception ex) { api.Status = "API异常"; api.ErrorMsg = ex.Message; api.Data = null; } #endregion return(api); }