public ModelRegistry()
            {
                if (ApplicationSettingsFactory.
                    GetApplicationSettings().
                    PersistenceStrategy.Equals(RAM.Infrastructure.Domain.PersistenceStrategy.NHibernate.ToString()))
                {
                    //Repositories
                    For <IUserRepository>().Use <UserRepository>();
                    For <IBlogRepository>().Use <BlogRepository>();
                    For <IBlogTagRepository>().Use <BlogTagRepository>();
                    For <ISubscriberRepository>().Use <SubscriberRepository>();
                    For <IProjectRepository>().Use <ProjectRepository>();
                    For <IProjectImageRepository>().Use <ProjectImageRepository>();
                    For <IBannerRepository>().Use <BannerRepository>();
                    For <IBlogCategoryRepository>().Use <BlogCategoryRepository>();

                    For <IUnitOfWork>().Use <NHUnitOfWork>();

                    For <ICacheStorage>().Use <CouchbaseCacheAdapter>();
                }

                //For<MembershipProvider>().Use<AlpineMembershipProvider>();

                //For<RoleProvider>().Use<AlpineRoleProvider>();

                //Models
                For <IUser>().Use <User>();
                For <IBlog>().Use <Blog>();
                For <ISubscriber>().Use <Subscriber>();
                For <IProject>().Use <Project>();
                For <IProjectImage>().Use <ProjectImage>();
                For <IBanner>().Use <Banner>();
                For <IBlogCategory>().Use <BlogCategory>();

                //Services
                For <IUserService>().Use <UserService>();
                For <IBannerService>().Use <BannerService>();
                For <ISubscriberService>().Use <SubscriberService>();
                For <IBlogService>().Use <BlogService>();
                For <IProjectService>().Use <ProjectService>();
                For <IBlogCategoryService>().Use <BlogCategoryService>();

                // Logger
                For <ILogger>().Use
                <Log4NetAdapter>();
                // Email Service
                For <IEmailService>().Use
                <SMTPService>();
                //Authentication
                For <IExternalAuthenticationService>().Use <JanrainAuthenticationService>();
                For <IFormsAuthentication>().Use <AspFormsAuthentication>();
                For <ILocalAuthenticationService>().Use <HRRMarketingAuthenticationService>();
                //Controller Helpers
                For <IActionArguments>().Use <HttpRequestActionArguments>();
            }
예제 #2
0
        public static IContainer ConfigureStructureMapWebAPI()
        {
            ObjectFactory.Initialize(x => { x.AddRegistry <ApplicationSettingsRegistry>(); });
            ApplicationSettingsFactory.
            InitializeApplicationSettingsFactory
                (ObjectFactory.GetInstance <IApplicationSettings>());
            if (ApplicationSettingsFactory.
                GetApplicationSettings().
                PersistenceStrategy.Equals(RAM.Infrastructure.Domain.PersistenceStrategy.NHibernate.ToString()))
            {
                var container = new Container(x =>
                {
                    x.For <IUserService>().Use <UserService>();
                    x.For <ITagService>().Use <TagService>();
                    x.For <IBannerService>().Use <BannerService>();
                    x.For <IBlogService>().Use <BlogService>();
                    x.For <IProjectService>().Use <ProjectService>();
                    x.For <IBlogCategoryService>().Use <BlogCategoryService>();

                    x.For <IUserRepository>().Use <UserRepository>();
                    x.For <ITagRepository>().Use <TagRepository>();
                    x.For <IBannerRepository>().Use <BannerRepository>();
                    x.For <IBlogRepository>().Use <BlogRepository>();
                    x.For <IBlogTagRepository>().Use <BlogTagRepository>();
                    x.For <IProjectRepository>().Use <ProjectRepository>();
                    x.For <IProjectImageRepository>().Use <ProjectImageRepository>();
                    x.For <IBlogCategoryRepository>().Use <BlogCategoryRepository>();

                    x.For <IUnitOfWork>().Use <NHUnitOfWork>();

                    x.For <ICacheStorage>().Use <CouchbaseCacheAdapter>();

                    x.For <IUser>().Use <User>();
                    x.For <IBanner>().Use <Banner>();
                    x.For <ITag>().Use <Tag>();
                    x.For <IBlogTag>().Use <BlogTag>();
                    x.For <IBlog>().Use <Blog>();
                    x.For <IProject>().Use <Project>();
                    x.For <IProjectImage>().Use <ProjectImage>();
                    x.For <IBlogCategory>().Use <BlogCategory>();

                    x.For <ILogger>().Use <Log4NetAdapter>();

                    x.For <IEmailService>().Use <SMTPService>();

                    x.For <IExternalAuthenticationService>().Use <JanrainAuthenticationService>();
                    x.For <IFormsAuthentication>().Use <AspFormsAuthentication>();
                    x.For <ILocalAuthenticationService>().Use <HRRMarketingAuthenticationService>();

                    x.For <IActionArguments>().Use <HttpRequestActionArguments>();
                });
                return(container);
            }
            return(null);
        }
