Пример #1
0
        public static EmailMessage RunTemplate(this MemoryCache cache, string name, string to, object model, string language = null)
        {
            var key = "RunTemplate_" + name;

            cache.GetOrCreate(key, () =>
            {
                var context       = new MailerContext();
                Template template = null;
                if (language != null)
                {
                    template = context.Templates[name + "." + language, string.Empty];
                }
                if (template == null)
                {
                    template = context.Templates[name, string.Empty];
                }
                Engine.Razor.AddTemplate(template.body, name);
                Engine.Razor.AddTemplate(template.subject, name + "|subject");
                return(string.Empty);
            });
            var body    = Engine.Razor.RunCompile(name, model: model);
            var subject = Engine.Razor.RunCompile(name + "|subject", model: model);

            return(new EmailMessage
            {
                PartitionKey = TimeId.NewSortableId(),
                RowKey = string.Empty,
                Subject = subject,
                Body = body,
                To = to
            });
        }
Пример #2
0
        public void TestTimeId()
        {
            var date1 = new DateTime(2000, 1, 1, 0, 0, 0);
            var a     = TimeId.GetTimeId(date1);

            Assert.AreEqual(date1, TimeId.ToDateTime(a));
        }
Пример #3
0
        public void TestNewSortableId()
        {
            var a = TimeId.NewSortableId();
            var b = TimeId.NewSortableId();

            Assert.AreNotEqual(a, b);
        }
Пример #4
0
 // Token: 0x0600183C RID: 6204 RVA: 0x0008E058 File Offset: 0x0008C258
 public ITimeEntry Start(TimeId timeId)
 {
     if (!TimeTracker.Enabled)
     {
         return(DummyTimeEntry.Singleton);
     }
     return(this.GetTimeTracker().Start(timeId));
 }
Пример #5
0
        protected override void Write(LogEventInfo logEvent)
        {
            var table   = _client.GetGenericCloudTable <LogItem>(_setting.Name, _setting);
            var key     = TimeId.GetTimeId(DateTime.UtcNow, this.SortAscending);
            var logItem = CreateLogItem(key, logEvent);

            table.Insert(logItem, true);
        }
        // Token: 0x0600181F RID: 6175 RVA: 0x0008D9B0 File Offset: 0x0008BBB0
        public TimeEntry Start(TimeId timeId)
        {
            if (this.Root != null)
            {
                this.Root.VerifyThread();
            }
            TimeEntry timeEntry = new TimeEntry(timeId, new Action <TimeEntry>(this.End));

            this.callStack.Push(timeEntry);
            return(timeEntry);
        }
Пример #7
0
 // Token: 0x0600182C RID: 6188 RVA: 0x0008DC18 File Offset: 0x0008BE18
 public TimeEntry(TimeId timeId, Action <TimeEntry> onRelease)
 {
     this.TimeId    = timeId;
     this.ThreadId  = ThreadIdProvider.ManagedThreadId;
     this.StartTime = TimeProvider.UtcNow;
     this.EndTime   = DateTime.MinValue;
     if (onRelease == null)
     {
         throw new ArgumentNullException("onRelease");
     }
     this.onRelease = onRelease;
 }
Пример #8
0
        public void TestSortableId()
        {
            var date1 = new DateTime(2000, 1, 1, 0, 0, 0);
            var date2 = date1.AddSeconds(1);
            var a     = TimeId.NewSortableId(date1);
            var b     = TimeId.NewSortableId(date2);

            Assert.IsTrue(a.CompareTo(b) > 0);
            Assert.AreEqual(date2, TimeId.ToDateTime(b));

            var c = TimeId.NewSortableId(date1, true);
            var d = TimeId.NewSortableId(date2, true);

            Assert.IsTrue(c.CompareTo(d) < 0);
        }
Пример #9
0
        LogItem CreateLogItem(string key, LogEventInfo logEventInfo)
        {
            var logItem = new LogItem
            {
                PartitionKey = key,
                RowKey       = TimeId.NewSortableId(logEventInfo.TimeStamp, this.SortAscending),
                LogDateTime  = logEventInfo.TimeStamp,
            };

            foreach (var property in _properties)
            {
                logItem[property.Name] = property.Value.Render(logEventInfo);
            }
            return(logItem);
        }
Пример #10
0
    private static Hashtable GetNewHst(bool CreateNewID, string RESID, string UserID)
    {
        Hashtable hst = new Hashtable();

        if (CreateNewID)
        {
            hst.Add("ID", TimeId.CurrentMilliseconds(30).ToString());
        }
        hst.Add("RESID", RESID);
        hst.Add("RELID", 0);
        hst.Add("CRTID", UserID);
        hst.Add("CRTTIME", DateTime.Now);
        hst.Add("EDTID", UserID);
        hst.Add("EDTTIME", DateTime.Now);
        return(hst);
    }
