示例#1
0
        /// <summary>
        /// Change password of User
        /// </summary>
        /// <param name="GUID"> uniqe string </param>
        /// <param name="Password">password entered by user</param>
        /// <returns></returns>
        public bool ChangePassword(string GUID, string Password)
        {
            int       OTPExirationHrs = Convert.ToInt32(AppUtil.GetAppSettings(AspectEnums.ConfigKeys.OTPExirationHrs));
            DateTime  StartTime       = DateTime.Now.Subtract(new TimeSpan(OTPExirationHrs, 0, 0));
            DateTime  EndTime         = DateTime.Now;
            OTPMaster objOTP          = AccuitAdminDbContext.OTPMasters.FirstOrDefault(k => k.CreatedDate >= StartTime && k.CreatedDate <= EndTime && k.GUID == GUID);

            if (objOTP != null)
            {
                UserMaster user = AccuitAdminDbContext.UserMasters.FirstOrDefault(k => k.UserID == objOTP.UserID && !k.isDeleted);
                user.Password      = EncryptionEngine.EncryptString(Password);
                user.AccountStatus = (int)AspectEnums.UserLoginStatus.Active;
                user.ModifiedDate  = DateTime.Now;
                user.ModifiedBy    = objOTP.UserID;
                AccuitAdminDbContext.Entry <UserMaster>(user).State = System.Data.Entity.EntityState.Modified;
                //Delete all previous OTPs
                foreach (var o in AccuitAdminDbContext.OTPMasters.Where(k => k.UserID == user.UserID))
                {
                    AccuitAdminDbContext.OTPMasters.Remove(o);
                }
                return(AccuitAdminDbContext.SaveChanges() > 0);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public int SubmitUserWeddingDetail(int UserID, Wedding wedding)
        {
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
                                                                 new TransactionOptions
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
            }))
            {
                if (wedding.WeddingID == 0)
                {
                    wedding.CreatedDate = DateTime.Now;
                    wedding.UserID      = UserID;
                    wedding.CreatedBy   = UserID;
                    wedding.IsActive    = true;
                    wedding.IsDeleted   = false;
                    AccuitAdminDbContext.Weddings.Add(wedding);
                    AccuitAdminDbContext.SaveChanges();

                    // Add default wedding event`
                    WeddingEvent newevent = new WeddingEvent();
                    newevent.CreatedBy       = UserID;
                    newevent.CreatedDate     = DateTime.Now;
                    newevent.StartTime       = wedding.WeddingDate;
                    newevent.EndTime         = wedding.WeddingDate.AddHours(10); // TBD Implementation
                    newevent.EventDate       = wedding.WeddingDate;
                    newevent.IsActive        = true;
                    newevent.IsDeleted       = false;
                    newevent.Title           = wedding.Title;
                    newevent.BackGroundImage = wedding.BackgroundImage;
                    newevent.WeddingID       = wedding.WeddingID;
                    AccuitAdminDbContext.WeddingEvents.Add(newevent);
                    AccuitAdminDbContext.SaveChanges();
                    //newevent.WeddingEventID = SubmitWeddingEvent(UserID, newevent);

                    scope.Complete();
                }
                else
                {
                    Wedding mywedding = AccuitAdminDbContext.Weddings.Where(x => x.WeddingID == wedding.WeddingID).FirstOrDefault();
                    mywedding.ModifiedDate    = DateTime.Now;
                    mywedding.ModifiedBy      = UserID;
                    mywedding.WeddingDate     = wedding.WeddingDate;
                    mywedding.IsLoveMarriage  = wedding.IsLoveMarriage;
                    mywedding.IconUrl         = wedding.IconUrl;
                    mywedding.BackgroundImage = wedding.BackgroundImage;
                    mywedding.Quote           = wedding.Quote;
                    mywedding.IsDeleted       = wedding.IsDeleted;
                    wedding.IsActive          = wedding.IsActive;
                    mywedding.videoUrl        = wedding.videoUrl;
                    mywedding.Title           = wedding.Title;
                    mywedding.fbPageUrl       = wedding.fbPageUrl;
                    mywedding.WeddingStyle    = wedding.WeddingStyle;
                    AccuitAdminDbContext.Entry <Wedding>(mywedding).State = System.Data.Entity.EntityState.Modified;
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
            }

            return(wedding.WeddingID);
        }
示例#3
0
 public int SubmitGallery(int UserID, WeddingGallery gallery)
 {
     using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
                                                          new TransactionOptions
     {
         IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
     }))
     {
         if (gallery.WeddingGalleryID == 0)
         {
             gallery.CreatedDate = DateTime.Now;
             gallery.CreatedBy   = UserID;
             AccuitAdminDbContext.WeddingGalleries.Add(gallery);
             AccuitAdminDbContext.SaveChanges();
             scope.Complete();
         }
         else
         {
             WeddingGallery gallry = AccuitAdminDbContext.WeddingGalleries.Where(x => x.WeddingGalleryID == gallery.WeddingGalleryID).First();
             gallry.ImageName  = gallery.ImageName;
             gallry.ImageTitle = gallery.ImageTitle;
             gallry.ImageUrl   = gallery.ImageUrl;
             gallry.IsDeleted  = gallery.IsDeleted;
             gallry.Place      = gallery.Place;
             AccuitAdminDbContext.Entry <WeddingGallery>(gallry).State = System.Data.Entity.EntityState.Modified;
             AccuitAdminDbContext.SaveChanges();
             scope.Complete();
         }
     }
     return(gallery.WeddingGalleryID);
 }
示例#4
0
        /// <summary>
        /// Authenticate OTP (One Time Password) entered by user
        /// </summary>
        /// <param name="userid">Userid</param>
        /// <param name="otp">One Time Password</param>
        /// <returns>reurns true if user have enterered latest OTP</returns>
        public bool AuthenticateOTP(int userid, string otp, out string GuidString, out int MaxAttUserts)
        {
            OTPMaster ObjOTP = AccuitAdminDbContext.OTPMasters.OrderByDescending(k => k.CreatedDate).FirstOrDefault(k => k.UserID == userid);

            GuidString   = "";
            MaxAttUserts = 0;
            if (ObjOTP != null)
            {
                MaxAttUserts = ObjOTP.Attempts.Value;
                if (ObjOTP.OTP == otp)
                {
                    GuidString = ObjOTP.GUID;
                    return(true);
                }
                else
                {
                    ObjOTP.Attempts = ++MaxAttUserts;
                    AccuitAdminDbContext.Entry <OTPMaster>(ObjOTP).State = System.Data.Entity.EntityState.Modified;
                    AccuitAdminDbContext.SaveChanges(); // TBD
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }
示例#5
0
        public bool InsertEmailRecord(EmailService email)
        {
            bool isSuccess = false;

            email.CreatedDate = System.DateTime.Now;
            AccuitAdminDbContext.EmailServices.Add(email);
            isSuccess = AccuitAdminDbContext.SaveChanges() > 0 ? true : false;
            return(isSuccess);
        }
示例#6
0
        public bool UpdatePassword(int UserID, string Password)
        {
            UserMaster user = AccuitAdminDbContext.UserMasters.FirstOrDefault(k => k.UserID == UserID && !k.isDeleted);

            user.Password      = EncryptionEngine.EncryptString(Password);
            user.AccountStatus = (int)AspectEnums.UserLoginStatus.Active;
            user.ModifiedDate  = DateTime.Now;
            user.ModifiedBy    = UserID;
            AccuitAdminDbContext.Entry <UserMaster>(user).State = System.Data.Entity.EntityState.Modified;
            //Delete all previous OTPs
            return(AccuitAdminDbContext.SaveChanges() > 0);
        }
示例#7
0
        /// <summary>
        /// save OTP (One Time Password) to database
        /// </summary>
        /// <param name="otp"> Object of OTP</param>
        /// <returns>returns true when data is saved</returns>
        public bool SaveOTP(OTPMaster otp)
        {
            bool IsSuccess = false;

            // In case from Generating OTP from Automatic redirect to Change Password because of not complex password multiple OTPs can be generated
            // Use this validation to restrict user to generate multiple OTPs
            if (ValidateUser(otp.UserID, AspectEnums.UserValidationType.LastAttemptDuration))
            {
                AccuitAdminDbContext.Entry <OTPMaster>(otp).State = System.Data.Entity.EntityState.Added;
                IsSuccess = AccuitAdminDbContext.SaveChanges() > 0;
            }
            return(IsSuccess);
        }
示例#8
0
        public int SubmitBrideMaids(int UserID, BrideAndMaid bridemaid)
        {
            int WeddingId = bridemaid.WeddingID;

            if (bridemaid.DateofBirth.Value.Year == 1)
            {
                bridemaid.DateofBirth = null;
            }
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
                                                                 new TransactionOptions
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
            }))
            {
                if (bridemaid.BrideAndMaidID == 0)
                {
                    bridemaid.CreatedDate = DateTime.Now;
                    bridemaid.IsDeleted   = false;
                    bridemaid.CreatedBy   = UserID;

                    AccuitAdminDbContext.BrideAndMaids.Add(bridemaid);
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
                else
                {
                    BrideAndMaid bridemaids = AccuitAdminDbContext.BrideAndMaids.Where(x => x.BrideAndMaidID == bridemaid.BrideAndMaidID).FirstOrDefault();
                    bridemaids.ModifiedDate      = DateTime.Now;
                    bridemaids.AboutBrideMaid    = bridemaid.AboutBrideMaid;
                    bridemaids.DateofBirth       = bridemaid.DateofBirth;
                    bridemaids.FirstName         = bridemaid.FirstName;
                    bridemaids.Imageurl          = bridemaid.Imageurl;
                    bridemaids.IsBride           = bridemaid.IsBride;
                    bridemaids.LastName          = bridemaid.LastName;
                    bridemaids.RelationWithBride = bridemaid.RelationWithBride;
                    bridemaids.fbUrl             = bridemaid.fbUrl;
                    bridemaids.googleUrl         = bridemaid.googleUrl;
                    bridemaids.instagramUrl      = bridemaid.instagramUrl;
                    bridemaids.ModifiedBy        = bridemaid.ModifiedBy;
                    bridemaids.IsDeleted         = bridemaid.IsDeleted;
                    AccuitAdminDbContext.Entry <BrideAndMaid>(bridemaids).State = System.Data.Entity.EntityState.Modified;
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
            }

            return(bridemaid.BrideAndMaidID);
        }
示例#9
0
        private void AddUserWeddingSubscription(int UserID, OrderDetail order)
        {
            ActivityLog.SetLog("WeddingDataImpl > Going to add user subscription for this order. " + order.OrderID, LogLoc.INFO);
            UserWeddingSubscription uws = new UserWeddingSubscription();

            uws.InvoiceNo  = order.OrderID;
            uws.TemplateID = order.TemplateID;
            uws.UserId     = UserID;
            uws.WeddingID  = null;
            SubscriptionMaster subs = AccuitAdminDbContext.SubscriptionMasters.Where(x => x.SubscriptionID == order.SubscrptionID).FirstOrDefault();

            uws.StartDate          = DateTime.Now;
            uws.EndDate            = DateTime.Now.AddDays(subs.Days);
            uws.IsDeleted          = false;
            uws.SubscriptionType   = subs.SubscriptionID;
            uws.SubscriptionStatus = (int)AspectEnums.SubscriptionStatus.Active;
            AccuitAdminDbContext.UserWeddingSubscriptions.Add(uws);
            AccuitAdminDbContext.SaveChanges();
        }
示例#10
0
        public int SubmitGroomMen(int UserID, GroomAndMan groom)
        {
            if (groom.DateofBirth.Value.Year == 1)
            {
                groom.DateofBirth = null;
            }
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
                                                                 new TransactionOptions
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
            }))
            {
                if (groom.GroomAndMenID == 0)
                {
                    groom.CreatedDate = DateTime.Now;
                    AccuitAdminDbContext.GroomAndMen.Add(groom);
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
                else
                {
                    GroomAndMan groomMen = AccuitAdminDbContext.GroomAndMen.Where(x => x.GroomAndMenID == groom.GroomAndMenID).First();
                    groomMen.ModifiedDate      = DateTime.Now;
                    groomMen.AboutMen          = groom.AboutMen;
                    groomMen.DateofBirth       = groom.DateofBirth;
                    groomMen.FirstName         = groom.FirstName;
                    groomMen.Imageurl          = groom.Imageurl;
                    groomMen.IsGroom           = groom.IsGroom;
                    groomMen.LastName          = groom.LastName;
                    groomMen.RelationWithGroom = groom.RelationWithGroom;
                    groomMen.fbUrl             = groom.fbUrl;
                    groomMen.googleUrl         = groom.googleUrl;
                    groomMen.instagramUrl      = groom.instagramUrl;
                    groomMen.IsDeleted         = groom.IsDeleted;
                    AccuitAdminDbContext.Entry <GroomAndMan>(groomMen).State = System.Data.Entity.EntityState.Modified;
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
            }

            return(groom.GroomAndMenID);
        }
示例#11
0
        public int SubmitWeddingEvent(int UserID, WeddingEvent weddevent)
        {
            WeddingEvent weddingevent = new WeddingEvent();

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
                                                                 new TransactionOptions
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
            }))
            {
                if (weddevent.WeddingEventID == 0)
                {
                    weddevent.CreatedDate = DateTime.Now;
                    weddevent.CreatedBy   = UserID;
                    weddevent.IsActive    = true;
                    weddevent.IsDeleted   = false;
                    AccuitAdminDbContext.WeddingEvents.Add(weddevent);
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
                else
                {
                    WeddingEvent myEvent = AccuitAdminDbContext.WeddingEvents.Where(x => x.WeddingEventID == weddevent.WeddingEventID).FirstOrDefault();
                    myEvent.ModifiedDate    = DateTime.Now;
                    myEvent.EventDate       = weddevent.EventDate;
                    myEvent.StartTime       = weddevent.StartTime;
                    myEvent.EndTime         = weddevent.EndTime;
                    myEvent.ImageUrl        = weddevent.ImageUrl;
                    myEvent.Title           = weddevent.Title;
                    myEvent.Aboutevent      = weddevent.Aboutevent;
                    myEvent.BackGroundImage = weddevent.BackGroundImage;
                    myEvent.IsActive        = weddevent.IsActive;
                    myEvent.IsDeleted       = weddevent.IsDeleted;
                    //myevent.About = weddevent.About;
                    AccuitAdminDbContext.Entry <WeddingEvent>(myEvent).State = System.Data.Entity.EntityState.Modified;
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
            }

            return(weddevent.WeddingEventID);
        }
示例#12
0
        public bool UpdateWeddingSubscription(UserWeddingSubscription subscription)
        {
            bool success = false;

            UserWeddingSubscription uws = new UserWeddingSubscription();

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
                                                                 new TransactionOptions
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
            }))
            {
                uws           = AccuitAdminDbContext.UserWeddingSubscriptions.Where(x => x.UserWeddingSubscrptionID == subscription.UserWeddingSubscrptionID).First();
                uws.WeddingID = subscription.WeddingID;
                AccuitAdminDbContext.Entry <UserWeddingSubscription>(uws).State = System.Data.Entity.EntityState.Modified;
                success = AccuitAdminDbContext.SaveChanges() > 0 ? true : false;
                scope.Complete();
            }
            return(success);
        }