예제 #3
0
        private static GetProductsByCategoryRequest GenerateInitialProductSearchRequestFrom(int categoryId)
        {
            GetProductsByCategoryRequest productSearchRequest = new GetProductsByCategoryRequest();

            productSearchRequest.NumberOfResultsPerPage = int.Parse(ApplicationSettingsFactory
                                                                    .GetApplicationSettings().NumberOfResultsPerPage);
            productSearchRequest.CategoryId = categoryId;
            productSearchRequest.Index      = 1;
            productSearchRequest.SortBy     = ProductsSortBy.PriceHighToLow;
            return(productSearchRequest);
        }
예제 #4
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var userName = filterContext.HttpContext.User.Identity.Name;//获取用户标识名称

            if (!userName.Equals(ApplicationSettingsFactory.GetApplicationSettings().AdminLoginId))
            {
                FormsAuthentication.SignOut();                                           //验证票据注销
                filterContext.Result = new RedirectResult(FormsAuthentication.LoginUrl); //设置重定向到登录页面
            }
            base.OnActionExecuting(filterContext);
        }
예제 #5
0
 public static EncryptContext GetContext()
 {
     if (_instance == null)
     {
         string assemblyString = ApplicationSettingsFactory.GetApplicationSettings().ModelsLayerAssemblyString;
         string ClassName      = ApplicationSettingsFactory.GetApplicationSettings().EncryptStrategyClassName;
         var    strategy       = (AppEncryptionStrategy)Assembly.Load(assemblyString).CreateInstance(string.Concat(assemblyString, ".", ClassName));
         _instance = new EncryptContext(strategy);
     }
     return(_instance);
 }
예제 #6
0
        public CasesRepository()
        {
            base.ServiceURL       = ApplicationSettingsFactory.GetApplicationSettings().BaseURL + serviceName;
            GetAllMethodName      = "qryCA";
            AddOrUpdateMethodName = "setCA";
            GetRecordMethodName   = "getCA";
            DeleteMethodName      = "delCA";

            ChildGetAllLookup.Add(typeof(CaseComment), "qryCC");
            ChildAddOrUpdateLookup.Add(typeof(CaseComment), "setCC");
            ChildDeleteLookup.Add(typeof(CaseComment), "delCC");
        }
예제 #7
0
        // GET: /Base/
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            string loginpage = ApplicationSettingsFactory.GetApplicationSettings().LoginPage;
            string url       = loginpage + "?ReturnUrl=" + Request.RawUrl;

            if (!AuthenticationFactory.Authentication().Verification)
            {
                filterContext.Result = Redirect(url);
            }
        }
예제 #8
0
        public AccountRepository()
        {
            base.ServiceURL          = ApplicationSettingsFactory.GetApplicationSettings().BaseURL + serviceName;
            base.GetRecordMethodName = "getAC";
            //  ChildAddOrUpdateLookup.Add(typeof(Registration), "setRE");
            ChildAddOrUpdateLookup.Add(typeof(Account), "setAC");
            ChildAddOrUpdateLookup.Add(typeof(DbSetup), "setDB");


            // ChildDeleteLookup.Add(typeof(Registration), "delRE");
            ChildDeleteLookup.Add(typeof(Account), "delAC");
        }
예제 #9
0
        public AssetManagementRepository()
        {
            base.ServiceURL = ApplicationSettingsFactory.GetApplicationSettings().BaseURL + serviceName;

            ChildGetAllLookup.Add(typeof(AssetManagementSupplier), "qrySU");
            ChildGetAllLookup.Add(typeof(AssetManagementCategory), "qryCA");
            ChildGetAllLookup.Add(typeof(AssetManagementAsset), "qryAS");
            ChildGetAllLookup.Add(typeof(AssetManagementPurchaseOrder), "qryPO");
            ChildGetAllLookup.Add(typeof(AssetManagementOnBoarding), "qryOB");
            ChildGetAllLookup.Add(typeof(AssetManagementLoan), "qryLO");
            ChildGetAllLookup.Add(typeof(AssetManagementPurchaseOrderApproval), "qryPA");
            ChildGetAllLookup.Add(typeof(PendingPA), "pendingPA");
            ChildGetAllLookup.Add(typeof(AssetManagementCategoryProperty), "qryCP");
            ChildGetAllLookup.Add(typeof(AssetPropertyValue), "qryAP");



            ChildGetLookup.Add(typeof(AssetManagementSupplier), "getSU");
            ChildGetLookup.Add(typeof(AssetManagementCategory), "getCA");
            ChildGetLookup.Add(typeof(AssetManagementAsset), "getAS");
            ChildGetLookup.Add(typeof(AssetManagementPurchaseOrder), "getPO");
            ChildGetLookup.Add(typeof(AssetManagementOnBoarding), "getOB");
            ChildGetLookup.Add(typeof(AssetManagementLoan), "getLO");
            ChildGetLookup.Add(typeof(AssetManagementCategoryProperty), "getCP");



            ChildAddOrUpdateLookup.Add(typeof(AssetManagementSupplier), "setSU");
            ChildAddOrUpdateLookup.Add(typeof(AssetManagementCategory), "setCA");
            ChildAddOrUpdateLookup.Add(typeof(AssetManagementAsset), "setAS");
            ChildAddOrUpdateLookup.Add(typeof(AssetManagementPurchaseOrder), "setPO");
            ChildAddOrUpdateLookup.Add(typeof(AssetManagementOnBoarding), "setOB");
            ChildAddOrUpdateLookup.Add(typeof(AssetManagementLoan), "setLO");
            ChildAddOrUpdateLookup.Add(typeof(AssetManagementCategoryProperty), "setCP");
            ChildAddOrUpdateLookup.Add(typeof(AssetManagementPurchaseOrderApproval), "setPA");
            ChildAddOrUpdateLookup.Add(typeof(AssetPropertyValue), "setAP");



            ChildAddOrUpdateLookup.Add(typeof(AssetPOReception), "genAS");
            ChildAddOrUpdateLookup.Add(typeof(SyncActivity), "syncPO");



            ChildDeleteLookup.Add(typeof(AssetManagementSupplier), "delSU");
            ChildDeleteLookup.Add(typeof(AssetManagementCategory), "delCA");
            ChildDeleteLookup.Add(typeof(AssetManagementAsset), "delAS");
            ChildDeleteLookup.Add(typeof(AssetManagementPurchaseOrder), "delPO");
            ChildDeleteLookup.Add(typeof(AssetManagementOnBoarding), "delOB");
            ChildDeleteLookup.Add(typeof(AssetManagementLoan), "delLO");
            ChildDeleteLookup.Add(typeof(AssetManagementCategoryProperty), "delCP");
        }
