Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="businessObject"></param>
        /// <returns></returns>
        public bool IsSaloonBooked(BusinessObject businessObject)
        {
            tblSaloonAppointment tblSaloonAppointment = new tblSaloonAppointment();

            if (businessObject.SaloonAppointmentGuid != null && businessObject.SaloonAppointmentGuid != Guid.Empty)
            {
                tblSaloonAppointment = bringlyEntities.tblSaloonAppointments.Where(x => x.IsDeleted == false &&
                                                                                   x.FK_BusinessGuid == businessObject.BusinessGuid && x.FK_SaloonTimeGuid == businessObject.SaloonTimeGuid &&
                                                                                   x.AppointmentDate == businessObject.AppointmentDate &&
                                                                                   x.SaloonAppointmentGuid != businessObject.SaloonAppointmentGuid).FirstOrDefault();
            }
            else
            {
                tblSaloonAppointment = bringlyEntities.tblSaloonAppointments.Where(x => x.IsDeleted == false &&
                                                                                   x.FK_SaloonTimeGuid == businessObject.SaloonTimeGuid && x.AppointmentDate == businessObject.AppointmentDate &&
                                                                                   x.FK_BusinessGuid == businessObject.BusinessGuid).FirstOrDefault();
            }

            if (tblSaloonAppointment == null || tblSaloonAppointment.SaloonAppointmentGuid == null ||
                tblSaloonAppointment.SaloonAppointmentGuid == Guid.Empty)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="SaloonAppointmentGuid"></param>
        /// <returns></returns>
        public bool DeleteSaloonAppointment(Guid SaloonAppointmentGuid)
        {
            tblSaloonAppointment tblSaloonAppointment = bringlyEntities.tblSaloonAppointments.Where(x => x.IsDeleted == false && x.SaloonAppointmentGuid == SaloonAppointmentGuid).FirstOrDefault();

            tblSaloonAppointment.IsDeleted = true;
            bringlyEntities.SaveChanges();

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="businessObject"></param>
        /// <returns></returns>
        public bool MakeUpdateAppointment(BusinessObject businessObject)
        {
            if (businessObject.SaloonAppointmentGuid != null && businessObject.SaloonAppointmentGuid != Guid.Empty)
            {
                try
                {
                    tblSaloonAppointment tblSaloonAppointment = bringlyEntities.tblSaloonAppointments.Where(x => x.IsDeleted == false && x.SaloonAppointmentGuid == businessObject.SaloonAppointmentGuid).FirstOrDefault();
                    tblSaloonAppointment.SaloonTime        = businessObject.SaloonTime;
                    tblSaloonAppointment.FK_SaloonTimeGuid = businessObject.SaloonTimeGuid;
                    tblSaloonAppointment.AppointmentDate   = businessObject.AppointmentDate;
                    tblSaloonAppointment.FK_ModifiedBy     = UserVariables.LoggedInUserGuid;
                    tblSaloonAppointment.ModifiedDate      = DateTime.Now;
                    tblSaloonAppointment.IsApproved        = businessObject.IsApproved;
                    bringlyEntities.SaveChanges();
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
                try
                {
                    tblSaloonAppointment tblSaloonAppointment = new tblSaloonAppointment();
                    tblSaloonAppointment.SaloonAppointmentGuid = Guid.NewGuid();
                    tblSaloonAppointment.FK_BusinessGuid       = businessObject.BusinessGuid;
                    tblSaloonAppointment.FK_UserGuid           = UserVariables.LoggedInUserGuid;
                    tblSaloonAppointment.FK_CreatedByGuid      = UserVariables.LoggedInUserGuid;
                    tblSaloonAppointment.IsApproved            = false;
                    tblSaloonAppointment.SaloonTime            = businessObject.SaloonTime;
                    tblSaloonAppointment.FK_SaloonTimeGuid     = businessObject.SaloonTimeGuid;
                    tblSaloonAppointment.AppointmentDate       = businessObject.AppointmentDate;
                    tblSaloonAppointment.DateCreated           = DateTime.Now;
                    tblSaloonAppointment.IsDeleted             = false;
                    bringlyEntities.tblSaloonAppointments.Add(tblSaloonAppointment);
                    bringlyEntities.SaveChanges();
                }
                catch (Exception)
                {
                    return(false);
                }
            }

            return(true);
        }