Пример #1
0
        public bool EditUser(TaxiAppzDBContext context, CancelUserInfo cancelUserInfo, LoggedInUser loggedInUser)
        {
            var roleExist = context.TabZonetypeRelationship.FirstOrDefault(t => t.IsDelete == 0 && t.Zonetypeid == cancelUserInfo.Zonetypeid);

            if (roleExist == null)
            {
                throw new DataValidationException($"Zone type does not exists");
            }

            var tabUserCancellation = context.TabUserCancellation.Where(r => r.UserCancelId == cancelUserInfo.Id && r.IsDelete == false).FirstOrDefault();

            if (tabUserCancellation != null)
            {
                tabUserCancellation.Arrivalstatus             = cancelUserInfo.ArrivalStatus;
                tabUserCancellation.CancellationReasonArabic  = cancelUserInfo.CancelReasonArabic;
                tabUserCancellation.CancellationReasonEnglish = cancelUserInfo.CancelReasonEnglish;
                tabUserCancellation.CancellationReasonSpanish = cancelUserInfo.CancelReasonSpanish;
                tabUserCancellation.Paymentstatus             = cancelUserInfo.PaymentStatus;
                tabUserCancellation.Zonetypeid = cancelUserInfo.Zonetypeid;
                tabUserCancellation.UpdatedAt  = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
                tabUserCancellation.UpdatedBy  = loggedInUser.Email;
                context.Update(tabUserCancellation);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #2
0
        public bool EditService(TaxiAppzDBContext context, ServiceInfo serviceInfo, LoggedInUser loggedInUser)
        {
            var serviceExists = context.TabServicelocation.FirstOrDefault(t => t.IsDeleted == 0 && t.Name.ToLower() == serviceInfo.ServiceName.ToLower() && t.Servicelocid != serviceInfo.ServiceId);

            if (serviceExists != null)
            {
                throw new DataValidationException($"Service with name '{serviceExists.Name}' already exists.");
            }

            var updatedate = context.TabServicelocation.Where(r => r.Servicelocid == serviceInfo.ServiceId && r.IsDeleted == 0).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.Countryid  = serviceInfo.CountryId;
                updatedate.Timezoneid = serviceInfo.TimezoneId;
                updatedate.Currencyid = serviceInfo.CurrencyId;
                updatedate.Name       = serviceInfo.ServiceName;
                updatedate.UpdatedAt  = DateTime.UtcNow;
                updatedate.UpdatedBy  = loggedInUser.Email;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #3
0
        public bool EditRole(TaxiAppzDBContext context, long id, Roles roles, LoggedInUser loggedInUser)
        {
            var roleExist = context.TabRoles.FirstOrDefault(t => t.IsDelete == 0 && t.RoleName.ToLower() == roles.RoleName.ToLower() && t.Roleid != id);

            if (roleExist != null)
            {
                throw new DataValidationException($"Role with name '{roles.RoleName}' already exists.");
            }

            TabRoles Insertdata = new TabRoles();
            var      updatedate = context.TabRoles.Where(r => r.Roleid == id && r.IsDelete == 0).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.RoleName    = roles.RoleName;
                updatedate.DisplayName = roles.DisplayName;
                updatedate.Description = roles.Description;


                updatedate.CreatedBy = loggedInUser.Email;
                updatedate.UpdatedAt = Extention.GetDateTime();
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #4
0
        public bool EditType(TaxiAppzDBContext context, VehicleTypeInfo vehicleTypeInfo, LoggedInUser loggedInUser)
        {
            try
            {
                var updatedate = context.TabTypes.Where(r => r.Typeid == vehicleTypeInfo.Id && r.IsDeleted == 0).FirstOrDefault();
                if (updatedate != null)
                {
                    updatedate.Imagename = vehicleTypeInfo.Image;
                    updatedate.Typename  = vehicleTypeInfo.Name;

                    updatedate.UpdatedAt = DateTime.UtcNow;

                    updatedate.UpdatedBy = loggedInUser.UserName;
                    context.Update(updatedate);
                    context.SaveChanges();
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                Extention.insertlog(ex.Message, loggedInUser.UserName, System.Reflection.MethodBase.GetCurrentMethod().Name, context);
                return(false);
            }
        }
Пример #5
0
        public bool EditCurrency(TaxiAppzDBContext context, CurrencyInfo currencyInfo, LoggedInUser loggedInUser)
        {
            var zoneexist = context.TabCurrencies.FirstOrDefault(t => t.IsDelete == 0 && t.Currenciesid == currencyInfo.StandardId);

            if (zoneexist == null)
            {
                throw new DataValidationException($"Currency standard does not exists");
            }

            var updatedate = context.TabCommonCurrency.Where(r => r.Currencyid == currencyInfo.CurrencyID && r.IsDeleted == 0).FirstOrDefault();

            if (updatedate == null)
            {
                throw new DataValidationException($"Currency does not exists");
            }

            if (updatedate != null)
            {
                updatedate.Currencyname   = currencyInfo.CurrencyName;
                updatedate.CurrencySymbol = currencyInfo.CurrencySymbol;
                updatedate.Currenciesid   = currencyInfo.StandardId;
                updatedate.UpdatedAt      = DateTime.UtcNow;
                updatedate.UpdatedBy      = loggedInUser.Email;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #6
0
        public bool StatusDriver(TaxiAppzDBContext context, long id, bool isStatus, LoggedInUser loggedInUser)
        {
            var updatedate = context.TabDriverCancellation.Where(r => r.DriverCancelId == id && r.IsDelete == false).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.IsActive  = isStatus == true;
                updatedate.UpdatedAt = DateTime.UtcNow;
                updatedate.UpdatedBy = loggedInUser.UserName;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #7
0
        public bool DeleteDriver(TaxiAppzDBContext context, long id, LoggedInUser loggedInUser)
        {
            var updatedate = context.TabDriverCancellation.Where(u => u.DriverCancelId == id && u.IsDelete == false).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.DeletedAt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
                updatedate.DeletedBy = loggedInUser.Email;
                updatedate.IsDelete  = true;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #8
0
        public bool Status(TaxiAppzDBContext context, long id, bool status, LoggedInUser loggedInUser)
        {
            var tabAdmin = context.TabAdmin.Where(r => r.Id == id && r.IsDeleted == 0).FirstOrDefault();

            if (tabAdmin != null)
            {
                tabAdmin.IsActive  = status == true ? 1 : 0;
                tabAdmin.UpdatedAt = DateTime.UtcNow;
                tabAdmin.UpdatedBy = loggedInUser.Email;
                context.Update(tabAdmin);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #9
0
        public bool EditFAQ(TaxiAppzDBContext context, ManageFAQList manageFAQList, LoggedInUser loggedInUser)
        {
            var updatedate = context.TabFaq.Where(r => r.Faqid == manageFAQList.Id && r.IsDelete == false).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.FaqQuestion   = manageFAQList.FAQ_Question;
                updatedate.FaqAnswer     = manageFAQList.FAQ_Answer;
                updatedate.ComplaintType = manageFAQList.Complaint_Type;
                updatedate.UpdatedAt     = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
                updatedate.UpdatedBy     = loggedInUser.Email;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #10
0
        public bool EditEmer(TaxiAppzDBContext context, VehicleEmerInfo vehicleEmerInfo, LoggedInUser loggedInUser)
        {
            var tabSos = context.TabSos.Where(r => r.Sosid == vehicleEmerInfo.Id && r.IsDeleted == 0).FirstOrDefault();

            if (tabSos != null)
            {
                tabSos.Sosname       = vehicleEmerInfo.Name;
                tabSos.ContactNumber = vehicleEmerInfo.Number;

                tabSos.UpdatedAt = DateTime.UtcNow;
                tabSos.UpdatedBy = loggedInUser.UserName;
                context.Update(tabSos);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #11
0
        public bool DeleteCurrency(TaxiAppzDBContext context, long id, LoggedInUser loggedInUser)
        {
            var commonCurrency = context.TabCommonCurrency.Where(r => r.Currencyid == id && r.IsDeleted == 0).FirstOrDefault();

            if (commonCurrency == null)
            {
                throw new DataValidationException($"Currency does not exists");
            }

            var updatedate = context.TabCommonCurrency.Where(r => r.Currencyid == id && r.IsDeleted == 0).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.IsDeleted = 1;
                updatedate.DeletedAt = DateTime.UtcNow;
                updatedate.DeletedBy = loggedInUser.Email;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #12
0
        public bool StatusType(TaxiAppzDBContext context, long id, bool isStatus, LoggedInUser loggedInUser)
        {
            var commonCurrency = context.TabCommonCurrency.Where(r => r.Currencyid == id && r.IsDeleted == 0).FirstOrDefault();

            if (commonCurrency == null)
            {
                throw new DataValidationException($"Currency does not exists");
            }

            var updatedate = context.TabCommonCurrency.Where(r => r.Currencyid == id && r.IsDeleted == 0).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.IsActive  = isStatus == true ? 1 : 0;
                updatedate.UpdatedAt = DateTime.UtcNow;
                updatedate.UpdatedBy = "admin";
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #13
0
        public bool DisableRole(TaxiAppzDBContext context, long id, LoggedInUser loggedInUser)
        {
            var roleExist = context.TabRoles.FirstOrDefault(r => r.Roleid == id);

            if (roleExist == null)
            {
                throw new DataValidationException($"Role not exists.");
            }

            var updatedate = context.TabRoles.Where(r => r.Roleid == id).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.UpdatedAt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
                updatedate.UpdatedBy = loggedInUser.Email;
                updatedate.IsActive  = 1;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #14
0
        public bool DeleteUser(TaxiAppzDBContext context, long id, LoggedInUser loggedInUser)
        {
            var roleExist = context.TabUserCancellation.FirstOrDefault(t => t.IsDelete == false && t.UserCancelId == id);

            if (roleExist == null)
            {
                throw new DataValidationException($"Tab user cancellation does not exists");
            }

            var updatedate = context.TabUserCancellation.Where(u => u.UserCancelId == id && u.IsDelete == false).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.DeletedAt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
                updatedate.DeletedBy = loggedInUser.Email;
                updatedate.IsDelete  = true;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #15
0
        public bool StatusUser(TaxiAppzDBContext context, long id, bool isStatus, LoggedInUser loggedInUser)
        {
            var roleExist = context.TabUserCancellation.FirstOrDefault(t => t.IsDelete == false && t.UserCancelId == id);

            if (roleExist == null)
            {
                throw new DataValidationException($"Tab user cancellation does not exists");
            }

            var updatedate = context.TabUserCancellation.Where(r => r.UserCancelId == id && r.IsDelete == false).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.IsActive  = isStatus == true;
                updatedate.UpdatedAt = DateTime.UtcNow;
                updatedate.UpdatedBy = loggedInUser.UserName;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #16
0
        public bool DeleteService(TaxiAppzDBContext context, long id, LoggedInUser loggedInUser)
        {
            var serviceExists = context.TabServicelocation.FirstOrDefault(t => t.IsDeleted == 0 && t.Servicelocid == id);

            if (serviceExists != null)
            {
                throw new DataValidationException($"Service with name '{serviceExists.Name}' already exists.");
            }

            var updatedate = context.TabServicelocation.Where(r => r.Servicelocid == id && r.IsDeleted == 0).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.IsDeleted = 1;
                updatedate.DeletedAt = DateTime.UtcNow;
                updatedate.DeletedBy = loggedInUser.Email;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #17
0
 public bool DisableUser(TaxiAppzDBContext context, long id, bool status, LoggedInUser loggedInUser)
 {
     try
     {
         var updatedate = context.TabUser.Where(u => u.Id == id && u.IsDelete == 0).FirstOrDefault();
         if (updatedate != null)
         {
             updatedate.UpdatedAt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
             updatedate.UpdatedBy = "Admin";
             updatedate.IsActive  = status;
             context.Update(updatedate);
             context.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         Extention.insertlog(ex.Message, "Admin", "DisableUser", context);
         return(false);
     }
 }
Пример #18
0
        public bool StatusEmail(TaxiAppzDBContext context, long id, bool isStatus, LoggedInUser loggedInUser)
        {
            var emailid = context.TabManageEmail.FirstOrDefault(t => t.ManageEmailid == id);

            if (emailid == null)
            {
                throw new DataValidationException($"Email does not already exists.");
            }

            var updatedate = context.TabManageEmail.Where(r => r.ManageEmailid == id).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.IsActive  = isStatus == true;
                updatedate.UpdatedAt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);;
                updatedate.UpdatedBy = loggedInUser.UserName;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #19
0
 public bool StatusEmer(TaxiAppzDBContext context, long id, bool isStatus, LoggedInUser loggedInUser)
 {
     try
     {
         var tabSos = context.TabSos.Where(r => r.Sosid == id && r.IsDeleted == 0).FirstOrDefault();
         if (tabSos != null)
         {
             tabSos.IsActive  = isStatus == true ? 1 : 0;
             tabSos.UpdatedAt = DateTime.UtcNow;
             tabSos.UpdatedBy = loggedInUser.UserName;
             context.Update(tabSos);
             context.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         Extention.insertlog(ex.Message, "Admin", System.Reflection.MethodBase.GetCurrentMethod().Name, context);
         return(false);
     }
 }
Пример #20
0
        public bool StatusFAQ(TaxiAppzDBContext context, long id, bool isStatus, LoggedInUser loggedInUser)
        {
            var faq = context.TabFaq.FirstOrDefault(t => t.IsDelete == false && t.Faqid == id);

            if (faq == null)
            {
                throw new DataValidationException($"FAQ doest not exists.");
            }

            var updatedate = context.TabFaq.Where(t => t.Faqid == id && t.IsDelete == false).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.IsActive  = isStatus;
                updatedate.UpdatedAt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
                updatedate.UpdatedBy = loggedInUser.UserName;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Пример #21
0
        public bool EditEmail(TaxiAppzDBContext context, ManageEmailOption manageEmailOption, LoggedInUser loggedInUser)
        {
            var emailid = context.TabManageEmail.FirstOrDefault(t => t.ManageEmailid == manageEmailOption.Id);

            if (emailid == null)
            {
                throw new DataValidationException($"Email does not already exists.");
            }

            var updatedate = context.TabManageEmail.Where(r => r.ManageEmailid == manageEmailOption.Id).FirstOrDefault();

            if (updatedate != null)
            {
                updatedate.ManageEmailid = manageEmailOption.Id;
                updatedate.Description   = manageEmailOption.Description;
                updatedate.UpdatedAt     = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);;
                updatedate.UpdatedBy     = loggedInUser.Email;
                context.Update(updatedate);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }