コード例 #1
0
ファイル: DAZone.cs プロジェクト: satheesh1487-crss/TaxiApps
        public bool AddZone(ManageZoneAdd manageZone, TaxiAppzDBContext context, LoggedInUser loggedInUser)
        {
            var serviceExist = context.TabServicelocation.FirstOrDefault(t => t.IsDeleted == 0 && t.Servicelocid == manageZone.Serviceslocid);

            if (serviceExist == null)
            {
                throw new DataValidationException($"Service location does not already exists.");
            }

            TabZone tabZone = new TabZone();

            tabZone.Zonename     = manageZone.ZoneName;
            tabZone.Servicelocid = manageZone.Serviceslocid;
            tabZone.Unit         = manageZone.Unit;
            tabZone.IsActive     = 1;
            tabZone.IsDeleted    = 0;
            tabZone.CreatedBy    = tabZone.UpdatedBy = loggedInUser.UserName;
            tabZone.CreatedAt    = tabZone.UpdatedAt = Extention.GetDateTime();
            context.TabZone.Add(tabZone);
            context.SaveChanges();

            foreach (var zonepolygon in manageZone.ZonePolygoneList)
            {
                TabZonepolygon tabZonepolygon = new TabZonepolygon();
                tabZonepolygon.Longitudes = zonepolygon.Lng;
                tabZonepolygon.Latitudes  = zonepolygon.Lat;
                tabZonepolygon.IsActive   = 1;
                tabZonepolygon.CreatedBy  = tabZonepolygon.UpdatedBy = loggedInUser.UserName;
                tabZonepolygon.CreatedAt  = tabZonepolygon.UpdatedAt = Extention.GetDateTime();
                tabZonepolygon.Zoneid     = tabZone.Zoneid;
                context.TabZonepolygon.Add(tabZonepolygon);
            }
            context.SaveChanges();
            return(true);
        }