Пример #11
0
        // Token: 0x06001823 RID: 6179 RVA: 0x0008DB04 File Offset: 0x0008BD04
        private static IDictionary <TimeId, string> BuildShortenedIds()
        {
            Type typeFromHandle  = typeof(TimeId);
            Type typeFromHandle2 = typeof(TimeIdAttribute);
            int  length          = Enum.GetValues(typeFromHandle).Length;
            IDictionary <TimeId, string> dictionary = new Dictionary <TimeId, string>(length);

            foreach (FieldInfo fieldInfo in from x in typeFromHandle.GetTypeInfo().DeclaredFields
                     where x.IsStatic && x.IsPublic
                     select x)
            {
                TimeIdAttribute[] array = (TimeIdAttribute[])fieldInfo.GetCustomAttributes(typeFromHandle2, false);
                TimeId            key   = (TimeId)fieldInfo.GetValue(null);
                dictionary.Add(key, array[0].Name);
            }
            return(dictionary);
        }
Пример #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        KeyWord     = Request["keyWordValue"] == null ? "" : Request["keyWordValue"].ToString();
        RecID       = Request["RecID"] == null ? "" : Request["RecID"].ToString();
        NodeID      = Request["NodeID"] == null || string.IsNullOrWhiteSpace(Request["NodeID"].ToString()) ? 0 : Convert.ToInt64(Request["NodeID"].ToString());
        OpenDiv     = Request["OpenDiv"] == null ? "" : Request["OpenDiv"].ToString();
        GridID      = Request["GridID"] == null ? "CenterGrid" + KeyWord : Request["GridID"].ToString();
        ChildGridID = Request["ChildGridID"] == null ? "" : Request["ChildGridID"].ToString();

        ActionType = Request["ActionType"] == null ? "" : Request["ActionType"].ToString();
        DeptID     = Request["DeptID"] == null ? "" : Request["DeptID"].ToString();
        DeptID     = RecID;
        if (string.IsNullOrWhiteSpace(ActionType))
        {
            SaveID = TimeId.CurrentMilliseconds(30).ToString();
        }
        else
        {
            SaveID = DeptID;
        }

        ShowOrder = Common.GetDepartOrder(DeptID, "");

        string SelectSql = "";

        if (ActionType == "Edit")
        {
            SelectSql = "select ID,PID , NAME AS Name ,DEP_TYPE AS [Type]  FROM Cms_Department where ID=(SELECT  TOP(1) PID  FROM Cms_Department  WHERE ID='" + DeptID + "')";
        }
        else
        {
            SelectSql = "select ID,PID , NAME AS Name ,DEP_TYPE AS [Type]  FROM Cms_Department where ID='" + DeptID + "'";
        }

        Dictionary <string, object> QueryValueDic = new Dictionary <string, object>();

        QueryValueDic.Add("ID", "");
        QueryValueDic.Add("Name", "");
        if (Common.GetOneRowValueBySQL(SelectSql, ref QueryValueDic))
        {
            PID     = QueryValueDic["ID"].ToString();
            PIDName = QueryValueDic["Name"].ToString();
        }
    }
Пример #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentUserID = CurrentUser.ID;
        Services Resource = new Services();

        ActionType = "XZGL";

        ResID = Request["ResID"] == null ? "" : Request["ResID"].ToString();
        RecID = Request["RecID"] == null ? "" : Request["RecID"].ToString();
        if (Request["SearchType"] != null)
        {
            SearchType = Request["SearchType"];
        }
        KeyWord    = Request["keyWordValue"] == null ? "" : Request["keyWordValue"].ToString();
        NodeID     = Request["NodeID"] == null || string.IsNullOrWhiteSpace(Request["NodeID"].ToString()) ? 0 : Convert.ToInt64(Request["NodeID"].ToString());
        ActionType = Request["ActionType"] == null ? "" : Request["ActionType"].ToString();
        // OpenDiv = Request["OpenDiv"] == null ? "" : Request["OpenDiv"].ToString();
        gridID = Request["gridID"] == null ? "" : Request["gridID"].ToString();
        DeptID = Request["DeptID"] == null ? "" : Request["DeptID"].ToString();

        if (!string.IsNullOrWhiteSpace(DeptID))
        {
            DeptName = Common.GetOneRowValueBySQL("select ID,PID , NAME AS Name ,DEP_TYPE AS [Type]  FROM Cms_Department where ID=" + DeptID, "Name");
        }
        else if (!string.IsNullOrWhiteSpace(RecID))
        {
            DeptID   = Common.GetOneRowValueBySQL("select * FROM " + Resource.GetTableNameByResourceid(ResID) + " where ID=" + RecID, "DeparmentID");
            DeptName = Common.GetOneRowValueBySQL("select ID,PID , NAME AS Name ,DEP_TYPE AS [Type]  FROM Cms_Department where ID=" + DeptID, "Name");
        }

        if (string.IsNullOrWhiteSpace(ActionType))
        {
            SaveID = TimeId.CurrentMilliseconds(30).ToString();
        }

        XZRecID = TimeId.CurrentMilliseconds(30).ToString();
        if (ActionType == "edit" || !string.IsNullOrWhiteSpace(RecID))
        {
            SaveType = "1";
        }
        UserDefinedSql = "1300";//"select a.id, EMP_ID 账号,EMP_NAME 姓名,EMP_HANDPHONE 联系方式 ,[Status], Sex 性别, EMP_EMAIL 邮箱 , HeadShip 职务, a.[HOST_ID],b.NAME  FROM dbo.CMS_EMPLOYEE AS a INNER JOIN dbo.CMS_DEPARTMENT AS b ON a.HOST_ID=b.ID WHERE EMP_ID=";
    }