示例#13
0
        public bool DeleteEventDetailsByID(int eventID, int UserID)
        {
            var venues = AccuitAdminDbContext.Venues.Where(x => x.WeddingEventID == eventID).ToList();

            foreach (var venue in venues)
            {
                venue.IsDeleted    = true;
                venue.ModifiedBy   = UserID;
                venue.IsActive     = false;
                venue.ModifiedDate = DateTime.Now;
                AccuitAdminDbContext.Entry <Venue>(venue).State = EntityState.Modified;
            }
            var weddingEvent = AccuitAdminDbContext.WeddingEvents.Where(x => x.WeddingEventID == eventID).FirstOrDefault();

            weddingEvent.IsDeleted    = true;
            weddingEvent.IsActive     = false;
            weddingEvent.ModifiedBy   = UserID;
            weddingEvent.ModifiedDate = DateTime.Now;
            AccuitAdminDbContext.Entry <WeddingEvent>(weddingEvent).State = EntityState.Modified;
            return(AccuitAdminDbContext.SaveChanges() > 0 ? true : false);
        }
示例#14
0
        public int SubmitVenue(int userID, Venue venue)
        {
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
                                                                 new TransactionOptions
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
            }))
            {
                if (venue.VenueID == 0)
                {
                    venue.CreatedDate = DateTime.Now;
                    venue.CreatedBy   = userID;
                    venue.IsActive    = true;
                    AccuitAdminDbContext.Venues.Add(venue);
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
                else
                {
                    Venue myVenue = AccuitAdminDbContext.Venues.Where(x => x.VenueID == venue.VenueID).FirstOrDefault();
                    myVenue.ModifiedDate        = DateTime.Now;
                    myVenue.VenueImageUrl       = venue.VenueImageUrl;
                    myVenue.VenueMobile         = venue.VenueMobile;
                    myVenue.VenuePhone          = venue.VenuePhone;
                    myVenue.VenueWebsite        = venue.VenueWebsite;
                    myVenue.VenueBannerImageUrl = venue.VenueBannerImageUrl;
                    myVenue.VenuePhone          = venue.VenuePhone;
                    myVenue.OwnerName           = venue.OwnerName;
                    myVenue.Name         = venue.Name;
                    myVenue.googleMapUrl = venue.googleMapUrl;
                    myVenue.IsActive     = venue.IsActive;
                    myVenue.IsDeleted    = venue.IsDeleted;
                    AccuitAdminDbContext.Entry(myVenue).State = System.Data.Entity.EntityState.Modified;
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
            }

            return(venue.VenueID);
        }
示例#15
0
 public int SubmitAddress(int userID, AddressMaster address)
 {
     using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
                                                          new TransactionOptions
     {
         IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
     }))
     {
         if (address.AddressID == 0)
         {
             address.CreatedDate = DateTime.Now;
             address.CreatedBy   = userID;
             address.IsDeleted   = false;
             AccuitAdminDbContext.AddressMasters.Add(address);
             AccuitAdminDbContext.SaveChanges();
             scope.Complete();
         }
         else
         {
             AddressMaster myaddress = AccuitAdminDbContext.AddressMasters.Where(x => x.AddressID == address.AddressID).FirstOrDefault();// GetWeddingDetailByID(weddingId).WeddingEvents.FirstOrDefault().Venues.Where(x => x.VenueID == venue.VenueID).FirstOrDefault();
             myaddress.ModifiedDate         = DateTime.Now;
             myaddress.Address1             = address.Address1;
             myaddress.Address2             = address.Address2;
             myaddress.City                 = address.City;
             myaddress.State                = address.State;
             myaddress.PinCode              = address.PinCode;
             myaddress.AddressOwnerType     = address.AddressOwnerType;
             myaddress.AddressOwnerTypePKID = address.AddressOwnerTypePKID;
             myaddress.VenueID              = address.VenueID;
             myaddress.AddressType          = address.AddressType;
             myaddress.IsDeleted            = address.IsDeleted;
             AccuitAdminDbContext.Entry(myaddress).State = EntityState.Modified;
             AccuitAdminDbContext.SaveChanges();
             scope.Complete();
         }
     }
     return(address.AddressID);
 }