コード例 #2
0
ファイル: DAZone.cs プロジェクト: satheesh1487-crss/TaxiApps
 public bool IsDefaultZoneType(long zoneid, long typeid, TaxiAppzDBContext context, LoggedInUser loggedInUser)
 {
     try
     {
         var zonetypeexist = context.TabZonetypeRelationship.Where(z => z.Zoneid == zoneid && z.IsDefault == 1).FirstOrDefault();
         if (zonetypeexist != null)
         {
             zonetypeexist.IsDefault = 0;
             context.TabZonetypeRelationship.Update(zonetypeexist);
             var zonetype = context.TabZonetypeRelationship.Where(z => z.Zoneid == zoneid && z.Typeid == typeid).FirstOrDefault();
             zonetype.IsDefault = 1;
             context.TabZonetypeRelationship.Update(zonetype);
             context.SaveChanges();
             return(true);
         }
         else
         {
             var zonetype = context.TabZonetypeRelationship.Where(z => z.Zoneid == zoneid && z.Typeid == typeid).FirstOrDefault();
             zonetype.IsDefault = 1;
             context.TabZonetypeRelationship.Update(zonetype);
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         Extention.insertlog(ex.Message.ToString(), "Admin", "IsDefaultZoneType", context);
         return(false);
     }
 }
コード例 #3
0
        public bool SaveTripSettings(TripSettings tripSettings, TaxiAppzDBContext content, LoggedInUser loggedIn)
        {
            var exist = content.TabTripSettings.FirstOrDefault(t => t.IsActive == false && t.TripSettingsId == tripSettings.Id);

            if (exist == null)
            {
                TabTripSettings tabTripSettings = new TabTripSettings();
                tabTripSettings.TripSettingsQuestion = tripSettings.TripSettingQuestion;
                tabTripSettings.TripSettingsAnswer   = tripSettings.TripSettingAnswer;
                tabTripSettings.IsActive             = true;
                tabTripSettings.UpdatedAt            = tabTripSettings.CreatedAt = Extention.GetDateTime();
                tabTripSettings.UpdatedBy            = tabTripSettings.CreatedBy = loggedIn.UserName;
                content.TabTripSettings.Add(tabTripSettings);
                content.SaveChanges();
                return(true);
            }
            else
            {
                exist.TripSettingsQuestion = tripSettings.TripSettingQuestion;
                exist.TripSettingsAnswer   = tripSettings.TripSettingAnswer;
                exist.UpdatedAt            = Extention.GetDateTime();
                exist.UpdatedBy            = loggedIn.UserName;
                content.TabTripSettings.Update(exist);
                content.SaveChanges();
                return(true);
            }
        }
コード例 #4
0
ファイル: DAZone.cs プロジェクト: satheesh1487-crss/TaxiApps
        public bool EditZone(ManageZoneAdd manageZone, TaxiAppzDBContext context, LoggedInUser loggedInUser)
        {
            var serviceExist = context.TabServicelocation.FirstOrDefault(t => t.IsDeleted == 0 && t.Servicelocid == manageZone.Serviceslocid);

            if (serviceExist == null)
            {
                throw new DataValidationException($"Service location does not already exists.");
            }

            var setzone          = context.TabZone.Where(z => z.Zoneid == manageZone.Zoneid && z.IsDeleted == 0).FirstOrDefault();
            var deletezonepolyon = context.TabZonepolygon.Where(z => z.Zoneid == manageZone.Zoneid).ToList();

            if (setzone != null)
            {
                setzone.Zonename     = manageZone.ZoneName;
                setzone.Servicelocid = manageZone.Serviceslocid;
                setzone.Unit         = manageZone.ZoneName;
                context.TabZone.Update(setzone);
                context.TabZonepolygon.RemoveRange(deletezonepolyon);
                context.SaveChanges();
                foreach (var zonepoly in manageZone.ZonePolygoneList)
                {
                    TabZonepolygon tabZonepolygon = new TabZonepolygon();
                    tabZonepolygon.Latitudes  = zonepoly.Lat;
                    tabZonepolygon.Longitudes = zonepoly.Lng;
                    tabZonepolygon.Zoneid     = setzone.Zoneid;
                    tabZonepolygon.UpdatedBy  = tabZonepolygon.CreatedBy = loggedInUser.UserName;
                    tabZonepolygon.UpdatedAt  = tabZonepolygon.CreatedAt = DateTime.UtcNow;
                    context.TabZonepolygon.Add(tabZonepolygon);
                }
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
コード例 #5
0
        public bool Save(TaxiAppzDBContext context, AdminDetails adminDetails, LoggedInUser loggedInUser)
        {
            var emailid = context.TabAdmin.FirstOrDefault(t => t.IsDeleted == 0 && t.Email.ToLower() == adminDetails.Email.ToLower() && t.Id != adminDetails.Id);

            if (emailid != null)
            {
                throw new DataValidationException($"Email id '{emailid.Email}' already exists.");
            }

            var service = context.TabServicelocation.FirstOrDefault(t => t.IsDeleted == 0 && t.Servicelocid == adminDetails.Area);

            if (service == null)
            {
                throw new DataValidationException($"Service location  does not exists.");
            }

            var role = context.TabRoles.FirstOrDefault(t => t.IsDelete == 0 && t.Roleid == adminDetails.RoleId);

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

            TabAdmin tabAdmin = new TabAdmin();

            tabAdmin.AdminKey         = "";
            tabAdmin.AdminReference   = 0;
            tabAdmin.AreaName         = adminDetails.Area;
            tabAdmin.Email            = adminDetails.Email.ToLower();
            tabAdmin.EmergencyNumber  = adminDetails.Emerphonenumber;
            tabAdmin.Firstname        = adminDetails.Firstname;
            tabAdmin.Language         = adminDetails.Languagename;
            tabAdmin.Lastname         = adminDetails.Lastname;
            tabAdmin.Password         = adminDetails.Password;
            tabAdmin.PhoneNumber      = adminDetails.Phonenumber;
            tabAdmin.ProfilePic       = adminDetails.ProfilePicture;
            tabAdmin.RegistrationCode = (context.TabAdmin.Count() + 1).ToString();
            tabAdmin.Role             = adminDetails.RoleId;
            tabAdmin.IsActive         = 1;
            tabAdmin.IsDeleted        = 0;
            tabAdmin.CreatedAt        = DateTime.UtcNow;
            tabAdmin.UpdatedAt        = DateTime.UtcNow;
            tabAdmin.UpdatedBy        = tabAdmin.CreatedBy = loggedInUser.Email;
            context.TabAdmin.Add(tabAdmin);
            context.SaveChanges();

            TabAdminDetails tabAdminDetails = new TabAdminDetails();

            tabAdminDetails.AdminId    = tabAdmin.Id;
            tabAdminDetails.Address    = adminDetails.Address;
            tabAdminDetails.PostalCode = adminDetails.Postalcode;
            tabAdminDetails.CountryId  = adminDetails.Country;
            context.TabAdminDetails.Add(tabAdminDetails);
            context.SaveChanges();
            return(true);
        }
コード例 #6
0
        public bool AddMenuAccess(long fromroleid, long toroleid, TaxiAppzDBContext context)
        {
            var roleExist = context.TabRoles.FirstOrDefault(r => r.Roleid == fromroleid);

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

            var tabMenu = context.TabMenuAccess.FirstOrDefault(r => r.Roleid == fromroleid);

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

            var menulist = context.TabMenuAccess.Include(t => t.Role).Where(r => r.Roleid == fromroleid && r.Viewstatus == true).ToList();

            if (menulist.Count > 0)

            {
                var menuaccesslist = context.TabMenuAccess.Where(t => t.Roleid == toroleid).ToList();
                if (menuaccesslist.Count > 0)
                {
                    context.TabMenuAccess.RemoveRange(menuaccesslist);
                    context.SaveChanges();
                    foreach (var menu in menulist)
                    {
                        TabMenuAccess tabMenuAccess = new TabMenuAccess();
                        tabMenuAccess.Menuid     = menu.Menuid;
                        tabMenuAccess.Roleid     = toroleid;
                        tabMenuAccess.Viewstatus = false;
                        tabMenuAccess.Createdby  = DateTime.UtcNow;
                        context.TabMenuAccess.Add(tabMenuAccess);
                        context.SaveChanges();
                    }
                    return(true);
                }
                else
                {
                    foreach (var menu in menulist)
                    {
                        TabMenuAccess tabMenuAccess = new TabMenuAccess();
                        tabMenuAccess.Menuid     = menu.Menuid;
                        tabMenuAccess.Roleid     = toroleid;
                        tabMenuAccess.Viewstatus = false;
                        tabMenuAccess.Createdby  = DateTime.UtcNow;
                        context.TabMenuAccess.Add(tabMenuAccess);
                        context.SaveChanges();
                    }
                    return(true);
                }
            }
            return(false);
        }
コード例 #7
0
        public bool SaveCancelDriver(TaxiAppzDBContext context, CancelDriverInfo cancelDriverInfo, LoggedInUser loggedInUser)
        {
            var roleExist = context.TabDriverCancellation.FirstOrDefault(t => t.IsDelete == false && t.Zonetypeid == cancelDriverInfo.Zonetypeid);

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

            TabDriverCancellation tabDriverCancellation = new TabDriverCancellation();

            tabDriverCancellation.Arrivalstatus             = cancelDriverInfo.ArrivalStatus;
            tabDriverCancellation.CancellationReasonArabic  = cancelDriverInfo.CancelReasonArabic;
            tabDriverCancellation.CancellationReasonEnglish = cancelDriverInfo.CancelReasonEnglish;
            tabDriverCancellation.CancellationReasonSpanish = cancelDriverInfo.CancelReasonSpanish;
            tabDriverCancellation.Paymentstatus             = cancelDriverInfo.PaymentStatus;
            tabDriverCancellation.Zonetypeid = cancelDriverInfo.Zonetypeid;

            tabDriverCancellation.CreatedAt = tabDriverCancellation.UpdatedAt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
            tabDriverCancellation.CreatedBy = tabDriverCancellation.UpdatedBy = loggedInUser.Email;
            tabDriverCancellation.IsDelete  = false;
            tabDriverCancellation.IsActive  = true;
            context.Add(tabDriverCancellation);
            context.SaveChanges();
            return(true);
        }
コード例 #8
0
ファイル: DAZone.cs プロジェクト: satheesh1487-crss/TaxiApps
        public bool ActiveZoneType(long zoneid, long typeid, bool isactivestatus, TaxiAppzDBContext context, LoggedInUser loggedInUser)
        {
            var serviceExist = context.TabZone.FirstOrDefault(t => t.IsDeleted == 0 && t.Zoneid == zoneid);

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

            var typeExist = context.TabTypes.FirstOrDefault(t => t.IsDeleted == 0 && t.Typeid == typeid);

            if (typeExist == null)
            {
                throw new DataValidationException($"Vechile type does not already exists.");
            }
            var zonetypeedit = context.TabZonetypeRelationship.Where(z => z.Zoneid == zoneid && z.Typeid == typeid).FirstOrDefault();

            if (zonetypeedit != null)
            {
                zonetypeedit.IsActive = isactivestatus ? 1 : 0;
                context.TabZonetypeRelationship.Update(zonetypeedit);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
コード例 #9
0
ファイル: DAZone.cs プロジェクト: satheesh1487-crss/TaxiApps
        public bool EditZoneType(ZoneTypeRelation zoneTypeRelation, TaxiAppzDBContext context, LoggedInUser loggedInUser)
        {
            var serviceExist = context.TabZone.FirstOrDefault(t => t.IsDeleted == 0 && t.Zoneid == zoneTypeRelation.Zoneid);

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

            var typeExist = context.TabTypes.FirstOrDefault(t => t.IsDeleted == 0 && t.Typeid == zoneTypeRelation.Typeid);

            if (typeExist == null)
            {
                throw new DataValidationException($"Vechile type does not already exists.");
            }

            var zonetypeedit = context.TabZonetypeRelationship.Where(z => z.Zoneid == zoneTypeRelation.Zoneid && z.Typeid == zoneTypeRelation.Typeid).FirstOrDefault();

            if (zonetypeedit != null)
            {
                zonetypeedit.Zoneid      = zoneTypeRelation.Zoneid;
                zonetypeedit.Typeid      = zoneTypeRelation.Typeid;
                zonetypeedit.Paymentmode = zoneTypeRelation.Paymentmode;
                zonetypeedit.Showbill    = zoneTypeRelation.Showbill.ToUpper() == "YES" ? true : false;
                zonetypeedit.IsActive    = 1;
                context.TabZonetypeRelationship.Update(zonetypeedit);
                context.SaveChanges();
                return(true);
            }

            return(false);
        }
コード例 #10
0
ファイル: DAZone.cs プロジェクト: satheesh1487-crss/TaxiApps
        public bool AddZoneType(long zoneid, ZoneTypeRelation zoneTypeRelation, TaxiAppzDBContext context, LoggedInUser loggedInUser)
        {
            var serviceExist = context.TabZone.FirstOrDefault(t => t.IsDeleted == 0 && t.Zoneid == zoneTypeRelation.Zoneid);

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

            var typeExist = context.TabTypes.FirstOrDefault(t => t.IsDeleted == 0 && t.Typeid == zoneTypeRelation.Typeid);

            if (typeExist == null)
            {
                throw new DataValidationException($"Vechile type does not already exists.");
            }

            var isrelationshipexist = context.TabZonetypeRelationship.Any(z => z.Zoneid == zoneid && z.IsDelete == 0);
            TabZonetypeRelationship tabZonetypeRelationship = new TabZonetypeRelationship();

            tabZonetypeRelationship.Zoneid      = zoneTypeRelation.Zoneid;
            tabZonetypeRelationship.Typeid      = zoneTypeRelation.Typeid;
            tabZonetypeRelationship.Paymentmode = zoneTypeRelation.Paymentmode;
            tabZonetypeRelationship.Showbill    = zoneTypeRelation.Showbill.ToUpper() == "YES" ? true : false;
            tabZonetypeRelationship.IsActive    = 1;
            tabZonetypeRelationship.IsDefault   = isrelationshipexist ? 0 : 1;
            context.TabZonetypeRelationship.Add(tabZonetypeRelationship);
            context.SaveChanges();
            return(true);
        }
コード例 #11
0
ファイル: DAZone.cs プロジェクト: satheesh1487-crss/TaxiApps
 public bool ActiveZone(long zoneid, bool isStatus, TaxiAppzDBContext context, LoggedInUser loggedInUser)
 {
     try
     {
         var tabzone        = context.TabZone.Where(z => z.Zoneid == zoneid && z.IsDeleted == 0).FirstOrDefault();
         var tabpolygondtls = context.TabZonepolygon.Where(z => z.Zoneid == zoneid).ToList();
         if (tabzone != null)
         {
             tabzone.IsActive  = isStatus == true ? 1 : 0;
             tabzone.UpdatedAt = DateTime.UtcNow;
             tabzone.UpdatedBy = loggedInUser.UserName;
             context.TabZone.Update(tabzone);
             foreach (var tabpoly in tabpolygondtls)
             {
                 tabpoly.IsActive  = isStatus ? 1 : 0;
                 tabpoly.UpdatedAt = DateTime.UtcNow;
                 tabpoly.UpdatedBy = loggedInUser.UserName;
                 context.TabZonepolygon.Update(tabpoly);
             }
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         Extention.insertlog(ex.Message.ToString(), "Admin", "DeleteZone", context);
         return(false);
     }
 }
コード例 #12
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);
            }
        }
コード例 #13
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);
        }
コード例 #14
0
        public bool AddPromo(ManagePromo managePromo, TaxiAppzDBContext content, LoggedInUser loggedIn)
        {
            var emailid = content.TabZone.FirstOrDefault(t => t.IsDeleted == 0 && t.Zoneid == managePromo.Zoneid);

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



            TabPromo tabPromo = new TabPromo();

            tabPromo.CouponCode          = managePromo.CoupenCode;
            tabPromo.PromoEstimateAmount = managePromo.EstimateAmount;
            tabPromo.PromoValue          = managePromo.Value;
            tabPromo.Zoneid                = managePromo.Zoneid;
            tabPromo.PromoType             = managePromo.CoupenCode;
            tabPromo.PromoUses             = managePromo.Uses;
            tabPromo.PromoUsersRepeateduse = managePromo.Value;
            tabPromo.StartDate             = managePromo.StartDate;
            tabPromo.EndDate               = managePromo.ExpiryDate;
            tabPromo.IsActive              = true;
            tabPromo.IsDelete              = true;
            tabPromo.UpdatedAt             = tabPromo.CreatedAt = DateTime.UtcNow;
            tabPromo.UpdatedBy             = tabPromo.CreatedBy = loggedIn.UserName;
            content.TabPromo.Add(tabPromo);
            content.SaveChanges();
            return(true);
        }
コード例 #15
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);
        }
