protected void btnDelete_Command(object sender, CommandEventArgs e)
 {
     try
     {
         string id = Convert.ToString(e.CommandArgument);
         if (!string.IsNullOrEmpty(id))
         {
             BlogPostCategoryBLL blogPostCategoryBLL = new BlogPostCategoryBLL();
             BlogPostCategories  blogPostCategory    = new BlogPostCategories();
             blogPostCategory.BlogPostCategoryId = Convert.ToInt32(QuaintSecurityManager.Decrypt(id));
             if (blogPostCategory.BlogPostCategoryId > 0)
             {
                 if (blogPostCategoryBLL.Delete(blogPostCategory))
                 {
                     Alert(AlertType.Success, "Deleted successfully.");
                     LoadList();
                 }
                 else
                 {
                     Alert(AlertType.Error, "Failed to delete.");
                 }
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to delete.");
     }
 }
        // Action Method(s)
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                AccountLogout();
                LoadUser();

                string redirectUrl = "~/Login.aspx?Ref=member";
                if (Request.QueryString["Redirect"] != null)
                {
                    redirectUrl = this.RedirectUrl = QuaintSecurityManager.DecryptUrl(Convert.ToString(Request.QueryString["Redirect"]));
                }

                if (Request.QueryString["Ref"] != null)
                {
                    if (Convert.ToString(Request.QueryString["Ref"]).ToLower() == "logout")
                    {
                        AccountLogout();
                        Response.Redirect(redirectUrl);
                    }
                    else if (Convert.ToString(Request.QueryString["Ref"]).ToLower() == "admin")
                    {
                        this.RedirectUrl = "~/Account/Dashboard.aspx";
                    }
                }
            }
        }
