public string SaveFeedBack(string feedback)
        {
            try
            {
                var query             = from a in connection.Appointment_Tables where a.A_Id == connection.Appointment_Tables.Max(ab => ab.A_Id) select a;
                Appointment_Table apt = query.First();
                apt.FeedBack = feedback;
                connection.SubmitChanges();

                return("Thanks For Your Kind of Information");
            }
            catch (Exception)
            {
                return("Sorry Database Has Problems");
            }
        }
 public bool SaveUser(string name, string phone, string email)
 {
     try
     {
         Appointment_Table apt = new Appointment_Table();
         apt.Name  = name;
         apt.Phone = phone;
         apt.Email = email;
         connection.Appointment_Tables.InsertOnSubmit(apt);
         connection.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public string rejectRequest(int id)
 {
     try
     {
         var query             = from a in connection.Appointment_Tables where a.A_Id == id select a;
         Appointment_Table apt = query.First();
         if (SendRejection(apt.Email) == true)
         {
             apt.Accept = false;
             connection.SubmitChanges();
             return("Request Rejected");
         }
         else
         {
             return("No InerNet Connection");
         }
     }
     catch (Exception)
     {
         return("No InerNet Connection");
     }
 }
        public string RejectRequest(int id)
        {
            var query = from a in connection.Appointment_Tables
                        where a.A_Id == id
                        select a;

            Appointment_Table apt = query.First();

            var      q2      = from a in connection.Emp_Tables where a.Id == apt.Emp_Id select a.Name;
            string   name    = q2.First();
            string   mail    = query.First().Email;
            DateTime date    = (DateTime)apt.Req_Date;
            var      d       = date.Date;
            string   reqDate = d.Day.ToString() + "/" + d.Month.ToString() + "/" + d.Year.ToString();
            bool     result1 = CreatePdf(apt.A_Id.ToString(), apt.Name, name, reqDate, apt.Time);

            if (result1 == true)
            {
                bool result2 = MessageSend(apt.Email, apt.A_Id);
                if (result2 == true)
                {
                    apt.Seen = true;
                    connection.SubmitChanges();
                    //return true;
                    return("Request Accepted");
                }
                else
                {
                    return("No Internet Connection");
                }
            }
            else
            {
                return("Pdf Creation Problem");
            }
        }
 public string AppRequest(int empId, string pupose, DateTime reqDate)
 {
     try
     {
         var query             = from a in connection.Appointment_Tables where a.A_Id == connection.Appointment_Tables.Max(ab => ab.A_Id) select a;
         Appointment_Table apt = query.First();
         apt.Emp_Id   = empId;
         apt.Accept   = false;
         apt.Purpose  = pupose;
         apt.Date     = reqDate.Date;
         apt.Req_Date = DateTime.Now;
         var      query2 = from a in connection.Appointment_Tables where a.Emp_Id == empId && a.Date == reqDate.Date && a.Time == connection.Appointment_Tables.Max(at => at.Time) select a;
         DateTime date   = DateTime.Now.Date.AddHours(10);
         if (reqDate == DateTime.Today)
         {
             if (query2.Count() == 0)
             {
                 if (DateTime.Now > date)
                 {
                     apt.Time = DateTime.Now.AddMinutes(15).ToShortTimeString();
                     connection.SubmitChanges();
                     return("Your Request Sent ");
                 }
                 else
                 {
                     apt.Time = date.ToShortTimeString();
                     connection.SubmitChanges();
                     return("Your Request Sent");
                 }
             }
             else
             {
                 DateTime time1 = Convert.ToDateTime(query2.First().Time);
                 if (time1.Hour == 20)
                 {
                     return("Sorry All Slot Are Filled Try Another Date");
                 }
                 else
                 {
                     time1    = time1.AddMinutes(15);
                     apt.Time = time1.ToShortTimeString();
                     connection.SubmitChanges();
                     return("Your Request Sent");
                 }
             }
         }
         else
         {
             if (query2.Count() == 0)
             {
                 apt.Time = date.ToShortTimeString();
                 connection.SubmitChanges();
                 return("Your Request Sent ");
             }
             else
             {
                 DateTime time1 = Convert.ToDateTime(query2.First().Time);
                 if (time1.Hour == 20)
                 {
                     return("Sorry All Slot Are Filled Try Another Date");
                 }
                 else
                 {
                     time1    = time1.AddMinutes(15);
                     apt.Time = time1.ToShortTimeString();
                     connection.SubmitChanges();
                     return("Your Request Sent ");
                 }
             }
         }
         connection.SubmitChanges();
         return("Your Request Sent");
     }
     catch (Exception ex)
     {
         return(ex.ToString());
     }
 }
Esempio n. 6
0
 partial void DeleteAppointment_Table(Appointment_Table instance);
Esempio n. 7
0
 partial void UpdateAppointment_Table(Appointment_Table instance);
Esempio n. 8
0
 partial void InsertAppointment_Table(Appointment_Table instance);