コード例 #16
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);
        }
コード例 #17
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);
        }
コード例 #18
0
        public bool EditDriverComplainttemplate(ManageDriverComplaint manageDriver, TaxiAppzDBContext content, LoggedInUser loggedInUser)
        {
            var roleExist = content.TabDriverComplaint.FirstOrDefault(t => t.IsDelete == false && t.DriverComplaintId == manageDriver.DriverCompalintID);

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

            var zoneexist = content.TabZone.FirstOrDefault(t => t.IsDeleted == 0 && t.Zoneid == manageDriver.ZoneId);

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

            var driverComplaintdtls = content.TabDriverComplaint.Where(t => t.DriverComplaintId == manageDriver.DriverCompalintID).FirstOrDefault();

            driverComplaintdtls.DriverComplaintTitle = manageDriver.DriverComplaintTitle;
            driverComplaintdtls.DriverComplaintType  = manageDriver.DriverComplaintType;
            driverComplaintdtls.Zoneid    = manageDriver.ZoneId;
            driverComplaintdtls.IsActive  = true;
            driverComplaintdtls.UpdatedAt = DateTime.UtcNow;
            driverComplaintdtls.UpdatedBy = loggedInUser.UserName;
            content.TabDriverComplaint.Update(driverComplaintdtls);
            content.SaveChanges();
            return(true);
        }
