Esempio n. 1
0
 public CommonHelper(Config.Config config)
 {
     _config = config;
     _bucket = _config.Get<string>(Config.Config.AliyunOss_Bucket);
     _domain = _config.Get<string>(Config.Config.AliyunOss_Domain);
     _dir = _config.Get<string>(Config.Config.AliyunOss_Dir);
 }
Esempio n. 2
0
        public string SaveAttachLocal(Stream stream, string filename)
        {
            Config.Config _config  = Resolver.Resolve <Config.Config>();
            string        basePath = _config.Get <string>(Config.Config.AliyunOss_Domain);
            string        dir      = _config.Get <string>(Config.Config.AliyunOss_Dir);
            string        filepath = string.Empty;

            try
            {
                string documentsPath = GetImagePath("RMMT_ORGIMAGE"); //CreateDirectoryForPictures().Path;
                string localFilename = DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + (filename.LastIndexOf("/") != -1 ? filename.Substring(filename.LastIndexOf("/") + 1) : "");
                string newFile       = Path.Combine(documentsPath, localFilename);

                if (File.Exists(filename))
                {
                    File.Copy(filename, newFile);
                    filepath = ResizeImage(newFile);
                    File.Delete(newFile);
                }
            }
            catch (System.Exception)
            {
                filepath = "";
            }
            if (filepath.LastIndexOf("/") != -1)
            {
                filepath = basePath + dir + filepath.Substring(filepath.LastIndexOf("/") + 1);
            }
            else
            {
                filepath = "";
            }
            return(filepath);
        }
Esempio n. 3
0
 public DiscordConfiguration GetDiscordConfiguration()
 {
     return(new DiscordConfiguration
     {
         Token = _config.Get().Bot.Token,
         TokenType = TokenType.Bot,
         UseInternalLogHandler = true,
         LogLevel = LogLevel.Debug,
     });
 }
        public async Task <APIResult> GetReviewPlansList_Mobile(string userId)
        {
            List <RequestParameter> param = new List <RequestParameter> {
                new RequestParameter {
                    Name = "UserId", Value = userId
                }
            };
            APIResult info = await _commonHelper.HttpGet <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.GetReviewPlansList"), param);

            return(info);
        }
Esempio n. 5
0
        public async Task <APIResult> GetAllDataForLocalDB(string inUserId)
        {
            List <RequestParameter> param = new List <RequestParameter> {
                new RequestParameter {
                    Name = "UserId", Value = inUserId
                }
            };
            APIResult info = await _commonHelper.HttpGet <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.GetAllDataForLocalDB"), param);

            return(info);
        }
Esempio n. 6
0
        public async Task <APIResult> GetCalenderListAll(string UserId, string Date)
        {
            List <RequestParameter> param = new List <RequestParameter> {
                new RequestParameter {
                    Name = "UserId", Value = UserId.ToString()
                },
                new RequestParameter {
                    Name = "Date", Value = Date
                },
            };
            APIResult info = await _commonHelper.HttpGet <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.GetCalenderListAll"), param);

            return(info);
        }
Esempio n. 7
0
        public async Task <APIResult> Login(string userName, string password)
        {
            List <RequestParameter> param = new List <RequestParameter> {
                new RequestParameter {
                    Name = "UserName", Value = userName
                },
                new RequestParameter {
                    Name = "Password", Value = password
                }
            };
            APIResult info = await _commonHelper.HttpGet <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.account"), param);

            return(info);
        }
Esempio n. 8
0
 public TourService(Config.Config config)
 {
     _commonHelper = Resolver.Resolve <CommonHelper>();
     _commonFun    = Resolver.Resolve <ICommonFun>();
     _config       = config;
     baseUrl       = _config.Get <string>(Config.Config.Endpoints_BaseUrl);
 }
Esempio n. 9
0
        public async Task <APIResult> GetShops(int id)
        {
            List <RequestParameter> param = new List <RequestParameter>()
            {
                new RequestParameter {
                    Name = "userId", Value = id.ToString()
                }
            };

            APIResult info = await _commonHelper.HttpGet <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.Shops"), param);

            return(info);
        }
Esempio n. 10
0
        public async Task <APIResult> GetAttachmentByUserId(int userId, string sourceType, string sDate, string eDate)
        {
            List <RequestParameter> param = new List <RequestParameter> {
                new RequestParameter {
                    Name = "userId", Value = userId.ToString()
                },
                new RequestParameter {
                    Name = "sDate", Value = sDate
                },
                new RequestParameter {
                    Name = "eDate", Value = eDate
                },
                new RequestParameter {
                    Name = "sourceType", Value = sourceType
                }
            };
            APIResult info = await _commonHelper.HttpGet <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.GetAttachmentByUserId"), param);

            return(info);
        }
Esempio n. 11
0
        public static OssClient CreateOssClient()
        {
            if (_ossClient == null)
            {
                //string accessKeyId = "LTAIf3JaskXqG1bx";
                //string accessKeySecret = "EauvHZ7OXKtmxhDi9RN7YO8MrQo2YP";
                //string endpoint = "oss-cn-shanghai.aliyuncs.com";
                string accessKeyId = _config.Get<string>(Config.Config.AliyunOss_AccessKeyId);
                string accessKeySecret = _config.Get<string>(Config.Config.AliyunOss_AccessKeySecret);
                string endpoint = _config.Get<string>(Config.Config.AliyunOss_Endpoint);
                //var conf = new ClientConfiguration();
                ////conf.IsCname = true;/// 配置使用Cname
                ////conf.ConnectionLimit = 512;  //HttpWebRequest最大的并发连接数目
                //conf.MaxErrorRetry = 3;     //设置请求发生错误时最大的重试次数
                //conf.ConnectionTimeout = 300;  //设置连接超时时间
                ////conf.SetCustomEpochTicks(customEpochTicks);        //设置自定义基准时间, CreateCancelTokenSource().Token.ToString()

                _ossClient = new OssClient(endpoint, accessKeyId, accessKeySecret);
            }
            return _ossClient;
        }