예제 #10
0
        public MediaGalleryRepository()
        {
            base.ServiceURL = ApplicationSettingsFactory.GetApplicationSettings().BaseURL + serviceName;
            ChildGetLookup.Add(typeof(MediaCategory), "getMC");
            ChildGetAllLookup.Add(typeof(MediaCategory), "qryMC");
            ChildAddOrUpdateLookup.Add(typeof(MediaCategory), "setMC");
            ChildDeleteLookup.Add(typeof(MediaCategory), "delMC");


            ChildGetLookup.Add(typeof(MediaItem), "getME");
            ChildGetAllLookup.Add(typeof(MediaItem), "qryME");
            ChildAddOrUpdateLookup.Add(typeof(MediaItem), "setME");
            ChildDeleteLookup.Add(typeof(MediaItem), "delME");
        }
        public bool SendEmail(string to, string from, string cc, string bcc, string subject, string body, bool enablessl, Stream attachmentPath, string attachmentName)
        {
            System.Net.Mail.SmtpClient cl = new System.Net.Mail.SmtpClient();
            cl.Host = ApplicationSettingsFactory.GetApplicationSettings().SmtpHost;
            cl.UseDefaultCredentials = false;
            cl.Credentials           = new System.Net.NetworkCredential(ApplicationSettingsFactory.GetApplicationSettings().SmtpUsername, ApplicationSettingsFactory.GetApplicationSettings().SmtpPassword);
            cl.EnableSsl             = enablessl;
            cl.DeliveryMethod        = System.Net.Mail.SmtpDeliveryMethod.Network;
            try
            {
                System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage(from, to, subject, body);

                // CC and BCC optional
                if (!string.IsNullOrEmpty(cc))
                {
                    string[] ccArray = cc.Split(',');
                    foreach (string sCC in ccArray)
                    {
                        msg.CC.Add(sCC);
                    }
                }

                // You can specify Address directly as string
                if (!string.IsNullOrEmpty(bcc))
                {
                    string[] bccArray = bcc.Split(',');
                    foreach (string sBCC in bccArray)
                    {
                        msg.Bcc.Add(sBCC);
                    }
                }

                if (attachmentPath != null)
                {
                    var att = new System.Net.Mail.Attachment(attachmentPath, attachmentName);
                    msg.Attachments.Add(att);
                }
                msg.IsBodyHtml = true;
                ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };

                cl.Send(msg);
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(true);
        }
        public void TestReadConfigFormModbusConfigFile()
        {
            ApplicationSettingsFactory.InitializeApplicationSettingsFactory(new AppConfigApplicationSettings());
            IApplicationSettings applicationSettings =
                ApplicationSettingsFactory.GetApplicationSettings();

            IUnitOfWork          unitOfWork          = new AdoUnitOfWork();
            IDataPointRepository dataPointRepository = new DataPointRepository(unitOfWork);
            IModuleRepository    moduleRepository    = new ModuleRepository(unitOfWork);

            ModbusConfigService modbusConfigService = new ModbusConfigService(dataPointRepository,
                                                                              moduleRepository);

            modbusConfigService.ReadConfigFormModbusConfigFile();
        }