コード例 #19
0
        public bool SaveReferral(ManageReferral manageReferral, TaxiAppzDBContext content, LoggedInUser loggedIn)
        {
            try
            {
                if (content.TabManageReferral.Any(t => t.IsActive == true && t.ReferralGainAmountPerPerson == manageReferral.ReferralGain_Amount_PerPerson && t.ReferralWorthAmount == manageReferral.ReferralWorth_Amount && t.TripToCompletedToearnRefferalAmount == manageReferral.Trip_to_completed_toearn_refferalAmount && t.TripToCompletedTorefer == manageReferral.Trip_to_completed_torefer))
                {
                    return(true);
                }
                TabManageReferral tabManageReferral = new TabManageReferral();

                tabManageReferral.ReferralGainAmountPerPerson         = manageReferral.ReferralGain_Amount_PerPerson;
                tabManageReferral.ReferralWorthAmount                 = manageReferral.ReferralWorth_Amount;
                tabManageReferral.TripToCompletedTorefer              = manageReferral.Trip_to_completed_toearn_refferalAmount;
                tabManageReferral.TripToCompletedToearnRefferalAmount = manageReferral.Trip_to_completed_torefer;
                tabManageReferral.IsActive  = true;
                tabManageReferral.UpdatedAt = tabManageReferral.CreatedAt = Extention.GetDateTime();
                tabManageReferral.UpdatedBy = tabManageReferral.CreatedBy = loggedIn.UserName;
                content.TabManageReferral.Add(tabManageReferral);
                foreach (var referral in content.TabManageReferral.Where(t => t.IsActive == true).ToList())
                {
                    referral.IsActive  = false;
                    referral.UpdatedAt = Extention.GetDateTime();
                    referral.UpdatedBy = loggedIn.UserName;
                }
                content.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                Extention.insertlog(ex.Message, "Admin", "PromoTransaction", content);
                return(false);
            }
        }