Пример #14
0
 protected override void Write(AsyncLogEventInfo[] logEvents)
 {
     try
     {
         var table = _client.GetGenericCloudTable <LogItem>(_setting.Name, _setting);
         var key   = TimeId.GetTimeId(DateTime.UtcNow, this.SortAscending);
         var items = logEvents.Select(log => CreateLogItem(key, log.LogEvent));
         table.BulkInsert(items, true);
         foreach (var info in logEvents)
         {
             info.Continuation(null);
         }
     }
     catch (Exception ex)
     {
         foreach (var info in logEvents)
         {
             info.Continuation(ex);
         }
     }
 }
Пример #15
0
        static void postJob(SchedulerContext context, JobItem jobItem, int statusCode, string result, int runTime)
        {
            var jobLog = new JobLog
            {
                PartitionKey = TimeId.NewSortableId(),
                RowKey       = string.Empty,
                JobGroup     = jobItem.PartitionKey,
                JobName      = jobItem.RowKey,
                StatusCode   = statusCode,
                Result       = result,
                RunTime      = runTime,
            };

            context.JobLogs.Insert(jobLog, true);
            jobItem.LastRun           = DateTime.UtcNow;
            jobItem.LastRunResult     = jobLog.Result;
            jobItem.LastRunStatusCode = jobLog.StatusCode;
            if (jobLog.StatusCode >= 200 && jobLog.StatusCode < 400)
            {
                jobItem.LastSuccessRun = jobItem.LastRun;
            }
            context.JobItems.Replace(jobItem);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentUserID = CurrentUser.ID;

        ActionType = "XZGL";

        ResID      = Request["ResID"] == null ? "" : Request["ResID"].ToString();
        RecID      = Request["RecID"] == null ? "" : Request["RecID"].ToString();
        KeyWord    = Request["keyWordValue"] == null ? "" : Request["keyWordValue"].ToString();
        NodeID     = Request["NodeID"] == null || string.IsNullOrWhiteSpace(Request["NodeID"].ToString()) ? 0 : Convert.ToInt64(Request["NodeID"].ToString());
        ActionType = Request["ActionType"] == null ? "" : Request["ActionType"].ToString();
        // OpenDiv = Request["OpenDiv"] == null ? "" : Request["OpenDiv"].ToString();
        gridID = Request["gridID"] == null ? "" : Request["gridID"].ToString();
        DeptID = Request["DeptID"] == null ? "" : Request["DeptID"].ToString();

        if (!string.IsNullOrWhiteSpace(DeptID))
        {
            DeptName = Common.GetOneRowValueBySQL("select ID,PID , NAME AS Name ,DEP_TYPE AS [Type]  FROM Cms_Department where ID=" + DeptID, "Name");
        }
        else if (!string.IsNullOrWhiteSpace(RecID))
        {
            Dictionary <string, object> QueryValueDic = new Dictionary <string, object>();
            QueryValueDic.Add("DeptID", "");
            QueryValueDic.Add("DeptName", "");
            QueryValueDic.Add("IsSysRecID", "");

            if (Common.GetOneRowValueBySQL(" SELECT * FROM (SELECT a.id, b.NAME DeptName, a.HOST_ID DeptID, 1 IsSysRecID  FROM dbo.CMS_EMPLOYEE AS a INNER JOIN dbo.CMS_DEPARTMENT AS b  ON a.HOST_ID = b.id UNION SELECT id, Deparment DeptName, DeparmentID DeptID, 0  FROM dbo.EmployeeInfo) u WHERE id =" + RecID, ref QueryValueDic))
            {
                DeptID     = QueryValueDic["DeptID"].ToString();
                DeptName   = QueryValueDic["DeptName"].ToString();
                IsSysRecID = QueryValueDic["IsSysRecID"].ToString();
            }
        }

        SaveID = TimeId.CurrentMilliseconds(30).ToString();
    }