예제 #13
0
        public TimeAttendanceRepository()
        {
            base.ServiceURL = ApplicationSettingsFactory.GetApplicationSettings().BaseURL + serviceName;

            ChildGetLookup.Add(typeof(DayType), "getDT");
            ChildGetLookup.Add(typeof(AttendanceSchedule), "getSC");
            ChildGetLookup.Add(typeof(AttendanceScheduleDay), "getSD");
            ChildGetLookup.Add(typeof(WorkingCalendar), "getCA");
            ChildGetLookup.Add(typeof(CalendarYear), "getCY");
            ChildGetLookup.Add(typeof(CalendarDay), "getCD");
            ChildGetLookup.Add(typeof(BiometricDevice), "getBM");
            ChildGetLookup.Add(typeof(Router), "getRO");

            ChildGetAllLookup.Add(typeof(DayType), "qryDT");
            ChildGetAllLookup.Add(typeof(AttendanceSchedule), "qrySC");
            ChildGetAllLookup.Add(typeof(AttendanceScheduleDay), "qrySD");
            ChildGetAllLookup.Add(typeof(AttendanceBreak), "qrySB");
            ChildGetAllLookup.Add(typeof(WorkingCalendar), "qryCA");
            ChildGetAllLookup.Add(typeof(CalendarYear), "qryCY");
            ChildGetAllLookup.Add(typeof(CalendarDay), "qryCD");
            ChildGetAllLookup.Add(typeof(BiometricDevice), "qryBM");
            ChildGetAllLookup.Add(typeof(AttendanceDay), "qryAD");
            ChildGetAllLookup.Add(typeof(CheckMonitor), "qryCM");
            ChildGetAllLookup.Add(typeof(ActiveCheck), "qryAC");
            ChildGetAllLookup.Add(typeof(ActiveAbsence), "qryAA");
            ChildGetAllLookup.Add(typeof(ActiveLate), "qryAL");
            ChildGetAllLookup.Add(typeof(ActiveLeave), "qryAV");
            ChildGetAllLookup.Add(typeof(ActiveOut), "qryAO");
            ChildGetAllLookup.Add(typeof(MissedPunch), "qryMP");
            ChildGetAllLookup.Add(typeof(Router), "qryRO");

            ChildAddOrUpdateLookup.Add(typeof(DayType), "setDT");
            ChildAddOrUpdateLookup.Add(typeof(AttendanceSchedule), "setSC");
            ChildAddOrUpdateLookup.Add(typeof(AttendanceScheduleDay), "setSD");
            ChildAddOrUpdateLookup.Add(typeof(AttendanceBreak[]), "arrSB");
            ChildAddOrUpdateLookup.Add(typeof(WorkingCalendar), "setCA");
            ChildAddOrUpdateLookup.Add(typeof(CalendarYear), "setCY");
            ChildAddOrUpdateLookup.Add(typeof(CalendarDay), "setCD");
            ChildAddOrUpdateLookup.Add(typeof(BiometricDevice), "setBM");
            ChildAddOrUpdateLookup.Add(typeof(CalendarPattern), "batCD");
            ChildAddOrUpdateLookup.Add(typeof(Router), "setRO");

            ChildDeleteLookup.Add(typeof(AttendanceBreak), "delSB");
            ChildDeleteLookup.Add(typeof(AttendanceSchedule), "delSC");
            ChildDeleteLookup.Add(typeof(WorkingCalendar), "delCA");
            ChildDeleteLookup.Add(typeof(DayType), "delDT");
            ChildDeleteLookup.Add(typeof(BiometricDevice), "delBM");
        }
예제 #14
0
        private bool Init()
        {
            bool success = true;

            try
            {
                var modbusConfigFile = ApplicationSettingsFactory.GetApplicationSettings().ModbusConfigFilePath;
                ModbusTCPServer = GetModbusTCPServerFromConfigFile(modbusConfigFile);
            }
            catch (Exception ex)
            {
                success = false;
                LoggingFactory.GetLogger().WriteErrorLogger(string.Format("ModbusService->Init()异常:{0}--{1}", ex.Message, ex.InnerException));
            }

            return(success);
        }
예제 #15
0
        public TaskManagementRepository()
        {
            base.ServiceURL       = ApplicationSettingsFactory.GetApplicationSettings().BaseURL + serviceName;
            GetAllMethodName      = "qryTA";
            AddOrUpdateMethodName = "setTA";
            GetRecordMethodName   = "getTA";
            DeleteMethodName      = "delTA";

            ChildGetLookup.Add(typeof(TaskType), "getTT");
            ChildGetAllLookup.Add(typeof(TaskType), "qryTT");
            ChildAddOrUpdateLookup.Add(typeof(TaskType), "setTT");
            ChildDeleteLookup.Add(typeof(TaskType), "delTT");

            ChildGetLookup.Add(typeof(TaskComment), "getTC");
            ChildGetAllLookup.Add(typeof(TaskComment), "qryTC");
            ChildAddOrUpdateLookup.Add(typeof(TaskComment), "setTC");
            ChildDeleteLookup.Add(typeof(TaskComment), "delTC");
        }
        private string ValidatePaymentNotification(FormCollection formCollection)
        {
            formCollection["cmd"] = "_notify-validate";

            string paypalUrl = ApplicationSettingsFactory
                               .GetApplicationSettings().PayPalPaymentPostToUrl;

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(paypalUrl);

            // Set values for the request back
            req.Method      = "POST";
            req.ContentType = "application/x-www-form-urlencoded";

            byte[] param = HttpContext.Current.Request
                           .BinaryRead(HttpContext.Current.Request.ContentLength);
            string strRequest = Encoding.ASCII.GetString(param);

            StringBuilder postFormData = new StringBuilder();

            foreach (string key in formCollection.Keys)
            {
                postFormData.AppendFormat("&{0}={1}", key, formCollection[key]);
            }

            strRequest        = postFormData.ToString();
            req.ContentLength = strRequest.Length;


            string response = "";

            using (StreamWriter streamOut = new StreamWriter(req.GetRequestStream(),
                                                             System.Text.Encoding.ASCII))
            {
                streamOut.Write(strRequest);
                streamOut.Close();
                using (StreamReader streamIn =
                           new StreamReader(req.GetResponse().GetResponseStream()))
                {
                    response = streamIn.ReadToEnd();
                }
            }

            return(response);
        }