コード例 #20
0
        public bool SaveSurgePrice(SurgePrice surgePrice, TaxiAppzDBContext content, LoggedInUser loggedIn)
        {
            var existZone = content.TabZone.FirstOrDefault(t => t.IsDeleted == 0 && t.Zoneid == surgePrice.Zoneid);

            if (existZone == null)
            {
                throw new DataValidationException("Zone name does not exist");
            }

            var exist = content.TabSurgeprice.FirstOrDefault(t => t.IsDelete == false && t.ZoneId == surgePrice.Zoneid);

            if (exist == null)
            {
                TabSurgeprice tabSurgeprice = new TabSurgeprice();
                tabSurgeprice.PeakType        = surgePrice.Peaktype;
                tabSurgeprice.StartTime       = surgePrice.Starttime;
                tabSurgeprice.ZoneId          = surgePrice.Zoneid;
                tabSurgeprice.EndTime         = surgePrice.Endtime;
                tabSurgeprice.SurgepriceType  = surgePrice.Surgepricetype;
                tabSurgeprice.SurgepriceValue = surgePrice.Surgepricevalue;
                tabSurgeprice.IsActive        = true;
                tabSurgeprice.UpdatedAt       = tabSurgeprice.CreatedAt = Extention.GetDateTime();
                tabSurgeprice.UpdatedBy       = tabSurgeprice.CreatedBy = loggedIn.UserName;
                content.TabSurgeprice.Add(tabSurgeprice);
                content.SaveChanges();
                return(true);
            }
            else
            {
                exist.PeakType        = surgePrice.Peaktype;
                exist.StartTime       = surgePrice.Starttime;
                exist.EndTime         = surgePrice.Endtime;
                exist.SurgepriceType  = surgePrice.Surgepricetype;
                exist.SurgepriceValue = surgePrice.Surgepricevalue;

                exist.UpdatedAt = Extention.GetDateTime();
                exist.UpdatedBy = loggedIn.UserName;
                content.TabSurgeprice.Update(exist);
                content.SaveChanges();
                return(true);
            }
        }
