コード例 #1
0
ファイル: Login.cs プロジェクト: zhaoy615/Guizhoule
        /// <summary>
        /// 判断登陆用户信息(如无则添加)
        /// </summary>
        /// <param name="md"></param>
        /// <returns></returns>
        public mjuserinfo AddUser(mjuserinfo md, GameSession session)
        {
            mjuserinfoDAL dal    = new mjuserinfoDAL();
            mjuserinfo    model  = dal.GetModel(md.openid);
            LogDAL        Ldal   = new LogDAL();
            login_log     Lmodel = new login_log();

            if (model == null)
            {
                try
                {
                    md.addtime = DateTime.Now;
                    // string fileName =Guid.NewGuid() + ".jpg"; ;
                    //  string imgurl = PictureUtility.SavePicture(md.headimg, out fileName);//将图片保存至本地返回详细路径和文件名
                    //    if (!string.IsNullOrEmpty(imgurl))//验证是否保存成功
                    //     md.headimg = PutObjectSample.PutObjectFromFile(md.headimg, fileName, -1);//服务器没有图片,因此不能存储至图片服务器

                    dal.Add(md);
                    Lmodel.ID          = Guid.NewGuid().ToString();
                    Lmodel.login_state = 1;
                    Lmodel.login_time  = DateTime.Now;
                    Lmodel.openid      = md.openid;
                    Lmodel.City        = md.city;
                    Ldal.Add(Lmodel);
                }
                catch (Exception ex)
                {
                    session.Logger.Error(ex);
                }
                return(dal.GetModel(md.openid));;
            }
            else
            {
                try
                {
                    md.id = model.id;
                    //if (!md.Oldheadimg.Equals(model.Oldheadimg))
                    //{
                    //    string fileName = Guid.NewGuid() + ".jpg"; ;
                    //    //服务器没有图片,因此不能存储至图片服务器  md.headimg = PutObjectSample.PutObjectFromFile(md.headimg, fileName, -1);
                    //}
                    dal.Update(md);
                    Lmodel.ID          = Guid.NewGuid().ToString();
                    Lmodel.login_state = 1;
                    Lmodel.login_time  = DateTime.Now;
                    Lmodel.openid      = md.openid;
                    Lmodel.City        = md.city;
                    Ldal.Add(Lmodel);
                }
                catch (Exception ex)
                {
                    session.Logger.Error(ex);
                }

                return(md);
            }
        }
コード例 #2
0
        /// <summary>
        /// 写入日志
        /// </summary>
        /// <param name="logType">日志类型</param>
        /// <param name="title">日志标题</param>
        /// <param name="message">日志消息</param>
        public static void WriteLog(LogTypeEnum logType, string title, string message)
        {
            LogModel logM = new LogModel(logType, title, message);

            if (logM.Validation())
            {
                logDal.Add(logM);
            }
        }
コード例 #3
0
    protected static void Log(string pageName, string level, string message)
    {
        LogDAL logDAL = new LogDAL();
        LogDTO dto    = new LogDTO();

        dto.System  = System;
        dto.Page    = pageName;
        dto.Level   = level;
        dto.Message = message;
        logDAL.Add(dto);
    }
コード例 #4
0
        public void AddTest()
        {
            LogModel logM = new LogModel(LogTypeEnum.OperationLog, "测试日志", "测试添加日志");

            logDal.Add(logM);
        }
コード例 #5
0
 public long Add(long userId, string message)
 {
     return(dal.Add(userId, message));
 }