Exemplo n.º 1
0
        private void SetTitle(Guid providerID)
        {
            ProviderDAC dac = new ProviderDAC();

            if (dac.IsUserImageExist(providerID))
            {
                divWithImage.Visible = true;
                divNoImage.Visible   = false;
                int ImageID = new ProviderBFC().getProviderPrimaryImage(providerID);
                if (ImageID != 0)
                {
                    ProviderImage.ImageUrl = "~/ImageHandler.ashx?" + SystemConstants.qs_UserImageID + "=" + ImageID;
                }
                else
                {
                    divWithImage.Visible = false;
                    divNoImage.Visible   = true;
                }
            }
            else
            {
                divWithImage.Visible = false;
                divNoImage.Visible   = true;
            }
        }
Exemplo n.º 2
0
        protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName == "SetAsMainImage" || e.CommandName == "DeleteImage" || e.CommandName == "ViewImage" || e.CommandName == "SaveImage" || e.CommandName == "CancelEditImage" || e.CommandName == "EditImage")
            {
                LinkButton  lnkDelete  = e.Item.FindControl("lnkDelete") as LinkButton;
                HiddenField hdnImageID = e.Item.FindControl("hdnImageID") as HiddenField;
                int         imageID    = Convert.ToInt32(hdnImageID.Value);
                ProviderDAC dac        = new ProviderDAC();
                ProviderBFC bfc        = new ProviderBFC();

                Label       lblImageDescription = e.Item.FindControl("lblImageDescription") as Label;
                Label       lblImageTitle       = e.Item.FindControl("lblImageTitle") as Label;
                TextBox     txtImageTitle       = e.Item.FindControl("txtImageTitle") as TextBox;
                TextBox     ckImageDescription  = e.Item.FindControl("txtImageDescription") as TextBox;
                HiddenField hdnFilesize         = e.Item.FindControl("hdnFilesize") as HiddenField;

                if (e.CommandName == "DeleteImage")
                {
                    string imageVirtualPath      = "";
                    string imageThumbVirtualPath = "";
                    bfc.DeleteActivityImage(ActivityID, imageID, Convert.ToInt32(hdnFilesize.Value), out imageThumbVirtualPath, out imageVirtualPath);
                    Refresh();
                }
                else if (e.CommandName == "SetAsMainImage")
                {
                    dac.UpdateActivityPrimaryImage(ActivityID, imageID);
                    Refresh();
                    foreach (DataListItem item in DataList1.Items)
                    {
                        SetDataListItemMode(item, true);
                    }
                }
            }
        }
Exemplo n.º 3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            lblError.Visible = divError.Visible = false;
            bool isnotValid = checkValid();

            if (!isnotValid)
            {
                //drActivity
                var drDetail = ActivityRegistrationDetailUC.getDetails();
                drDetail.Status = (int)SystemConstants.ActivityStatus.Active;
                string shortDescription = "";
                string fullDescription  = "";

                ActivityRegistrationDescriptionUC.getActivityDetails(out shortDescription, out fullDescription);
                drDetail = ActivityRegistrationDescriptionUC.getDetails(drDetail);
                drDetail.ShortDescription = "";
                drDetail.FullDescription  = fullDescription;
                DateTime activityExpiryDate = DateTime.Today;
                bool     usingTimetable;
                ActivityRegistrationTimetableUC.getExpiry(out activityExpiryDate, out usingTimetable);
                drDetail.ExpiryDate = activityExpiryDate;
                drDetail.ProviderID = ProviderID;
                if (usingTimetable)
                {
                    drDetail.TimetableType = (int)SystemConstants.ScheduleViewFormat.Datagrid;
                }
                else
                {
                    drDetail.TimetableType = (int)SystemConstants.ScheduleViewFormat.noTimetable;
                }

                //drActivityContact
                var contactDetails = ActivityRegistrationDetailUC.getContactDetail();

                //dtSchedule
                var dtActSchedule = ActivityRegistrationTimetableUC.getTimetable(false);

                //drGrouping
                var drActGrouping = ActivityRegistrationGroup.getActSuitability();
                drDetail.Keywords = ActivityRegistrationGroup.getKeywords();
                int actID;

                //drImage
                var drImageDetail = ActivityRegistrationImageUC.GetImageDetail();
                var dtImages      = ActivityRegistrationImageUC.GetImages();

                ProviderBFC.SaveActivity(drDetail, contactDetails, drActGrouping, dtActSchedule, drImageDetail, dtImages, out actID);


                Response.Redirect("~/Activities/");
            }
            else
            {
                lblError.Visible = divError.Visible = true;
            }
        }