예제 #17
0
        /// <summary>
        /// 初始化日志系统
        /// </summary>
        private void InitializeLogger()
        {
            try
            {
                //log4net.Config.XmlConfigurator.Configure();
                string   log4NetConfigPath = ApplicationSettingsFactory.GetApplicationSettings().Log4NetConfigPath;
                FileInfo fileInfo          = new FileInfo(log4NetConfigPath);
                XmlConfigurator.ConfigureAndWatch(fileInfo);

                ILogger logger = new Log4NetAdapter();//IocContainerFactory.GetUnityContainer().Resolve<ILogger>();
                LoggingFactory.InitializeLogFactory(logger);
            }
            catch (Exception e)
            {
                string message     = DateTime.Now.ToString() + "调用InitializeLogger初始化日志系统失败!异常信息如下 :" + e.Message;
                string logFilePath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, @"Log/BootStrapperLog.txt");
                System.IO.File.WriteAllText(logFilePath, message);
            }
        }
예제 #18
0
        public AnomalousEventManagementResponse GetAnomalousEventManagementDatasBy(DatasQueryResultRequestBase req)
        {
            var resp = new AnomalousEventManagementResponse();
            IList <Func <AnomalousEvent_AnomalousEventTable, bool> > ps = new List <Func <AnomalousEvent_AnomalousEventTable, bool> >();

            try
            {
                DealWithConditions(req, ps);
                var numberOfResultsPrePage = ApplicationSettingsFactory.GetApplicationSettings().NumberOfResultsPrePage;//获取每页记录数
                resp.Datas            = _anomalousEventManagementQueryService.GetAnomalousEventManagementsSourceBy(ps, req.CurrentPageIndex, numberOfResultsPrePage);
                resp.TotalResultCount = _anomalousEventManagementQueryService.GetTotalResultCountBy(ps);
                resp.Succeed          = true;
            }
            catch
            {
                resp.Message = NoRecordsMessage;
            }
            return(resp);
        }
예제 #19
0
        public DashBoardRepository()
        {
            base.ServiceURL = ApplicationSettingsFactory.GetApplicationSettings().BaseURL + serviceName;

            ChildGetAllLookup.Add(typeof(DashBoardDO), "qryDO");

            ChildGetAllLookup.Add(typeof(DashboardLW), "qryLW");
            ChildGetAllLookup.Add(typeof(DashboardNS), "qryNS");
            ChildGetAllLookup.Add(typeof(DashBoardPE), "qryPE");
            ChildGetAllLookup.Add(typeof(DashBoardLE), "qryLE");
            ChildGetAllLookup.Add(typeof(DashBoardCH), "qryCH");
            ChildGetAllLookup.Add(typeof(DashBoardPL), "qryPL");
            ChildGetAllLookup.Add(typeof(DashBoardUL), "qryUL");
            ChildGetAllLookup.Add(typeof(DashBoardTimeVariation), "qryTV");
            ChildGetAllLookup.Add(typeof(AttendancePeriod), "qryAP");
            ChildGetAllLookup.Add(typeof(DashboardItem), "dashBoard");
            ChildGetAllLookup.Add(typeof(DashboardAlertItem), "qryAA");
            ChildGetAllLookup.Add(typeof(DashboardBranchAvailability), "qryBA");

            ChildGetAllLookup.Add(typeof(CompanyRTW), "qryCR");
            ChildGetAllLookup.Add(typeof(EmpRTW), "qryER");
            ChildGetAllLookup.Add(typeof(SalaryChange), "qrySC");
            ChildGetAllLookup.Add(typeof(ProbationEnd), "qryPR");
            ChildGetAllLookup.Add(typeof(WorkAnniversary), "qryWA");
            ChildGetAllLookup.Add(typeof(EmployeeBirthday), "qryBD");
            ChildGetAllLookup.Add(typeof(RetirementAge), "qryRS");
            ChildGetAllLookup.Add(typeof(TermEndDate), "qryTE");
            ChildGetAllLookup.Add(typeof(LeavingSoon), "qryLS");
            ChildGetAllLookup.Add(typeof(ReturnFromLeave), "qryLR");
            ChildGetAllLookup.Add(typeof(EmploymentReview), "qryRE");


            ChildGetLookup.Add(typeof(MyInfo), "getEM1");



            ChildAddOrUpdateLookup.Add(typeof(MyInfo), "setEM");
            ChildAddOrUpdateLookup.Add(typeof(DashBoardTimeVariation), "setTV");



            ChildDeleteLookup.Add(typeof(MyInfo), "delEM");
        }