Пример #3
0
        protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
        {
            try
            {
                string id = Convert.ToString(e.CommandArgument);
                if (!string.IsNullOrEmpty(id))
                {
                    TutorialBLL tutorialBLL = new TutorialBLL();
                    DataTable   dt          = tutorialBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string    actionStatus = "Updated";
                            Tutorials tutorial     = new Tutorials();
                            tutorial.TutorialId   = Convert.ToInt32(Convert.ToString(dt.Rows[0]["TutorialId"]));
                            tutorial.TutorialCode = Convert.ToString(dt.Rows[0]["TutorialCode"]);
                            tutorial.Title        = Convert.ToString(dt.Rows[0]["Title"]);
                            tutorial.Slug         = Convert.ToString(dt.Rows[0]["Slug"]);
                            tutorial.Description  = Convert.ToString(dt.Rows[0]["Description"]);
                            tutorial.ExternalUrl  = Convert.ToString(dt.Rows[0]["ExternalUrl"]);
                            tutorial.IsActive     = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                            tutorial.PlayListId   = Convert.ToInt32(Convert.ToString(dt.Rows[0]["PlayListId"]));
                            tutorial.CreatedDate  = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                            tutorial.CreatedBy    = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                            tutorial.CreatedFrom  = Convert.ToString(dt.Rows[0]["CreatedFrom"]);

                            tutorial.UpdatedDate = DateTime.Now;
                            tutorial.UpdatedBy   = UserInfo;
                            tutorial.UpdatedFrom = StationInfo;

                            if (tutorial.IsActive)
                            {
                                tutorial.IsActive = false;
                                actionStatus      = "Deactivated";
                            }
                            else
                            {
                                tutorial.IsActive = true;
                                actionStatus      = "Activated";
                            }

                            if (tutorialBLL.Update(tutorial))
                            {
                                Alert(AlertType.Success, actionStatus + " successfully.");
                                LoadList();
                            }
                            else
                            {
                                Alert(AlertType.Error, "Failed to update.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to process.");
            }
        }
 protected void btnDelete_Command(object sender, CommandEventArgs e)
 {
     try
     {
         string id = Convert.ToString(e.CommandArgument);
         if (!string.IsNullOrEmpty(id))
         {
             EventBLL eventBLL = new EventBLL();
             Events   evnt     = new Events();
             evnt.EventId = Convert.ToInt32(QuaintSecurityManager.Decrypt(id));
             if (evnt.EventId > 0)
             {
                 if (eventBLL.Delete(evnt))
                 {
                     Alert(AlertType.Success, "Deleted successfully.");
                     LoadList();
                 }
                 else
                 {
                     Alert(AlertType.Error, "Failed to delete.");
                 }
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to delete.");
     }
 }
Пример #5
0
 protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
 {
     try
     {
         string id = Convert.ToString(e.CommandArgument);
         if (!string.IsNullOrEmpty(id))
         {
             RegistrationBLL registrationBLL = new RegistrationBLL();
             DataTable       dt = registrationBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
             if (dt != null)
             {
                 if (dt.Rows.Count > 0)
                 {
                     Registrations registration = new Registrations();
                     registration.RegistrationId   = Convert.ToInt32(Convert.ToString(dt.Rows[0]["RegistrationId"]));
                     registration.RegistrationCode = Convert.ToString(dt.Rows[0]["RegistrationCode"]);
                     registration.FullName         = Convert.ToString(dt.Rows[0]["FullName"]);
                     registration.Email            = Convert.ToString(dt.Rows[0]["Email"]);
                     registration.ContactNumber    = Convert.ToString(dt.Rows[0]["ContactNumber"]);
                     registration.Address          = Convert.ToString(dt.Rows[0]["Address"]);
                     registration.EventId          = Convert.ToInt32(dt.Rows[0]["EventId"]);
                 }
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to process.");
     }
 }
Пример #6
0
        private void LoadData(string slug)
        {
            try
            {
                BlogPostBLL blogPostBLL = new BlogPostBLL();
                DataTable   dt          = blogPostBLL.GetByBlogPostSlug(slug);

                txtTitle.InnerText           = Convert.ToString(dt.Rows[0]["Title"]);
                txtPublishedDate.Text        = Convert.ToDateTime(Convert.ToString(dt.Rows[0]["PublishedDate"])).ToString("dd MMMM yyyy");
                txtBlogPostCategoryName.Text = Convert.ToString(dt.Rows[0]["BlogPostCategoryName"]);
                txtDescription.InnerHtml     = Convert.ToString(dt.Rows[0]["Description"]);
                if (!string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["Attachment"])))
                {
                    string currentUrl  = HttpContext.Current.Request.Url.AbsoluteUri;
                    string redirectUrl = "~/Login.aspx?Ref=member&Redirect=" + QuaintSecurityManager.EncryptUrl(currentUrl);
                    lnkLogin.NavigateUrl   = redirectUrl;
                    txtAttachmentView.Text = Convert.ToString(dt.Rows[0]["Title"]);

                    txtAttachment.Text          = Convert.ToString(dt.Rows[0]["Title"]);
                    lnkDownload.CommandArgument = QuaintSAMS.Code.Global.FilePath.BlogPost + Convert.ToString(dt.Rows[0]["Attachment"]);

                    attachmentDownload.Visible = false;
                    attachmentView.Visible     = true;
                }
            }
            catch (Exception)
            {
                //throw;
            }
        }
        // Action Method(s)
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MultiEntryDisallow = false;
                QuaintSessionManager session = new QuaintSessionManager();
                UserInfo    = Convert.ToString(session.ActiveUserInformation);
                StationInfo = Convert.ToString(session.ActiveStationInformation);
                LoadLocation();

                if (Request.QueryString["Id"] != null)
                {
                    this.ModelId = Convert.ToInt32(QuaintSecurityManager.DecryptUrl(Convert.ToString(Request.QueryString["Id"])));
                    Edit(this.ModelId);
                    lblTitleStatus.Text        = "Update";
                    btnSave.Text               = "Update";
                    btnSaveAndContinue.Text    = "Update & Continue";
                    btnSaveAndContinue.Visible = false;
                }
                else
                {
                    GenerateCode();
                }
            }
        }
Пример #8
0
 protected void btnDelete_Command(object sender, CommandEventArgs e)
 {
     try
     {
         string id = Convert.ToString(e.CommandArgument);
         if (!string.IsNullOrEmpty(id))
         {
             HotelReservationBLL hotelReservationBLL = new HotelReservationBLL();
             HotelReservations   hotelReservation    = new HotelReservations();
             hotelReservation.HotelId = Convert.ToInt32(QuaintSecurityManager.Decrypt(id));
             if (hotelReservation.HotelId > 0)
             {
                 if (hotelReservationBLL.Delete(hotelReservation))
                 {
                     Alert(AlertType.Success, "Deleted successfully.");
                     LoadList();
                 }
                 else
                 {
                     Alert(AlertType.Error, "Failed to delete.");
                 }
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to delete.");
     }
 }
Пример #9
0
        protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
        {
            try
            {
                string id = Convert.ToString(e.CommandArgument);
                if (!string.IsNullOrEmpty(id))
                {
                    RankingBLL rankingBLL = new RankingBLL();
                    DataTable  dt         = rankingBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string   actionStatus = "Updated";
                            Rankings ranking      = new Rankings();
                            ranking.RankingId      = Convert.ToInt32(Convert.ToString(dt.Rows[0]["RankingId"]));
                            ranking.RankingCode    = Convert.ToString(dt.Rows[0]["RankingCode"]);
                            ranking.UniversityName = Convert.ToString(dt.Rows[0]["UniversityName"]);
                            ranking.Rank           = Convert.ToInt32(Convert.ToString(dt.Rows[0]["Rank"]));
                            ranking.Url            = Convert.ToString(dt.Rows[0]["Url"]);
                            ranking.Description    = Convert.ToString(dt.Rows[0]["Description"]);
                            ranking.IsActive       = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                            ranking.CountryId      = Convert.ToInt32(Convert.ToString(dt.Rows[0]["CountryId"]));
                            ranking.CreatedDate    = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                            ranking.CreatedBy      = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                            ranking.CreatedFrom    = Convert.ToString(dt.Rows[0]["CreatedFrom"]);

                            ranking.UpdatedDate = DateTime.Now;
                            ranking.UpdatedBy   = UserInfo;
                            ranking.UpdatedFrom = StationInfo;

                            if (ranking.IsActive)
                            {
                                ranking.IsActive = false;
                                actionStatus     = "Deactivated";
                            }
                            else
                            {
                                ranking.IsActive = true;
                                actionStatus     = "Activated";
                            }

                            if (rankingBLL.Update(ranking))
                            {
                                Alert(AlertType.Success, actionStatus + " successfully.");
                                LoadList();
                            }
                            else
                            {
                                Alert(AlertType.Error, "Failed to update.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to process.");
            }
        }
        protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
        {
            try
            {
                string id = Convert.ToString(e.CommandArgument);
                if (!string.IsNullOrEmpty(id))
                {
                    CountryBLL countryBLL = new CountryBLL();
                    DataTable  dt         = countryBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string    actionStatus = "Updated";
                            Countries country      = new Countries();
                            country.CountryId         = Convert.ToInt32(Convert.ToString(dt.Rows[0]["CountryId"]));
                            country.CountryCode       = Convert.ToString(dt.Rows[0]["CountryCode"]);
                            country.Name              = Convert.ToString(dt.Rows[0]["Name"]);
                            country.CountryCodeAlpha2 = Convert.ToString(dt.Rows[0]["CountryCodeAlpha2"]);
                            country.CountryCodeAlpha3 = Convert.ToString(dt.Rows[0]["CountryCodeAlpha3"]);
                            country.Description       = Convert.ToString(dt.Rows[0]["Description"]);
                            country.IsActive          = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                            country.CreatedDate       = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                            country.CreatedBy         = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                            country.CreatedFrom       = Convert.ToString(dt.Rows[0]["CreatedFrom"]);

                            country.UpdatedDate = DateTime.Now;
                            country.UpdatedBy   = UserInfo;
                            country.UpdatedFrom = StationInfo;

                            if (country.IsActive)
                            {
                                country.IsActive = false;
                                actionStatus     = "Deactivated";
                            }
                            else
                            {
                                country.IsActive = true;
                                actionStatus     = "Activated";
                            }

                            if (countryBLL.Update(country))
                            {
                                Alert(AlertType.Success, actionStatus + " successfully.");
                                LoadList();
                            }
                            else
                            {
                                Alert(AlertType.Error, "Failed to update.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to process.");
            }
        }
Пример #11
0
        // Action Method(s)
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //MultiEntryDisallow = false;
                QuaintSessionManager session = new QuaintSessionManager();
                UserInfo    = Convert.ToString(session.ActiveUserInformation);
                StationInfo = Convert.ToString(session.ActiveStationInformation);
                GenerateCode();

                if (Request.QueryString["Id"] != null)
                {
                    this.ModelId = Convert.ToInt32(QuaintSecurityManager.DecryptUrl(Convert.ToString(Request.QueryString["Id"])));
                }
            }
        }
Пример #12
0
        private UsersModel AccountLogin(Users user)
        {
            try
            {
                UsersModel usrModel = new UsersModel();

                if (!string.IsNullOrEmpty(this.ModelReference))
                {
                    if (this.ModelReference == "admin")
                    {
                        foreach (UsersModel usr in this.UserList)
                        {
                            if (usr.UserName == user.UserName && QuaintSecurityManager.Decrypt(usr.Password) == user.Password)
                            {
                                usrModel = usr;
                                break;
                            }
                        }
                    }
                    else if (this.ModelReference == "member")
                    {
                        foreach (UsersModel usr in this.MemberList)
                        {
                            if (usr.UserName == user.UserName && QuaintSecurityManager.Decrypt(usr.Password) == user.Password)
                            {
                                usrModel = usr;
                                break;
                            }
                        }
                    }
                }

                if (usrModel != null)
                {
                    return(usrModel);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #13
0
        private bool IsPasswordExist(Users user)
        {
            try
            {
                bool       flag     = false;
                UsersModel usrModel = new UsersModel();

                if (!string.IsNullOrEmpty(this.ModelReference))
                {
                    if (this.ModelReference == "admin")
                    {
                        foreach (UsersModel usr in this.UserList)
                        {
                            if (usr.UserName == user.UserName && QuaintSecurityManager.Decrypt(usr.Password) == user.Password)
                            {
                                usrModel = usr;
                                flag     = true;
                                break;
                            }
                        }
                    }
                    else if (this.ModelReference == "member")
                    {
                        foreach (UsersModel usr in this.MemberList)
                        {
                            if (usr.UserName == user.UserName && QuaintSecurityManager.Decrypt(usr.Password) == user.Password)
                            {
                                usrModel = usr;
                                flag     = true;
                                break;
                            }
                        }
                    }
                }

                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                QuaintSessionManager session = new QuaintSessionManager();
                if (session.HasSession)
                {
                    areaAccess.Visible   = false;
                    areaUserInfo.Visible = true;
                    lblUserName.Text     = session.ActiveUserName;

                    string currentUrl  = HttpContext.Current.Request.Url.AbsoluteUri;
                    string redirectUrl = "~/Login.aspx?Ref=logout&Redirect=" + QuaintSecurityManager.EncryptUrl(currentUrl);
                    btnLogout.HRef = redirectUrl;
                }
                else
                {
                    areaAccess.Visible   = true;
                    areaUserInfo.Visible = false;
                    lblUserName.Text     = string.Empty;
                }
            }
        }
        protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
        {
            try
            {
                string id = Convert.ToString(e.CommandArgument);
                if (!string.IsNullOrEmpty(id))
                {
                    EventBLL  eventBLL = new EventBLL();
                    DataTable dt       = eventBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string actionStatus = "Updated";
                            Events evnt         = new Events();
                            evnt.EventId     = Convert.ToInt32(Convert.ToString(dt.Rows[0]["EventId"]));
                            evnt.EventCode   = Convert.ToString(dt.Rows[0]["EventCode"]);
                            evnt.Title       = Convert.ToString(dt.Rows[0]["Title"]);
                            evnt.Slag        = Convert.ToString(dt.Rows[0]["Slag"]);
                            evnt.FromDate    = Convert.ToDateTime(dt.Rows[0]["FromDate"]);
                            evnt.ToDate      = Convert.ToDateTime(dt.Rows[0]["ToDate"]);
                            evnt.Description = Convert.ToString(dt.Rows[0]["Description"]);
                            evnt.IsActive    = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                            evnt.CreatedDate = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                            evnt.CreatedBy   = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                            evnt.CreatedFrom = Convert.ToString(dt.Rows[0]["CreatedFrom"]);
                            evnt.LocationId  = Convert.ToInt32(dt.Rows[0]["LocationId"]);

                            evnt.UpdatedDate = DateTime.Now;
                            evnt.UpdatedBy   = UserInfo;
                            evnt.UpdatedFrom = StationInfo;

                            if (evnt.IsActive)
                            {
                                evnt.IsActive = false;
                                actionStatus  = "Deactivated";
                            }
                            else
                            {
                                evnt.IsActive = true;
                                actionStatus  = "Activated";
                            }

                            if (eventBLL.Update(evnt))
                            {
                                Alert(AlertType.Success, actionStatus + " successfully.");
                                LoadList();
                            }
                            else
                            {
                                Alert(AlertType.Error, "Failed to update.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to process.");
            }
        }
Пример #16
0
        protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
        {
            try
            {
                string id = Convert.ToString(e.CommandArgument);
                if (!string.IsNullOrEmpty(id))
                {
                    GuideBLL  guideBLL = new GuideBLL();
                    DataTable dt       = guideBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string actionStatus = "Updated";
                            Guides guide        = new Guides();
                            guide.GuideId       = Convert.ToInt32(Convert.ToString(dt.Rows[0]["GuideId"]));
                            guide.GuideCode     = Convert.ToString(dt.Rows[0]["GuideCode"]);
                            guide.Name          = Convert.ToString(dt.Rows[0]["Name"]);
                            guide.ContactNumber = Convert.ToString(dt.Rows[0]["ContactNumber"]);
                            guide.Email         = Convert.ToString(dt.Rows[0]["Email"]);
                            guide.AddressLine1  = Convert.ToString(dt.Rows[0]["AddressLine1"]);
                            guide.AddressLine2  = Convert.ToString(dt.Rows[0]["AddressLine2"]);
                            guide.IsActive      = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                            guide.CreatedDate   = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                            guide.CreatedBy     = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                            guide.CreatedFrom   = Convert.ToString(dt.Rows[0]["CreatedFrom"]);
                            guide.LocationId    = Convert.ToInt32(dt.Rows[0]["LocationId"]);

                            guide.UpdatedDate = DateTime.Now;
                            guide.UpdatedBy   = UserInfo;
                            guide.UpdatedFrom = StationInfo;

                            if (guide.IsActive)
                            {
                                guide.IsActive = false;
                                actionStatus   = "Deactivated";
                            }
                            else
                            {
                                guide.IsActive = true;
                                actionStatus   = "Activated";
                            }

                            if (guideBLL.Update(guide))
                            {
                                Alert(AlertType.Success, actionStatus + " successfully.");
                                LoadList();
                            }
                            else
                            {
                                Alert(AlertType.Error, "Failed to update.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to process.");
            }
        }
Пример #17
0
        protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
        {
            try
            {
                string id = Convert.ToString(e.CommandArgument);
                if (!string.IsNullOrEmpty(id))
                {
                    HotelReservationBLL hotelReservationBLL = new HotelReservationBLL();
                    DataTable           dt = hotelReservationBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string            actionStatus     = "Updated";
                            HotelReservations hotelReservation = new HotelReservations();
                            hotelReservation.HotelId       = Convert.ToInt32(Convert.ToString(dt.Rows[0]["HotelId"]));
                            hotelReservation.HotelCode     = Convert.ToString(dt.Rows[0]["HotelCode"]);
                            hotelReservation.HotelName     = Convert.ToString(dt.Rows[0]["HotelName"]);
                            hotelReservation.ArrivalDate   = Convert.ToDateTime(dt.Rows[0]["ArrivalDate"]);
                            hotelReservation.DepartureDate = Convert.ToDateTime(dt.Rows[0]["DepartureDate"]);
                            hotelReservation.RoomType      = Convert.ToString(dt.Rows[0]["RoomType"]);
                            hotelReservation.BookedBy      = Convert.ToString(dt.Rows[0]["BookedBy"]);
                            hotelReservation.Email         = Convert.ToString(dt.Rows[0]["Email"]);
                            hotelReservation.ContactNumber = Convert.ToString(dt.Rows[0]["ContactNumber"]);
                            hotelReservation.Address       = Convert.ToString(dt.Rows[0]["Address"]);
                            hotelReservation.IsActive      = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                            hotelReservation.CreatedDate   = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                            hotelReservation.CreatedBy     = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                            hotelReservation.CreatedFrom   = Convert.ToString(dt.Rows[0]["CreatedFrom"]);

                            hotelReservation.UpdatedDate = DateTime.Now;
                            hotelReservation.UpdatedBy   = UserInfo;
                            hotelReservation.UpdatedFrom = StationInfo;

                            if (hotelReservation.IsActive)
                            {
                                hotelReservation.IsActive = false;
                                actionStatus = "Deactivated";
                            }
                            else
                            {
                                hotelReservation.IsActive = true;
                                actionStatus = "Activated";
                            }

                            if (hotelReservationBLL.Update(hotelReservation))
                            {
                                Alert(AlertType.Success, actionStatus + " successfully.");
                                LoadList();
                            }
                            else
                            {
                                Alert(AlertType.Error, "Failed to update.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to process.");
            }
        }
Пример #18
0
        protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
        {
            try
            {
                string id = Convert.ToString(e.CommandArgument);
                if (!string.IsNullOrEmpty(id))
                {
                    InstituteBLL instituteBLL = new InstituteBLL();
                    DataTable    dt           = instituteBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string     actionStatus = "Updated";
                            Institutes institute    = new Institutes();
                            institute.InstituteId   = Convert.ToInt32(Convert.ToString(dt.Rows[0]["InstituteId"]));
                            institute.InstituteCode = Convert.ToString(dt.Rows[0]["InstituteCode"]);
                            institute.Name          = Convert.ToString(dt.Rows[0]["Name"]);
                            institute.Logo          = Convert.ToString(dt.Rows[0]["Logo"]);
                            institute.Url           = Convert.ToString(dt.Rows[0]["Url"]);
                            institute.Description   = Convert.ToString(dt.Rows[0]["Description"]);
                            institute.SerialNumber  = Convert.ToInt32(dt.Rows[0]["SerialNumber"]);
                            institute.Attachment    = Convert.ToString(dt.Rows[0]["Attachment"]);
                            institute.IsActive      = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                            institute.CreatedDate   = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                            institute.CreatedBy     = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                            institute.CreatedFrom   = Convert.ToString(dt.Rows[0]["CreatedFrom"]);
                            institute.CourseId      = Convert.ToInt32(Convert.ToString(dt.Rows[0]["CourseId"]));

                            institute.UpdatedDate = DateTime.Now;
                            institute.UpdatedBy   = UserInfo;
                            institute.UpdatedFrom = StationInfo;

                            if (institute.IsActive)
                            {
                                institute.IsActive = false;
                                actionStatus       = "Deactivated";
                            }
                            else
                            {
                                institute.IsActive = true;
                                actionStatus       = "Activated";
                            }

                            if (instituteBLL.Update(institute))
                            {
                                Alert(AlertType.Success, actionStatus + " successfully.");
                                LoadList();
                            }
                            else
                            {
                                Alert(AlertType.Error, "Failed to update.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to process.");
            }
        }