コード例 #21
0
ファイル: DAZone.cs プロジェクト: satheesh1487-crss/TaxiApps
 public bool EditSetprice(List <SetPrice> setPrice, TaxiAppzDBContext context)
 {
     try
     {
         foreach (var setprice in setPrice)
         {
             var tabSetpriceZonetype = context.TabSetpriceZonetype.Where(t => t.Zonetypeid == setprice.ZoneTypeid && t.RideType == setprice.RideType && t.IsDelete == false).FirstOrDefault();
             if (tabSetpriceZonetype != null)
             {
                 tabSetpriceZonetype.Zonetypeid       = setprice.ZoneTypeid;
                 tabSetpriceZonetype.Baseprice        = setprice.BasePrice;
                 tabSetpriceZonetype.Pricepertime     = setprice.PricePerTime;
                 tabSetpriceZonetype.Basedistance     = setprice.BaseDistance;
                 tabSetpriceZonetype.Priceperdistance = setprice.PricePerDistance;
                 tabSetpriceZonetype.Customseldrifee  = setprice.CustomerIdfee;
                 tabSetpriceZonetype.Freewaitingtime  = setprice.Freewaitingtime;
                 tabSetpriceZonetype.Waitingcharges   = setprice.WaitingCharges;
                 tabSetpriceZonetype.Cancellationfee  = setprice.CancellationFee;
                 tabSetpriceZonetype.Dropfee          = setprice.DropFee;
                 tabSetpriceZonetype.Admincommtype    = setprice.admincommtype;
                 tabSetpriceZonetype.Admincommission  = setprice.admincommission;
                 tabSetpriceZonetype.Driversavingper  = setprice.Driversavingper;
                 tabSetpriceZonetype.RideType         = setprice.RideType;
                 context.TabSetpriceZonetype.Update(tabSetpriceZonetype);
             }
             else
             {
                 TabSetpriceZonetype tabSetprice = new TabSetpriceZonetype();
                 tabSetprice.Zonetypeid       = setprice.ZoneTypeid;
                 tabSetprice.Baseprice        = setprice.BasePrice;
                 tabSetprice.Pricepertime     = setprice.PricePerTime;
                 tabSetprice.Basedistance     = setprice.BaseDistance;
                 tabSetprice.Priceperdistance = setprice.PricePerDistance;
                 tabSetprice.Freewaitingtime  = setprice.Freewaitingtime;
                 tabSetprice.Waitingcharges   = setprice.WaitingCharges;
                 tabSetprice.Customseldrifee  = setprice.CustomerIdfee == null ? 0 : setprice.CustomerIdfee;
                 tabSetprice.Cancellationfee  = setprice.CancellationFee;
                 tabSetprice.Dropfee          = setprice.DropFee;
                 tabSetprice.Admincommtype    = setprice.admincommtype;
                 tabSetprice.Admincommission  = setprice.admincommission;
                 tabSetprice.Driversavingper  = setprice.Driversavingper;
                 tabSetprice.RideType         = setprice.RideType;
                 context.TabSetpriceZonetype.Add(tabSetprice);
             }
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         Extention.insertlog(ex.Message, "Admin", "EditSetPrice", context);
         return(false);
     }
 }
コード例 #22
0
        public bool SaveSettings(TaxiAppzDBContext context, SettingsModel settingsModel, LoggedInUser loggedInUser)
        {
            var settingsExists = context.Settings.FirstOrDefault(t => t.IsActive == true);

            if (settingsExists == null)
            {
                Settings settings = settinginfo(settingsModel, loggedInUser);
                context.Settings.Add(settings);
                context.SaveChanges();
                return(true);
            }
            else
            {
                settingsExists.IsActive  = false;
                settingsExists.UpdatedBy = loggedInUser.Email;
                settingsExists.UpdatedAt = DateTime.Now;
                Settings settings = settinginfo(settingsModel, loggedInUser);
                context.Settings.Add(settings);
                context.SaveChanges();
                return(true);
            }
        }
コード例 #23
0
        public bool Delete(TaxiAppzDBContext context, long id, LoggedInUser loggedInUser)
        {
            var tabAdmin = context.TabAdmin.Where(r => r.Id == id && r.IsDeleted == 0).FirstOrDefault();

            if (tabAdmin != null)
            {
                tabAdmin.IsDeleted = 1;
                tabAdmin.DeletedAt = DateTime.UtcNow;
                tabAdmin.DeletedBy = loggedInUser.Email;
                context.TabAdmin.Update(tabAdmin);
                context.SaveChanges();
            }
            return(true);
        }
コード例 #24
0
        public bool SaveEmer(TaxiAppzDBContext context, VehicleEmerInfo vehicleEmerInfo, LoggedInUser loggedInUser)
        {
            TabSos tabSos = new TabSos();

            tabSos.Sosid         = vehicleEmerInfo.Id;
            tabSos.Sosname       = vehicleEmerInfo.Name;
            tabSos.ContactNumber = vehicleEmerInfo.Number;
            tabSos.IsActive      = 1;
            tabSos.IsDeleted     = 0;
            tabSos.CreatedAt     = tabSos.UpdatedAt = DateTime.UtcNow;
            tabSos.CreatedBy     = tabSos.UpdatedBy = loggedInUser.UserName;
            context.TabSos.Add(tabSos);
            context.SaveChanges();
            return(true);
        }
コード例 #25
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);
        }