예제 #20
0
 private void Init()
 {
     try
     {
         IPersistenceConfigurer config = PostgreSQLConfiguration.PostgreSQL82.
                                         ConnectionString(ApplicationSettingsFactory.GetApplicationSettings().ConnectionString)
                                         .AdoNetBatchSize(100)
                                         .ProxyFactoryFactory <ProxyFactoryFactory>()
                                         .ShowSql();
         _sessionFactory = Fluently.Configure()
                           .Database(config)
                           //ini harus di configusi sesuai dengan salah satu file mapping yang dibuat.
                           //.Mappings(x => x.FluentMappings.AddFromAssemblyOf<TrContractFormatMap>())
                           .BuildSessionFactory();
     }
     catch (Exception e)
     {
         throw (e);
     }
 }
        public AlarmDatasResponse GetAlarmDatasBy(GetAlarmDatasRequest req)
        {
            var resp = new AlarmDatasResponse();
            IList <Func <T, bool> > ps = new List <Func <T, bool> >();

            try
            {
                DealWithConditions(req, ps);
                var numberOfResultsPrePage = ApplicationSettingsFactory.GetApplicationSettings().NumberOfResultsPrePage;//获取每页记录数
                resp.Datas            = _alarmDatasQueryService.GetAlarmDatasSourceBy(ps, req.CurrentPageIndex, numberOfResultsPrePage);
                resp.TotalResultCount = _alarmDatasQueryService.GetTotalResultCountBy(ps);
                resp.Succeed          = true;
            }
            catch (Exception ex)
            {
                resp.Message = ex.Message;
                Log(ex);
            }
            return(resp);
        }
예제 #22
0
        /// <summary>
        /// Log for customer related
        /// </summary>
        /// Stores: UserId, IPAddress, URL, Message, DateTime
        /// <param name="message"></param>
        /// <param name="messageType"></param>
        private void CustomerLog(string message, MessageType messageType)
        {
            var currentContext = HttpContext.Current;

            string userid, logDetails, ipAddress, url = "No url found to be reported.", raisedOn = DateTime.Now.ToString();

            if (currentContext != null)
            {
                userid     = "arvind"; //currentContext.User.Identity.Name;
                url        = currentContext.Request.Url.AbsoluteUri;
                ipAddress  = currentContext.Request.UserHostAddress;
                logDetails = message;
                string LoggerName = ApplicationSettingsFactory.GetApplicationSettings().CustomerLoggerName;
                string path       = currentContext.Server.MapPath("~/App_Data/Log/" + LoggerName + ".xml");

                XmlDocument doc = new XmlDocument();
                doc.Load(path);

                XmlNode    root   = doc.DocumentElement;
                XmlElement error  = doc.CreateElement(messageType.ToString());
                XmlElement userId = doc.CreateElement("UserId");
                userId.InnerText = userid;
                XmlElement errorUrl = doc.CreateElement("Url");
                errorUrl.InnerText = url;
                XmlElement ipAdd = doc.CreateElement("IPAddress");
                ipAdd.InnerText = ipAddress;
                XmlElement errorDetails = doc.CreateElement("Details");
                errorDetails.InnerText = logDetails;
                XmlElement errorDateTime = doc.CreateElement("DateTime");
                errorDateTime.InnerText = raisedOn;

                error.AppendChild(userId);
                error.AppendChild(errorUrl);
                error.AppendChild(ipAdd);
                error.AppendChild(errorDetails);
                error.AppendChild(errorDateTime);
                root.InsertAfter(error, root.FirstChild);

                doc.Save(path);
            }
        }
