예제 #1
0
파일: Mobile.cs 프로젝트: NStef26/NBPLogger
 public Mobile(string mobileID, MobileLog MobileLog)
 {
     MobileID     = mobileID;
     TimeStamp    = MobileLog.TimeStamp;
     Password     = MobileLog.Password;
     MobileNumber = MobileLog.MobileNumber;
 }
예제 #2
0
파일: Handle.cs 프로젝트: zhangwxyc/BPM
    /// <summary>
    /// 审批动作
    /// </summary>
    /// <param name="userCode"></param>
    /// <param name="sn"></param>
    /// <param name="instanceId"></param>
    /// <param name="result">Y/N</param>
    /// <param name="remark">审批意见</param>
    /// <returns></returns>
    public static string Approve(string userCode, string sn, string instanceId, string result, string remark)
    {
        MobileLog.InsertLog("approve", string.Format("userCode={0},sn={1},instanceId={2},result={3},remark={4}", DeCode(userCode), sn, instanceId, result, remark), "", DeCode(userCode));
        result = result == "Y" ? "同意" : "不同意";
        bool isSuccess = AppflowFactory.GetAppflow(instanceId).StartApproval(sn, instanceId, remark, result);

        return(JsonHelper.JsonSerializer(isSuccess));
    }
예제 #3
0
파일: Handle.cs 프로젝트: zhangwxyc/BPM
    /// <summary>
    /// 加签操作
    /// </summary>
    /// <param name="fromUserCode">加签人</param>
    /// <param name="toUserCode">被加签人</param>
    /// <param name="sn">SN号</param>
    /// <param name="sn">实例ID</param>
    /// <param name="remark">加签意见</param>
    /// <returns></returns>
    public static string AddSign(string fromUserCode, string toUserCode, string sn, string instanceId, string remark)
    {
        MobileLog.InsertLog("addsign", string.Format("fromUserCode={0},toUserCode={1},sn={2},instanceId={3},remark={4}", DeCode(fromUserCode), toUserCode, sn, instanceId, remark), "", DeCode(fromUserCode));
        fromUserCode = DeCode(fromUserCode);
        bool isSuccess = false;

        //todo:加签的实现(fromUserCode,toUserCode,sn)

        isSuccess = AppflowFactory.GetAppflow(instanceId).AddSign(fromUserCode, toUserCode, sn, instanceId, remark);
        return(JsonHelper.JsonSerializer(isSuccess));
    }
예제 #4
0
파일: Client.cs 프로젝트: NStef26/NBPLogger
        public static void Start()
        {
            var logger = new LoggerConfiguration()
                         .WriteTo.Console()
                         .CreateLogger();
            int i = 0;

            while (true)
            {
                BasicLogger basic = new BasicLogger();

                if (i % 3 == 0)
                {
                    basic = new MailLog(RandomGenerator.GenerateRandomMail(), DateTime.UtcNow, RandomGenerator.GenerateRandomPassword());
                }
                if (i % 3 == 1)
                {
                    basic = new MobileLog(RandomGenerator.GenerateRandomMobileNumber(), DateTime.UtcNow, RandomGenerator.GenerateRandomPassword());
                }
                if (i % 3 == 2)
                {
                    basic = new UsernameLog(RandomGenerator.GenerateRandomUsername(), DateTime.UtcNow, RandomGenerator.GenerateRandomPassword());
                }

                logger.Information(JsonConvert.SerializeObject(basic));
                i++;
                if (i > 100)
                {
                    break;
                }

                if (basic is MailLog)
                {
                    DataProvider.AddMail(basic as MailLog);
                }
                if (basic is MobileLog)
                {
                    DataProvider.AddMobile(basic as MobileLog);
                }
                if (basic is UsernameLog)
                {
                    DataProvider.AddUsername(basic as UsernameLog);
                }

                Thread.Sleep(300);
            }
        }
예제 #5
0
        public static void AddMobile(MobileLog MobileLog)
        {
            ISession       session = SessionManager.GetSession();
            Mobile         mobile  = new Mobile(Guid.NewGuid().ToString(), MobileLog);
            var            t1      = TimeUuid.NewId((DateTimeOffset)MobileLog.TimeStamp);
            DateTime       t       = MobileLog.TimeStamp;
            DateTimeOffset dto     = new DateTimeOffset(t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second, t.Millisecond, TimeZone.CurrentTimeZone.GetUtcOffset(t));

            if (session == null)
            {
                return;
            }

            var ps = session.Prepare("insert into \"Mobile\" (\"MobileID\", \"TimeStamp\", \"Password\", \"MobileNumber\") VALUES (?, ?, ?, ?)");

            var batch = new BatchStatement().Add(ps.Bind(t1, dto.ToUniversalTime(), mobile.Password, mobile.MobileNumber));

            RowSet mobileData = session.Execute(batch);
        }