コード例 #1
0
ファイル: U.cs プロジェクト: Xiaoyuyexi/LMS
 public static void SaveMSessions()
 {
     var ms = new Model.MSessions();
     ms.MID = Client.MID;
     ms.IP = HttpContext.Current.Request.UserHostAddress;
     ms.SessionId = HttpContext.Current.Session.SessionID;
     DAL.Update.MSessions(ms);
 }
コード例 #2
0
ファイル: Get.cs プロジェクト: Xiaoyuyexi/LMS
 public static MSessions MSessions(int MID)
 {
     var m = new MSessions();
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter("@MID",MID)
             
         };
         var dr = SqlHelper.ExecuteReader(C.conn, CommandType.StoredProcedure, "Get_MSessions", param);
         if (dr.Read())
         {
             m.Code = 0;
             m.MID = MID;
             m.SessionId = Convert.ToString(dr["SessionId"]);
             m.IP = Convert.ToString(dr["IP"]);
             if (DBNull.Value != dr["Created"])
                 m.Created = Convert.ToDateTime(dr["Created"]);
         }
         else
         {
             m.Code = 101;
             m.Message = "no records";
         }
         dr.Close();
     }
     catch (Exception ex)
     {
         m.Code = 300;
         log.Fatal(ex.Message);
         log.FatalException(ex.Message, ex);
     }
     return m;
 }
コード例 #3
0
ファイル: Update.cs プロジェクト: Xiaoyuyexi/LMS
 public static R MSessions(MSessions ms)
 {
     var m = new R();
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter("@MID",ms.MID),
             new SqlParameter("@SessionId",ms.SessionId),
             new SqlParameter("@IP",ms.IP)
         };
         var r = SqlHelper.ExecuteNonQuery(C.conn, CommandType.StoredProcedure, "Update_MSessions", param);
         m.Code = 0;
         m.Value = 0;
         m.Message = "sucess";
     }
     catch (Exception ex)
     {
         m.Code = 300;
         m.Message = ex.Message;
         log.Fatal(ex.Message);
         log.FatalException(ex.Message, ex);
     }
     return m;
 }