コード例 #26
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);
        }
コード例 #27
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);
        }
コード例 #28
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);
        }
コード例 #29
0
ファイル: Startup.cs プロジェクト: satheesh1487-crss/TaxiApps
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            try
            {
                if (env.IsDevelopment())
                {
                    app.UseDeveloperExceptionPage();
                }
                //app.UseSignalR(routes =>
                //{
                //    routes.MapHub<MessageHub>("/message");
                //});

                app.UseHttpsRedirection();

                app.UseRouting();
                app.UseAuthentication();
                app.UseAuthorization();

                app.UseEndpoints(endpoints =>
                {
                    endpoints.MapControllers();
                    endpoints.MapHub <MessageHub>("/Requestmessage");
                });
                app.UseCors("AllowAll");
                //app.UseMvc();
                //app.UseCors("AllowAll");
                app.UseDeveloperExceptionPage();
                app.UseSwagger();
                app.UseSwaggerUI(c =>
                {
                    c.SwaggerEndpoint("/swagger/v1/swagger.json", "Core API");
                });
            }
            catch (Exception ex)
            {
                TaxiAppzDBContext _context = new TaxiAppzDBContext();
                TblErrorlog       tblerror = new TblErrorlog();
                tblerror.FunctionName = "Configure";
                tblerror.CreatedBy    = "Startup.cs";
                tblerror.Description  = ex.Message;
                _context.TblErrorlog.Add(tblerror);
                _context.SaveChanges();
            }
        }
コード例 #30
0
 internal static bool UpdateToken(long userid, UserInfo userInfo, TaxiAppzDBContext context)
 {
     try
     {
         insertlog("Update Token", userInfo.Email, "GenerateJWTToken", context);
         var getuserinfo = context.TabAdmin.Where(a => a.Id == userid).FirstOrDefault();
         getuserinfo.RememberToken = userInfo.RefeshToken;
         getuserinfo.UpdatedAt     = DateTime.Now;
         context.TabAdmin.Update(getuserinfo);
         context.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         insertlog(ex.Message, userInfo.Email, "GenerateJWTToken", context);
         return(false);
     }
 }