Exemplo n.º 1
0
        public static Result <object> CanCancelSession(DAL.Session ses)
        {
            Result <object> result = new Result <object>();

            if (!ses.Status.Equals("C"))
            {
                if (HasSessionStarted(ses))
                {
                    result.isSuccess = false;
                    result.message   = "Session has already started";
                }
                else
                {
                    result.isSuccess = true;
                    result.message   = "You Can Cancel the session";
                }
            }
            else
            {
                result.isSuccess = false;
                result.message   = "Session is already cancelled";
            }

            return(result);
        }
Exemplo n.º 2
0
        public static Result <object> CanDisEnrolFromSession(DAL.Session ses)
        {
            Result <object> result = new Result <object>();

            if (ses.Status.Equals("A"))
            {
                if (HasSessionStarted(ses))
                {
                    result.isSuccess = false;
                    result.message   = "Session has already started";
                }
                else
                {
                    result.isSuccess = true;
                    result.message   = "You Can Disenrol";
                }
            }
            else
            {
                result.isSuccess = false;
                result.message   = "Session is Not Active";
            }

            return(result);
        }
Exemplo n.º 3
0
        public static bool HasSessionStarted(DAL.Session ses)
        {
            bool result;

            /* Compare if session has started -> true, if not -> false */
            result = ses.StartDateTime.CompareTo(DateTime.Now) < 0;

            return(result);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Sessions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSessions(Session session)
 {
     base.AddObject("Sessions", session);
 }
 /// <summary>
 /// Create a new Session object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="typeSessionId">Initial value of the TypeSessionId property.</param>
 /// <param name="employeId">Initial value of the EmployeId property.</param>
 /// <param name="nom">Initial value of the Nom property.</param>
 /// <param name="circuitId">Initial value of the CircuitId property.</param>
 /// <param name="date_Id">Initial value of the Date_Id property.</param>
 /// <param name="etatSessionsId">Initial value of the EtatSessionsId property.</param>
 /// <param name="nbParticipant">Initial value of the NbParticipant property.</param>
 public static Session CreateSession(global::System.Int32 id, global::System.Int32 typeSessionId, global::System.Int32 employeId, global::System.String nom, global::System.Int32 circuitId, global::System.Int32 date_Id, global::System.Int32 etatSessionsId, global::System.Int32 nbParticipant)
 {
     Session session = new Session();
     session.Id = id;
     session.TypeSessionId = typeSessionId;
     session.EmployeId = employeId;
     session.Nom = nom;
     session.CircuitId = circuitId;
     session.Date_Id = date_Id;
     session.EtatSessionsId = etatSessionsId;
     session.NbParticipant = nbParticipant;
     return session;
 }