Exemplo n.º 4
0
        private bool AuthUser()
        {
            if (WebSecurity.IsAuthenticated)
            {
                var providerID = new MembershipHelper().GetProviderUserKey(WebSecurity.CurrentUserId);
                var ownerLogin = new ProviderBFC().CheckActivityOwner(ActivityID, providerID);

                return(ownerLogin);
            }
            else
            {
                Response.Redirect("~/Account/Login.aspx");
                return(false);
            }
        }
        private void setTimetableGridDataSource()
        {
            ods.TypeName     = typeof(ProviderBFC).FullName;
            ods.EnablePaging = true;
            ods.SelectParameters.Clear();
            ods.SelectParameters.Add("activityID", ActivityID.ToString());
            ods.SelectMethod               = "RetrieveTimetableGrid";
            ods.SelectCountMethod          = "RetrieveTimetableGridCount";
            ods.MaximumRowsParameterName   = "amount";
            ods.StartRowIndexParameterName = "startIndex";
            ods.SortParameterName          = "sortExpression";
            var timetable = new ProviderBFC().RetrieveTimetableGrid(0, 9999, ActivityID.ToString(), "");

            GridView1.DataSource = timetable;
            GridView1.DataBind();
        }
Exemplo n.º 6
0
        protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            LinkButton  lnkDelete  = e.Item.FindControl("lnkDelete") as LinkButton;
            HiddenField hdnImageID = e.Item.FindControl("hdnImageID") as HiddenField;
            int         imageID    = Convert.ToInt32(hdnImageID.Value);
            ProviderDAC dac        = new ProviderDAC();
            ProviderBFC bfc        = new ProviderBFC();

            Label       lblImageDescription = e.Item.FindControl("lblImageDescription") as Label;
            Label       lblImageTitle       = e.Item.FindControl("lblImageTitle") as Label;
            TextBox     txtImageTitle       = e.Item.FindControl("txtImageTitle") as TextBox;
            TextBox     ckImageDescription  = e.Item.FindControl("txtImageDescription") as TextBox;
            HiddenField hdnFilesize         = e.Item.FindControl("hdnFilesize") as HiddenField;

            if (e.CommandName == "DeleteImage")
            {
                string imageVirtualPath      = "";
                string imageThumbVirtualPath = "";
                bfc.DeleteUserImage(ProviderID, imageID, Convert.ToInt32(hdnFilesize.Value), out imageThumbVirtualPath, out imageVirtualPath);

                string imageFilePath      = Server.MapPath(imageVirtualPath);
                string imageThumbFilePath = Server.MapPath(imageThumbVirtualPath);

                FileInfo image      = new FileInfo(imageFilePath);
                FileInfo imageThumb = new FileInfo(imageThumbFilePath);
                if (image.Exists)
                {
                    File.Delete(imageFilePath);
                }
                if (imageThumb.Exists)
                {
                    File.Delete(imageThumbFilePath);
                }
            }
            else if (e.CommandName == "SetAsPrimaryImage")
            {
                dac.UpdateUserPrimaryImage(ProviderID, imageID);
            }
            Refresh();
        }
Exemplo n.º 7
0
        internal void Refresh()
        {
            ddSort.SelectedValue = SortValue;
            lblKeyword.Visible   = false;

            if (SearchKey != null)
            {
                String SearchPhrase = new ProviderBFC().RefineSearchKey(SearchKey);
                SetDataSourceFromSearchKey(SearchPhrase);


                lblAmount.Text = new ProviderDAC().RetrieveProviderActivitiesbySearchPhraseCount(ProviderID, SearchPhrase).ToString();

                if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow))
                {
                    lblEndIndex.Text = lblAmount.Text;
                }
                else
                {
                    lblEndIndex.Text = (StartRow + PageSize).ToString();
                }

                lblStartIndex.Text = (StartRow + 1).ToString();

                if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text))
                {
                    lblStartIndex.Text = lblEndIndex.Text;
                }

                lblEndIndex1.Text   = lblEndIndex.Text;
                lblStartIndex1.Text = lblStartIndex.Text;
                lblAmount1.Text     = lblAmount.Text;

                lblKeyword.Visible = true;
                if (lblAmount.Text != "0")
                {
                    lblKeyword.Text = "Search Found " + lblAmount.Text + " Record  with keyword '" + SearchKey + "'";
                }
                else
                {
                    lblKeyword.Text = "there are no records with keyword '" + SearchKey + "'";
                }
            }
            else
            {
                SetDataSourceFromCategoryProvider();
                lblAmount.Text = new ProviderDAC().RetrieveProviderActivitiesbyCategoryIDCount(ProviderID, CategoryID).ToString();

                if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow))
                {
                    lblEndIndex.Text = lblAmount.Text;
                }
                else
                {
                    lblEndIndex.Text = (StartRow + PageSize).ToString();
                }

                lblStartIndex.Text = (StartRow + 1).ToString();

                if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text))
                {
                    lblStartIndex.Text = lblEndIndex.Text;
                }

                lblEndIndex1.Text   = lblEndIndex.Text;
                lblStartIndex1.Text = lblStartIndex.Text;
                lblAmount1.Text     = lblAmount.Text;
            }
        }