Esempio n. 12
0
        public async Task <APIResult> GetCaseList(int inUserId, string sDate, string eDate, string caseType, string content)
        {
            List <RequestParameter> param = new List <RequestParameter> {
                new RequestParameter {
                    Name = "inUserId", Value = inUserId.ToString()
                },
                new RequestParameter {
                    Name = "sDate", Value = sDate
                },
                new RequestParameter {
                    Name = "eDate", Value = eDate
                },
                new RequestParameter {
                    Name = "caseType", Value = caseType
                },
                new RequestParameter {
                    Name = "content", Value = content
                }
            };
            APIResult info = await _commonHelper.HttpGet <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.CaseSearch"), param);

            return(info);
        }
Esempio n. 13
0
        public RemoteService(Config.Config config)
        {
            _commonHelper = Resolver.Resolve <CommonHelper>();
            _config       = config;
            baseUrl       = _config.Get <string>(Config.Config.Endpoints_BaseUrl);

            _scoreRegRepository    = Resolver.Resolve <IRepository <Score> >();
            _standardpicRepository = Resolver.Resolve <IRepository <Domain.StandardPic> >();
            _checkResultRepository = Resolver.Resolve <IRepository <CheckResult> >();
            _taskOfPlanRepository  = Resolver.Resolve <IRepository <TaskOfPlan> >();
            _custImproveRepository = Resolver.Resolve <IRepository <CustImproveItemDB> >();
            _taskCardRepository    = Resolver.Resolve <IRepository <TaskCard> >();
            _taskItemRepository    = Resolver.Resolve <IRepository <TaskItem> >();
        }
Esempio n. 14
0
        //获取计划,结果
        public async Task <APIResult> GetResult(string itemName, string sDate, string eDate, int inUserId, string statusType, string status, int disId, int depId, int planid, string sourceType = "")
        {
            List <RequestParameter> param = new List <RequestParameter> {
                new RequestParameter {
                    Name = "itemName", Value = itemName
                },
                new RequestParameter {
                    Name = "sDate", Value = sDate
                },
                new RequestParameter {
                    Name = "eDate", Value = eDate
                },
                new RequestParameter {
                    Name = "inUserId", Value = inUserId.ToString()
                },
                new RequestParameter {
                    Name = "statusType", Value = statusType
                },
                new RequestParameter {
                    Name = "status", Value = status
                },
                new RequestParameter {
                    Name = "disId", Value = disId.ToString()
                },
                new RequestParameter {
                    Name = "depId", Value = depId.ToString()
                },
                new RequestParameter {
                    Name = "planId", Value = planid.ToString()
                },
                new RequestParameter {
                    Name = "sourceType", Value = sourceType
                }
            };
            APIResult info = await _commonHelper.HttpGet <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.ImproveGetResult"), param);

            return(info);
        }
Esempio n. 15
0
 /// <summary>
 ///     Lấy giá trị từ form
 /// </summary>
 /// <returns>String</returns>
 public static string GetTestTypeBarcode()
 {
     return(ServiceConfig.Get(UseTestTypeIdToGenerateBarcode).ToString());
 }
Esempio n. 16
0
        public async Task <APIResult> GetNotifiListOfMake(string searchType, string fromDate, string toDate, string inUserID, string needReply = "", string noticeReaders = "", string status = "", string title = "", string noticeNo = "")
        {
            List <RequestParameter> param = new List <RequestParameter> {
                new RequestParameter {
                    Name = "SearchType", Value = searchType
                },
                new RequestParameter {
                    Name = "FromDate", Value = fromDate
                },
                new RequestParameter {
                    Name = "ToDate", Value = toDate
                },
                new RequestParameter {
                    Name = "NoticeReaders", Value = noticeReaders
                },
                new RequestParameter {
                    Name = "Status", Value = status
                },
                new RequestParameter {
                    Name = "NeedReply", Value = needReply
                },
                new RequestParameter {
                    Name = "InUserID", Value = inUserID
                },
                new RequestParameter {
                    Name = "Title", Value = title
                },
                new RequestParameter {
                    Name = "NoticeNo", Value = noticeNo
                }
            };
            APIResult info = await _commonHelper.HttpGet <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.NotifiMng"), param);

            return(info);
        }
Esempio n. 17
0
 public static string GetReportType()
 {
     return(ServiceBusiness.Get(ReportType).ToString());
 }
Esempio n. 18
0
 public NotifiMngService(Config.Config config)
 {
     _commonHelper = Resolver.Resolve <CommonHelper>();
     _config       = config;
     baseUrl       = _config.Get <string>(Config.Config.Endpoints_BaseUrl);
 }
Esempio n. 19
0
 public AccountService(Config.Config config)
 {
     _commonHelper = new CommonHelper(config);
     _config       = config;
     baseUrl       = _config.Get <string>(Config.Config.Endpoints_BaseUrl);
 }