예제 #23
0
        /// <summary>
        /// Create Log for Retailer related
        /// Stores: RetailerId, RetailerIPAddress, SourcePath, Message, DateTime
        /// </summary>
        /// <param name="message"></param>
        /// <param name="messageType"></param>
        private void RetailerLog(string message, MessageType messageType)
        {
            var currentContext = HttpContext.Current;

            string retailer, logDetails, ipAddress, filePath = "No file path found.", raisedOn = DateTime.Now.ToString();

            if (currentContext != null)
            {
                retailer   = currentContext.User.Identity.Name;
                filePath   = currentContext.Request.FilePath;
                ipAddress  = currentContext.Request.UserHostAddress;
                logDetails = message;
                string LoggerName = ApplicationSettingsFactory.GetApplicationSettings().CustomerLoggerName;
                string path       = currentContext.Server.MapPath("~/App_Data/Log/" + LoggerName + ".xml");

                XmlDocument doc = new XmlDocument();
                doc.Load(path);

                XmlNode    root       = doc.DocumentElement;
                XmlElement error      = doc.CreateElement(messageType.ToString());
                XmlElement retailerId = doc.CreateElement("UserId");
                retailerId.InnerText = retailer;
                XmlElement errorPath = doc.CreateElement("Path");
                errorPath.InnerText = filePath;
                XmlElement ipAdd = doc.CreateElement("IPAddress");
                ipAdd.InnerText = ipAddress;
                XmlElement errorDetails = doc.CreateElement("Details");
                errorDetails.InnerText = logDetails;
                XmlElement errorDateTime = doc.CreateElement("DateTime");
                errorDateTime.InnerText = raisedOn;

                error.AppendChild(retailerId);
                error.AppendChild(errorPath);
                error.AppendChild(ipAdd);
                error.AppendChild(errorDetails);
                error.AppendChild(errorDateTime);
                root.InsertAfter(error, root.FirstChild);

                doc.Save(path);
            }
        }
        private static GetProductsByCategoryRequest GenerateProductSearchRequestFrom(
            JsonProductSearchRequest jsonProductSearchRequest)
        {
            GetProductsByCategoryRequest productSearchRequest =
                new GetProductsByCategoryRequest();

            productSearchRequest.NumberOfResultsPerPage = int.Parse(ApplicationSettingsFactory
                                                                    .GetApplicationSettings().NumberOfResultsPerPage);
            productSearchRequest.Index      = jsonProductSearchRequest.Index;
            productSearchRequest.CategoryId = jsonProductSearchRequest.CategoryId;
            productSearchRequest.SortBy     = jsonProductSearchRequest.SortBy;

            List <RefinementGroup> refinementGroups = new List <RefinementGroup>();
            RefinementGroup        refinementGroup;

            foreach (JsonRefinementGroup jsonRefinementGroup in
                     jsonProductSearchRequest.RefinementGroups)
            {
                switch ((RefinementGroupings)jsonRefinementGroup.GroupId)
                {
                case RefinementGroupings.brand:
                    productSearchRequest.BrandIds =
                        jsonRefinementGroup.SelectedRefinements;
                    break;

                case RefinementGroupings.color:
                    productSearchRequest.ColorIds =
                        jsonRefinementGroup.SelectedRefinements;
                    break;

                case RefinementGroupings.size:
                    productSearchRequest.SizeIds =
                        jsonRefinementGroup.SelectedRefinements;
                    break;

                default:
                    break;
                }
            }
            return(productSearchRequest);
        }
예제 #25
0
        public void SendMail(string from, string to, string subject, string body)
        {
            MailMessage message = new MailMessage();

            message.From = new MailAddress(from);
            message.To.Add(new MailAddress(to));
            message.Subject    = subject;
            message.Body       = body;
            message.IsBodyHtml = true;
            message.Priority   = MailPriority.Normal;

            string userName = ApplicationSettingsFactory.GetApplicationSettings().EmailAddress;
            string password = ApplicationSettingsFactory.GetApplicationSettings().Credential;


            SmtpClient smtp = new SmtpClient("smtp.gmail.com", Convert.ToInt32(587));

            smtp.Credentials = new NetworkCredential(userName, password);
            smtp.EnableSsl   = true;
            smtp.Send(message);
        }
예제 #26
0
        public NationalQuotaRepository()
        {
            base.ServiceURL = ApplicationSettingsFactory.GetApplicationSettings().BaseURL + serviceName;

            ChildGetAllLookup.Add(typeof(Industry), "qryIN");
            ChildGetAllLookup.Add(typeof(BusinessSize), "qryBS");
            ChildGetAllLookup.Add(typeof(Level), "qryLE");
            ChildGetAllLookup.Add(typeof(Citizenship), "qryCI");
            ChildGetAllLookup.Add(typeof(PointAcquisition), "qryPA");
            ChildGetAllLookup.Add(typeof(LevelAcquisition), "qryLA");



            ChildGetLookup.Add(typeof(Industry), "getIN");
            ChildGetLookup.Add(typeof(BusinessSize), "getBS");
            ChildGetLookup.Add(typeof(Level), "getLE");
            ChildGetLookup.Add(typeof(Citizenship), "getCI");
            ChildGetLookup.Add(typeof(PointAcquisition), "getPA");
            ChildGetLookup.Add(typeof(LevelAcquisition), "getLA");



            ChildAddOrUpdateLookup.Add(typeof(Industry), "setIN");
            ChildAddOrUpdateLookup.Add(typeof(BusinessSize), "setBS");
            ChildAddOrUpdateLookup.Add(typeof(Level), "setLE");
            ChildAddOrUpdateLookup.Add(typeof(Citizenship), "setCI");
            ChildAddOrUpdateLookup.Add(typeof(Citizenship[]), "arrCI");
            ChildAddOrUpdateLookup.Add(typeof(PointAcquisition), "setPA");
            ChildAddOrUpdateLookup.Add(typeof(LevelAcquisition), "setLA");



            ChildDeleteLookup.Add(typeof(Industry), "delIN");
            ChildDeleteLookup.Add(typeof(BusinessSize), "delBS");
            ChildDeleteLookup.Add(typeof(Level), "delLE");
            ChildDeleteLookup.Add(typeof(Citizenship), "delCI");
            ChildDeleteLookup.Add(typeof(PointAcquisition), "delPA");
            ChildDeleteLookup.Add(typeof(LevelAcquisition), "delLA");
        }