Exemplo n.º 8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            bool isNotValid = !checkValid();

            if (isNotValid)
            {
                //drActivity
                var drDetail = ActivityRegistrationDetailUC1.getDetails();
                drDetail.Status = (int)SystemConstants.ActivityStatus.Active;
                string shortDescription = "";
                string fullDescription  = "";

                ActivityRegistrationDescriptionUC1.getActivityDetails(out shortDescription, out fullDescription);
                drDetail = ActivityRegistrationDescriptionUC1.getDetails(drDetail);
                drDetail.ShortDescription = "";
                drDetail.FullDescription  = fullDescription;
                DateTime activityExpiryDate = DateTime.Today;
                bool     usingTimetable;
                ActivityRegistrationTimetableUC1.getExpiry(out activityExpiryDate, out usingTimetable);
                drDetail.ExpiryDate = activityExpiryDate;
                drDetail.ProviderID = ProviderID;
                if (usingTimetable)
                {
                    drDetail.TimetableType = (int)SystemConstants.ScheduleViewFormat.Datagrid;
                }
                else
                {
                    drDetail.TimetableType = (int)SystemConstants.ScheduleViewFormat.noTimetable;
                }

                //drActivityContact
                var contactDetails = ActivityRegistrationDetailUC1.getContactDetail();

                //dtSchedule
                var dtActSchedule = ActivityRegistrationTimetableUC1.getTimetable(false);

                //drGrouping
                var drActGrouping = activityregistrationgroup1.getActSuitability();
                drDetail.Keywords = activityregistrationgroup1.getKeywords();
                int actID;


                /*//drActivity
                 * var drDetail = ActivityRegistrationDetailUC1.getDetails();
                 * drDetail.Status = (int)SystemConstants.ActivityStatus.Active;
                 * string shortDescription = "";
                 * string fullDescription = "";
                 * ActivityRegistrationDescriptionUC1.getActivityDetails(out shortDescription, out fullDescription);
                 * drDetail.ShortDescription = shortDescription;
                 * drDetail.FullDescription = fullDescription;
                 * DateTime activityExpiryDate = DateTime.Today;
                 * bool usingtimetable;
                 * ActivityRegistrationTimetableUC1.getExpiry(out activityExpiryDate, out usingtimetable);
                 * drDetail.ExpiryDate = activityExpiryDate;
                 * drDetail.ProviderID = ProviderID;
                 * if (usingtimetable)
                 *  drDetail.TimetableType = (int)SystemConstants.ScheduleViewFormat.Datagrid;
                 * else
                 *  drDetail.TimetableType = (int)SystemConstants.ScheduleViewFormat.noTimetable;
                 *
                 * //drActivityContact
                 * var contactDetails = ActivityRegistrationDetailUC1.getContactDetail();
                 *
                 * //drGrouping
                 * var drActGrouping = ActivityRegistrationGroup1.getActSuitability();
                 * string keywords = ActivityRegistrationGroup1.getKeywords();
                 * drDetail.Keywords = keywords;
                 *
                 * drDetail.ID = contactDetails.ActivityID = drActGrouping.ActivityID = ActivityID;
                 *
                 * //dtSchedule
                 */

                foreach (var drActSchedule in dtActSchedule)
                {
                    drActSchedule.ActivityID = ActivityID;
                }
                ProviderBFC.UpdateActivity(ActivityID, drDetail, contactDetails, drActGrouping, dtActSchedule);

                Response.Redirect("~/Activities");
            }
            else
            {
                lblError.Visible = divError.Visible = true;
            }
        }