示例#16
0
        public int SubmitUserOrder(OrderMaster order)
        {
            ActivityLog.SetLog("WeddingDataImpl > SubmitUserOrder initiated for User: "******"WeddingDataImpl > Main Order is Saved. ", LogLoc.INFO);
                    foreach (var item in order.OrderDetails)
                    {
                        for (int i = 1; i <= item.Quantity; i++)
                        {
                            AddUserWeddingSubscription(order.UserID, item);
                        }
                    }
                    scope.Complete();
                }
                else
                {
                    OrderMaster myOrder = AccuitAdminDbContext.OrderMasters.Where(x => x.OrderID == order.OrderID).FirstOrDefault();
                    AccuitAdminDbContext.Entry <OrderMaster>(myOrder).State = EntityState.Modified;
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
            }

            return(order.OrderID);
        }
示例#17
0
        public int SubmitTimeLine(int UserID, TimeLine timeline)
        {
            int weddingID = timeline.WeddingID;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
                                                                 new TransactionOptions
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
            }))
            {
                if (timeline.TimeLineID == 0)
                {
                    timeline.CreatedDate = DateTime.Now;
                    timeline.CreatedBy   = UserID;
                    AccuitAdminDbContext.TimeLines.Add(timeline);
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
                else
                {
                    TimeLine tLine = AccuitAdminDbContext.TimeLines.Where(x => x.TimeLineID == timeline.TimeLineID).First();
                    tLine.ModifiedDate = DateTime.Now;
                    tLine.StoryDate    = timeline.StoryDate;
                    tLine.Title        = timeline.Title;
                    tLine.ImageUrl     = timeline.ImageUrl;
                    tLine.Story        = timeline.Story;
                    tLine.IsDeleted    = timeline.IsDeleted;
                    tLine.ModifiedBy   = UserID;
                    tLine.Location     = timeline.Location;
                    AccuitAdminDbContext.Entry <TimeLine>(tLine).State = System.Data.Entity.EntityState.Modified;
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
            }

            return(timeline.TimeLineID);
        }