Пример #1
0
 public int UpdateLapse(Lapse lapse)
 {
     try
     {
         if (lapse.Name.Equals(string.Empty))
             return 1;
         else if (lapse.InitialDate.Equals(string.Empty))
             return 3;
         else if (lapse.FinalDate.Equals(string.Empty))
             return 4;
         else if (lapse.Status.Equals(string.Empty))
             return 5;
         else if (lapse.InitialDate > lapse.FinalDate)
             return 6;
         else if (lapse.InitialDate < DateTime.Today)
             return 7;
         else
         {
             lapseData.UpdateLapse(lapse);
             return 0;
         }
     }
     catch (SqlException)
     {
         return 2;
     }
 }
Пример #2
0
        protected Enrollment CreateEnrollment()
        {
            Lapse lapse = new Lapse();
            Enrollment enrollment = new Enrollment();
            lapse = lapseData.SendLapse(lapseData.DataTableLapseOn());
            enrollment.UserName = Session["User-UserName"].ToString();
            enrollment.Lapse = lapse;

            if (lapse == null)
                return null;
            else
                return enrollment;
        }
Пример #3
0
 public void InsertLapse(Lapse lapse)
 {
     connection = ManageDatabaseConnection("Open");
     using (SqlCommand insert = new SqlCommand(@"InsertLapse", connection))
     {
         insert.CommandType = CommandType.StoredProcedure;
         insert.Parameters.Add("@Name", SqlDbType.VarChar).Value = lapse.Name;
         insert.Parameters.Add("@InitialDate", SqlDbType.Date).Value = lapse.InitialDate;
         insert.Parameters.Add("@FinalDate", SqlDbType.Date).Value = lapse.FinalDate;
         insert.Parameters.Add("@Status", SqlDbType.Bit).Value = lapse.Status;
         insert.ExecuteNonQuery();
     }
     connection = ManageDatabaseConnection("Close");
 }
Пример #4
0
        public Lapse SendLapse(DataTable dataTableLapse)
        {
            if (dataTableLapse.Rows.Count > 0)
            {
                Lapse lapse = new Lapse();
                lapse.Id = Convert.ToInt32(dataTableLapse.Rows[0]["Id"]);
                lapse.Name = dataTableLapse.Rows[0]["Name"].ToString();
                lapse.InitialDate = Convert.ToDateTime(dataTableLapse.Rows[0]["InitialDate"]);
                lapse.FinalDate = Convert.ToDateTime(dataTableLapse.Rows[0]["FinalDate"]);
                lapse.Status = Convert.ToBoolean(dataTableLapse.Rows[0]["Status"]);
                return lapse;

            }
            else
                return null;
        }