예제 #27
0
        public SystemRepository()
        {
            base.ServiceURL = ApplicationSettingsFactory.GetApplicationSettings().BaseURL + serviceName;

            ChildAddOrUpdateLookup.Add(typeof(Nationality), "setNA");
            ChildGetAllLookup.Add(typeof(Nationality), "qryNA");
            ChildGetLookup.Add(typeof(Nationality), "getNA");
            ChildAddOrUpdateLookup.Add(typeof(Currency), "setCU");
            ChildGetAllLookup.Add(typeof(Currency), "qryCU");
            ChildGetLookup.Add(typeof(Currency), "getCU");
            ChildAddOrUpdateLookup.Add(typeof(UserInfo), "setUS");
            ChildGetAllLookup.Add(typeof(UserInfo), "qryUS");
            ChildGetLookup.Add(typeof(UserInfo), "getUS");

            ChildDeleteLookup.Add(typeof(Nationality), "delNA");
            ChildDeleteLookup.Add(typeof(UserInfo), "delUS");
            ChildDeleteLookup.Add(typeof(Currency), "delCU");
            ChildGetLookup.Add(typeof(KeyValuePair <string, string>), "getDE");
            ChildGetAllLookup.Add(typeof(KeyValuePair <string, string>), "qryDE");

            ChildAddOrUpdateLookup.Add(typeof(KeyValuePair <string, string>[]), "arrDE");
        }
예제 #28
0
        /// <summary>
        /// Log support related
        /// </summary>
        /// <param name="message"></param>
        /// <param name="messageType"></param>
        private void SupportLog(string message, MessageType messageType)
        {
            var currentContext = HttpContext.Current;

            string logDetails, filePath = "No file path found.", url = "No url found to be reported.", raisedOn = DateTime.Now.ToString();

            if (currentContext != null)
            {
                filePath = currentContext.Request.FilePath;
                url      = currentContext.Request.Url.AbsoluteUri;
                string a = currentContext.Request.UserHostAddress;
                logDetails = message;
                string LoggerName = ApplicationSettingsFactory.GetApplicationSettings().SupportLoggerName;
                string path       = currentContext.Server.MapPath("~/App_Data/Log/" + LoggerName + ".xml");

                XmlDocument doc = new XmlDocument();
                doc.Load(path);

                XmlNode    root      = doc.DocumentElement;
                XmlElement error     = doc.CreateElement(messageType.ToString());
                XmlElement errorPath = doc.CreateElement("Path");
                errorPath.InnerText = filePath;
                XmlElement errorUrl = doc.CreateElement("Url");
                errorUrl.InnerText = url;
                XmlElement errorDetails = doc.CreateElement("Details");
                errorDetails.InnerText = logDetails;
                XmlElement errorDateTime = doc.CreateElement("DateTime");
                errorDateTime.InnerText = raisedOn;

                error.AppendChild(errorPath);
                error.AppendChild(errorUrl);
                error.AppendChild(errorDetails);
                error.AppendChild(errorDateTime);
                root.InsertAfter(error, root.FirstChild);

                doc.Save(path);
            }
        }
예제 #29
0
        private static async Task SendMailAsync(MailMessage message)
        {
            string  apiKey = ApplicationSettingsFactory.GetApplicationSettings().APIKey;
            dynamic sg     = new SendGridAPIClient(apiKey);

            SendGrid.Helpers.Mail.Email from = new SendGrid.Helpers.Mail.Email(message.From.ToString());
            SendGrid.Helpers.Mail.Email to   = new SendGrid.Helpers.Mail.Email(message.To.ToString());

            Content content;

            if (message.IsBodyHtml)
            {
                content = new Content("text/html", message.Body);
            }
            else
            {
                content = new Content("text/plain", message.Body);
            }

            Mail mail = new Mail(from, message.Subject, to, content);

            dynamic response = await sg.client.mail.send.post(requestBody : mail.Get());
        }
        public bool ReadConfigFormModbusConfigFile()
        {
            bool success = true;

            try
            {
                ReadConfigFile();
            }
            catch (Exception ex)
            {
                string modbusConfigRelativePath =
                    ApplicationSettingsFactory.GetApplicationSettings().ModbusConfigFilePath;
                string modbusConfigFile = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,
                                                                 modbusConfigRelativePath);

                string message = "\rModbus配置文件:\r" + modbusConfigFile + "中\r" + ex.Message;
                LoggingFactory.GetLogger().WriteDebugLogger(message);
                throw new Exception(message);
            }


            return(success);
        }