Ejemplo n.º 1
0
 protected void DeleteCheckForException(object sender, ObjectDataSourceStatusEventArgs args)
 {
     if (args.Exception == null)
     {
         MessageUserControl.ShowInfo("process successful", "Album was successfully DELETED");
     }
     else
     {
         MessageUserControl.HandleDataBoundException(args);
     }
 }
        protected void MoveUp_Click(object sender, EventArgs e)
        {
            if (PlayList.Rows.Count == 0)
            {
                MessageUserControl.ShowInfo("Warning", "You must have a playlist showing. Fetch your playlist.");
            }
            else
            {
                if (string.IsNullOrEmpty(PlaylistName.Text))
                {
                    MessageUserControl.ShowInfo("Warning", "You must have a playlist showing. Enter your playlist name.");
                    //optionally you might wish to empty the Playlist GridView
                }
                else
                {
                    //check that a single track has been checked
                    //if so, extrack the needed data from the selected GridViewRow
                    //the TrackId is a hidden column on the GridViewRow.
                    int      trackid           = 0;
                    int      tracknumber       = 0;
                    int      rowselected       = 0;
                    CheckBox playlistselection = null;
                    for (int rowindex = 0; rowindex < PlayList.Rows.Count; rowindex++)
                    {
                        playlistselection = PlayList.Rows[rowindex].FindControl("Selected") as CheckBox;
                        //is the CheckBox on
                        if (playlistselection.Checked)
                        {
                            trackid     = int.Parse((PlayList.Rows[rowindex].FindControl("TrackID") as Label).Text); //the inner most is a pointer, then text, then to int.
                            tracknumber = int.Parse((PlayList.Rows[rowindex].FindControl("TrackNumber") as Label).Text);
                            rowselected++;                                                                           //counter for number of checked items (rule says only one item can be moved)
                        }
                    } // endoftheforloop

                    //how many of the tracks were checked
                    if (rowselected != 1)
                    {
                        MessageUserControl.ShowInfo("Warning", "Select one track to move.");
                    }
                    else
                    {
                        if (tracknumber == 1)
                        {
                            MessageUserControl.ShowInfo("Warning", "Track cannot be moved up.");
                        }
                        else
                        {
                            //move the track
                            MoveTrack(trackid, tracknumber, "up");
                        }
                    }
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.IsAuthenticated && (User.IsInRole("Director") || User.IsInRole("OfficeManager")))
     {
         MessageUserControl.ShowInfo("", "You've successfully logged in");
     }
     else
     {
         Response.Redirect("~/Account/Login.aspx");
     }
 }
    protected void Clear_Click(object sender, EventArgs e)
    {
        PurchaseOrderController sysmgr = new PurchaseOrderController();
        string message = sysmgr.transaction(null, 4, int.Parse(VendorsDisplay.SelectedValue), 0, 0);

        PurchaseOrderView.DataBind();
        CurrentInventoryView.DataBind();
        VendorsDisplay.SelectedIndex = 0;
        hide_everything();
        MessageUserControl.ShowInfo(message);
    }
 protected void CheckForExceptions(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception == null)
     {
         MessageUserControl.ShowInfo("Success");
     }
     else
     {
         MessageUserControl.HandleDataBoundException(e);
     }
 }
 protected void LookupInvoiceButton_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(OriginalInvoiceValue.Text))
     {
         MessageUserControl.ShowInfo("", "Error: Must enter original invoice number");
     }
     else
     {
         SearchArg.Text = OriginalInvoiceValue.Text;
     }
 }
 protected void DeleteCheckForException(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception == null)
     {
         MessageUserControl.ShowInfo("", "SUCCESS: Album has been removed.");
     }
     else
     {
         MessageUserControl.HandleDataBoundException(e);
     }
 }
Ejemplo n.º 8
0
        protected void DeleteTrack_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(PlaylistName.Text))
            {
                MessageUserControl.ShowInfo("Required Data", "PlayList Name is Required to ADD a Track");
            }
            else
            {
                if (PlayList.Rows.Count == 0)
                {
                    MessageUserControl.ShowInfo("Required Data", "No Play List is available. Retrieve your playlist");
                }
                else
                {
                    //Traverse the firdview and collect the list of tracks to remove.
                    List <int> tracktodelete     = new List <int>();
                    int        rowSelected       = 0;
                    CheckBox   playlistselection = null;
                    for (int rowindex = 0; rowindex < PlayList.Rows.Count; rowindex++)
                    {
                        //Access the control on the indexed GridViewRow
                        //Set the CheckBox pointer to this checkbox control
                        playlistselection = PlayList.Rows[rowindex].FindControl("Selected") as CheckBox;
                        if (playlistselection.Checked)
                        {
                            //Increment selected number of rows
                            rowSelected++;
                            //Gather the data needed for the BLL call.
                            tracktodelete.Add(int.Parse((PlayList.Rows[rowindex].FindControl("TrackID") as Label).Text));
                        }
                    }
                    if (rowSelected == 0)
                    {
                        MessageUserControl.ShowInfo("Required Data", "PlayList Name is Required to Remove a Track");
                    }
                    else
                    {
                        //Using the obtained data, issue your call to the BLL Method
                        //This work will be done whinin a TryRun()
                        MessageUserControl.TryRun(() =>
                        {
                            PlaylistTracksController sysmgr = new PlaylistTracksController();
                            //there is only one call to add the data to the database
                            sysmgr.DeleteTracks(User.Identity.Name, PlaylistName.Text, tracktodelete);

                            //Refresh the PlayList is a READ
                            List <UserPlaylistTrack> datainfo = sysmgr.List_TracksForPlaylist(PlaylistName.Text, User.Identity.Name);
                            PlayList.DataSource = datainfo;
                            PlayList.DataBind();
                        }, "Deleting a Track", "Track Has been Deleted from the Play List");
                    }
                }
            }
        }
Ejemplo n.º 9
0
 protected void AlbumFetch_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(AlbumTitle.Text))
     {
         MessageUserControl.ShowInfo("Search entry error", "Enter a album title or partial album title, then press your button.");
         SearchArg.Text = "dddfgg";
     }
     TracksBy.Text  = "Album";
     SearchArg.Text = AlbumTitle.Text;
     //to force the listview to rebind to execute again
 }
Ejemplo n.º 10
0
 protected void FetchWaiter_Click(object sender, EventArgs e)
 {
     if (WaiterList.SelectedIndex == 0)
     {
         MessageUserControl.ShowInfo("Please select a waiter before clicking Show Waiter.");
     }
     else
     {
         MessageUserControl.TryRun((ProcessRequest)GetWaiterInfo);
     }
 }
 protected void UpdateCheckForException(object sencder, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception == null)
     {
         MessageUserControl.ShowInfo("Process success", "Album has been updated");
     }
     else
     {
         MessageUserControl.HandleDataBoundException(e);
     }
 }
Ejemplo n.º 12
0
 protected void ClearBtn_Click(object sender, EventArgs e)
 {
     OrderNumber.Text    = null;
     ReturnGV.DataSource = null;
     ReturnGV.DataBind();
     MessageUserControl.ShowInfo("Refund Cancelled.", "Please input the original order number.");
     Subtotal.Text    = 0.00.ToString("C");
     GST.Text         = 0.00.ToString("C");
     Total.Text       = 0.00.ToString("C");
     Invoice.Text     = null;
     ReturnGV.Enabled = true;
 }
    protected void MoveDown_Click(object sender, EventArgs e)
    {
        if (PlayList.Rows.Count == 0)
        {
            //did the user press the up button without fetching a playlist
            MessageUserControl.ShowInfo("Warning", "No playlist has been retreived");
        }
        else
        {
            if (string.IsNullOrEmpty(PlaylistName.Text))
            {
                MessageUserControl.ShowInfo("Warning", "No playlist name exists");
            }
            else
            {
                //check only one row selected
                int      trackid           = 0;
                int      tracknumber       = -1;
                int      rowselected       = 0;
                CheckBox playlistselection = null;
                //traverse the gridview checking each row for a checked box
                for (int i = 0; i < PlayList.Rows.Count; i++)
                {
                    //find the checkbox on the indexed gridview row
                    //playlistselection will point to the checkbox
                    playlistselection = PlayList.Rows[i].FindControl("Selected") as CheckBox;

                    if (playlistselection.Checked)
                    {
                        trackid     = int.Parse((PlayList.Rows[i].FindControl("TrackID") as Label).Text);
                        tracknumber = int.Parse((PlayList.Rows[i].FindControl("TrackNumber") as Label).Text);
                        rowselected++;
                    }
                }

                if (rowselected != 1)
                {
                    MessageUserControl.ShowInfo("Warning", "Select one track to move");
                }
                else
                {
                    if (tracknumber == PlayList.Rows.Count)
                    {
                        MessageUserControl.ShowInfo("Information", "Select track cannot be moved up.");
                    }
                    else
                    {
                        MoveTrack(trackid, tracknumber, "down");
                    }
                }
            }
        }
    }
Ejemplo n.º 14
0
 /// <summary>
 /// Executed when the user clicks on the Force Close button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ForceCloseButton_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(ForceCloseReasonTextBox.Text.Trim()))
     {
         MessageUserControl.ShowInfo("You must specify a reason for closing the order.");
     }
     else
     {
         currentOrderId = (int)ReceivingItemsGridView.DataKeys[0].Value; // gets the order ID from a DataKey
         MessageUserControl.TryRun((ProcessRequest)SubmitForceClose, "Force Close Order", "The Purchase Order was successfully closed.");
     }
 }
Ejemplo n.º 15
0
 protected void InsertCheckForException(object sender,
                                        ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception == null)
     {
         MessageUserControl.ShowInfo("Success", "Product has been added.");
     }
     else
     {
         MessageUserControl.HandleDataBoundException(e);
     }
 }
Ejemplo n.º 16
0
        protected void MoveUp_Click(object sender, EventArgs e)
        {
            //code to go here
            if (PlayList.Rows.Count == 0)
            {
                MessageUserControl.ShowInfo("Track Movement", "You mut have a playlist showing. Fetch your playlist");
            }
            else
            {
                if (String.IsNullOrEmpty(PlaylistName.Text))
                {
                    MessageUserControl.ShowInfo("Track Movement", "You must have a play list name.");
                }
                else
                {
                    //determin eif a single song on the playlist has been selected
                    //collected the trackid, tracknumber
                    int      trackid      = 0;
                    int      tracknumber  = 0;
                    int      rowsSelected = 0;
                    CheckBox songSelected = null; //reference pointer to a control

                    //traverse the song list
                    for (int rowindex = 0; rowindex < PlayList.Rows.Count; rowindex++)
                    {
                        //point to a checkbox on the gridview row
                        songSelected = PlayList.Rows[rowindex].FindControl("Selected") as CheckBox;
                        if (songSelected.Checked)
                        {
                            trackid     = int.Parse((PlayList.Rows[rowindex].FindControl("TrackID") as Label).Text);
                            tracknumber = int.Parse((PlayList.Rows[rowindex].FindControl("TrackNumber") as Label).Text);
                            rowsSelected++;
                        }
                    }
                    if (rowsSelected != 1)
                    {
                        MessageUserControl.ShowInfo("Track Movement", "You must select a single song to move.");
                    }
                    else
                    {
                        if (tracknumber == 1)
                        {
                            MessageUserControl.ShowInfo("Track Movement", "Song is at the top of the list alredy. Mo move nessesary");
                        }
                        else
                        {
                            //move the track
                            MoveTrack(trackid, tracknumber, "up");
                        }
                    }
                }
            }
        }
Ejemplo n.º 17
0
 protected void MoveUp_Click(object sender, EventArgs e)
 {
     //code to go here
     if (string.IsNullOrEmpty(PlaylistName.Text))
     {
         MessageUserControl.ShowInfo("Track Movement", "You must have a play list name.");
     }
     else
     {
         if (PlayList.Rows.Count == 0)
         {
             MessageUserControl.ShowInfo("Track Movement", "You must have a play list showin g.");
         }
         else
         {
             //was anything actually selected?
             CheckBox songSelected = null;
             int      rowsSelected = 0; //count number selected
             int      trackid      = 0; //trackid of the song to move
             int      tracknumber  = 0; //tracknumber of the song to move
             //traverse the song list
             //only 1 song may be selected for movement
             for (int index = 0; index < PlayList.Rows.Count; index++)
             {
                 //point to a checkbox on the gridview row
                 songSelected = PlayList.Rows[index].FindControl("Selected") as CheckBox;
                 //selected??
                 if (songSelected.Checked)
                 {
                     rowsSelected++;
                     trackid     = int.Parse((PlayList.Rows[index].FindControl("TrackId") as Label).Text);
                     tracknumber = int.Parse((PlayList.Rows[index].FindControl("TrackNumber") as Label).Text);
                 }
             }
             if (rowsSelected != 1)
             {
                 MessageUserControl.ShowInfo("Track Movement", "You must select a single song to move.");
             }
             else
             {
                 //is this the top row?
                 if (tracknumber == 1)
                 {
                     MessageUserControl.ShowInfo("Track Movement", "Song is at the top of list already. No move is necessary.");
                 }
                 else
                 {
                     MoveTrack(trackid, tracknumber, "up");
                 }
             }
         }
     }
 }
Ejemplo n.º 18
0
    protected void DeleteOrderLink_Click(object sender, EventArgs e)
    {
        string purchaseOrderIDString = PurchaseOrderDisplay.Text;
        string vendorID = VendorDropdown.Text;



        if (purchaseOrderIDString == "" || purchaseOrderIDString == "0")
        {
            MessageUserControl.ShowInfo("You must have purchase order first");
        }

        else if (vendorID == "")
        {
            MessageUserControl.ShowInfo("You must have a vendor.");
        }

        else if (SuggestedItems.Rows.Count == 0)
        {
            MessageUserControl.ShowInfo("You must have at least one item in order to delete the purchase order.");
        }

        else
        {
            MessageUserControl.TryRun(() =>
            {
                int PurchaseOrderID = int.Parse(purchaseOrderIDString);

                var stockItemID = int.Parse(purchaseOrderIDString);
                var stockItems  = new List <SuggestedOrderItems>();
                foreach (GridViewRow gvr in SuggestedItems.Rows)
                {
                    SuggestedOrderItems item = new SuggestedOrderItems();
                    item.ID = int.Parse(SuggestedItems.Rows[gvr.RowIndex].Cells[0].Text);
                    stockItems.Add(item);
                }
                PurchasingController sysmgr = new PurchasingController();
                sysmgr.DeleteOrder(PurchaseOrderID, stockItems);

                SuggestedItems.DataSource = null;
                SuggestedItems.DataBind();
                NonSuggestedItems.DataBind();
                GetSuggestedOrder.Text = "";
                VendorName.Text        = "";
                VendorPhone.Text       = "";
                UpdateOrderLink.Text   = "";
                RefreshVendorList("0");
                subtotalAmount.Text = "";
                gstAmount.Text      = "";
                totalAmount.Text    = "";
            }, "Purchase Order Deleted", "All purchase order details removed as well from that order");
        }
    }
Ejemplo n.º 19
0
 protected void MoveDown_Click(object sender, EventArgs e)
 {
     //code to go here
     if (PlayList.Rows.Count == 0)
     {
         MessageUserControl.ShowInfo("Warning", "No Playlist has been retrieved");
     }
     else
     {
         if (string.IsNullOrEmpty(PlaylistName.Text))
         {
             MessageUserControl.ShowInfo("Warning", "No Playlist has been supplied");
         }
         else
         {
             //check only one row selected
             int trackid     = 0;
             int tracknumber = 0; //optionally
             int rowselected = 0;
             // create a pointer to use for the access of the gridview control
             CheckBox playlistselection = null;
             //traverse the gridview checking each row for a checked checkbox
             for (int i = 0; i < PlayList.Rows.Count; i++)
             {
                 //find the checkbox on the indexed gridview row
                 //playlist selection will point to the checkbox
                 playlistselection = PlayList.Rows[i].FindControl("Selected") as CheckBox;
                 //if isChecked
                 if (playlistselection.Checked)
                 {
                     trackid = int.Parse((PlayList.Rows[i].FindControl("TrackId") as Label).Text);
                     rowselected++;
                 }
             }//eofFor
             if (rowselected != 1)
             {
                 MessageUserControl.ShowInfo("Warning", "Select on track to move.");
             }
             else
             {
                 if (tracknumber == PlayList.Rows.Count) //is it the top one?
                 {
                     MessageUserControl.ShowInfo("Information", "Track can not be moved. Already bottom of the list");
                 }
                 else
                 {
                     //move the track via your BLL
                     MoveTrack(trackid, tracknumber, "down");
                 }
             }
         }
     }
 }
Ejemplo n.º 20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     TracksSelectionList.DataSource = null;
     if (Request.IsAuthenticated)
     {
         MessageUserControl.ShowInfo("Login successful")
     }
     else
     {
         Response.Redirect("~/Account/Login.aspx");
     }
 }
Ejemplo n.º 21
0
        protected void DeleteTrack_Click(object sender, EventArgs e)
        {
            string username = "******"; //until security is implemented

            //form event validation: presence
            if (string.IsNullOrEmpty(PlaylistName.Text))
            {
                MessageUserControl.ShowInfo("Missing Data", "Enter a playlist name");
            }
            else
            {
                if (PlayList.Rows.Count == 0)
                {
                    MessageUserControl.ShowInfo("Track Removal", "You must have a play list visible to choose removals. Select from the displayed playlist.");
                }
                else
                {
                    //collect the tracks indicated on the playlist for removal
                    List <int> trackids       = new List <int>();
                    int        rowsSelected   = 0;
                    CheckBox   trackSelection = null;
                    //traverse the gridview control PlayList
                    //you could do this same code using a foreah()
                    for (int i = 0; i < PlayList.Rows.Count; i++)
                    {
                        //point to the checkbox control on the gridview row
                        trackSelection = PlayList.Rows[i].FindControl("Selected") as CheckBox;
                        //test the setting of the checkbox
                        if (trackSelection.Checked)
                        {
                            rowsSelected++;
                            trackids.Add(int.Parse((PlayList.Rows[i].FindControl("TrackId") as Label).Text));
                        }
                    }

                    //was a song selected
                    if (rowsSelected == 0)
                    {
                        MessageUserControl.ShowInfo("Missing Data", "You must select at least one song to remove.");
                    }
                    else
                    {
                        //data collected, send for processing
                        MessageUserControl.TryRun(() =>
                        {
                            PlaylistTracksController sysmgr = new PlaylistTracksController();
                            sysmgr.DeleteTracks(username, PlaylistName.Text, trackids);
                            RefreshPlayList(sysmgr, username);
                        }, "Track removal", "Selected track(s) have been removed from the playlist.");
                    }
                }
            }
        }
Ejemplo n.º 22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.IsAuthenticated && User.IsInRole("Clerk") || User.IsInRole("Administrators"))
     {
         MessageUserControl.ShowInfo("", "Login Successful");
     }
     else
     {
         Response.Redirect("~/Account/Login.aspx");
     }
     QueryPanel.Style.Add("display", "none");
 }
Ejemplo n.º 23
0
        protected void DeleteTrack_Click(object sender, EventArgs e)
        {
            //code to go here
            //string username = "******";
            string username = User.Identity.Name;

            //validation of incoming data
            if (string.IsNullOrEmpty(PlaylistName.Text))
            {
                MessageUserControl.ShowInfo("Missing data", "Enter the playlist name");
            }
            else
            {
                if (PlayList.Rows.Count == 0)
                {
                    MessageUserControl.ShowInfo("Missing data", "You need to select from an displayed play list.");
                }
                else
                {
                    //collect all trackids that are to be removed
                    //at least one track must be selected
                    CheckBox   rowSelected = null;
                    List <int> trackids    = new List <int>();

                    for (int i = 0; i < PlayList.Rows.Count; i++)
                    {
                        rowSelected = PlayList.Rows[i].FindControl("Selected") as CheckBox;
                        if (rowSelected.Checked)
                        {
                            trackids.Add(int.Parse((PlayList.Rows[i].FindControl("TrackID") as Label).Text));
                        }
                    }

                    if (trackids.Count == 0)
                    {
                        MessageUserControl.ShowInfo("Remove Tracks", "You must select at least one track to remove");
                    }
                    else
                    {
                        MessageUserControl.TryRun(() => {
                            PlaylistTracksController sysmgr = new PlaylistTracksController();
                            sysmgr.DeleteTracks(username, PlaylistName.Text, trackids);
                            //refresh the playlist
                            List <UserPlaylistTrack> info = sysmgr.List_TracksForPlaylist
                                                                (PlaylistName.Text, username);
                            PlayList.DataSource = info;
                            PlayList.DataBind();
                        }, "Remove Track(s)", "Track has been removed from the playlist");
                    }
                }
            }
        }
Ejemplo n.º 24
0
 protected void MoveDown_Click(object sender, EventArgs e)
 {
     if (PlayList.Rows.Count == 0)
     {
         MessageUserControl.ShowInfo("BAD", "No playlist has been retrieved");
     }
     else
     {
         if (String.IsNullOrEmpty(PlaylistName.Text))
         {
             MessageUserControl.ShowInfo("bad", "no playlist name. gimee");
         }
         else
         {
             //check that one, and only one, row is selected
             int trackid     = -1;
             int tracknumber = -1;
             int rowselect   = 0;
             //create a pointer to use for id-ing the track
             CheckBox selection = null;
             //traverse the gridview checking each row for a selection
             for (int i = 0; i < PlayList.Rows.Count; i++)
             {
                 //find checkbox
                 selection = PlayList.Rows[i].FindControl("Selected") as CheckBox;
                 //is checked?
                 if (selection.Checked)
                 {
                     trackid     = int.Parse((PlayList.Rows[i].FindControl("TrackId") as Label).Text);
                     tracknumber = int.Parse((PlayList.Rows[i].FindControl("TrackNumber") as Label).Text);
                     rowselect++;
                 }
             }
             if (rowselect != 1)
             {
                 MessageUserControl.ShowInfo("Bad", "Please select 1 (ONLY 1) Track to move");
             }
             else
             {
                 //check if on top
                 if (tracknumber == PlayList.Rows.Count)
                 {
                     MessageUserControl.ShowInfo("wait a minute", "This track is already at the bottom of the playlist. Cannot lower track.");
                 }
                 else
                 {
                     MoveTrack(trackid, tracknumber, "down");
                 }
             }
         }
     }
 }
Ejemplo n.º 25
0
 protected void DeleteTrack_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(PlaylistName.Text))
     {
         MessageUserControl.ShowInfo("Required Data", "Playlist name is required to add a track");
     }
     else
     {
         if (PlayList.Rows.Count == 0)
         {
             MessageUserControl.ShowInfo("Required Data", "No playlist is available. Retrieve your playlist.");
         }
         else
         {
             //traverse the gridview and collect the list of tracks to remove
             List <int> trackstodelete    = new List <int>();
             int        rowsSelected      = 0;
             CheckBox   playlistselection = null;
             for (int rowindex = 0; rowindex < PlayList.Rows.Count; rowindex++)
             {
                 //access the checkbox control on the indexed GridViewRow
                 //set the CheckBox pointer to this checkbox control
                 playlistselection = PlayList.Rows[rowindex].FindControl("Selected") as CheckBox;
                 if (playlistselection.Checked)
                 {
                     //increase selected number of rows
                     rowsSelected++;
                     //gather the data needed for the BLL call
                     trackstodelete.Add(int.Parse((PlayList.Rows[rowindex].FindControl("TrackID") as Label).Text));
                 }
             }
             if (rowsSelected == 0)
             {
                 MessageUserControl.ShowInfo("Required Data", "You must select at least one track to remove");
             }
             else
             {
                 //send list of tracks to be removed by BLL
                 MessageUserControl.TryRun(() =>
                 {
                     PlaylistTracksController sysmgr = new PlaylistTracksController();
                     //there is ONLY one call to add the data to the database
                     sysmgr.DeleteTracks(User.Identity.Name, PlaylistName.Text, trackstodelete);
                     //refresh the playlist is a READ
                     List <UserPlaylistTrack> datainfo = sysmgr.List_TracksForPlaylist(PlaylistName.Text, User.Identity.Name);
                     PlayList.DataSource = datainfo;
                     PlayList.DataBind();
                 }, "Remove Track", "Track has been removed from the playlist");
             }
         }
     }
 }
        protected void MoveDown_Click(object sender, EventArgs e)
        {
            if (PlayList.Rows.Count == 0)
            {
                MessageUserControl.ShowInfo("Moving Tracks",
                                            "You must have a playlist showing. List either empty or you need to fetch your playlist.");
            }
            else
            {
                if (string.IsNullOrEmpty(PlaylistName.Text))
                {
                    MessageUserControl.ShowInfo("Missing Data",
                                                "You need a playlist name.");
                }
                else
                {
                    //validation about the move
                    //only a single song selected
                    //not the last item on the list
                    int      trackid           = 0;
                    int      tracknumber       = 0;
                    int      rowselected       = 0;
                    CheckBox playlistselection = null;
                    for (int rowindex = 0; rowindex < PlayList.Rows.Count; rowindex++)
                    {
                        playlistselection = PlayList.Rows[rowindex].FindControl("Selected") as CheckBox;
                        if (playlistselection.Checked)
                        {
                            rowselected++;
                            trackid     = int.Parse((PlayList.Rows[rowindex].FindControl("TrackID") as Label).Text);
                            tracknumber = int.Parse((PlayList.Rows[rowindex].FindControl("TrackNumber") as Label).Text);
                        }
                    }

                    if (rowselected != 1)
                    {
                        MessageUserControl.ShowInfo("Warning", "Select one track to be moved");
                    }
                    else
                    {
                        if (tracknumber == PlayList.Rows.Count)
                        {
                            MessageUserControl.ShowInfo("Warning", "Track cannot be moved down");
                        }
                        else
                        {
                            MoveTrack(trackid, tracknumber, "down");
                        }
                    }
                }
            }
        }
        protected void DeleteTrack_Click(object sender, EventArgs e)
        {
            string username = "******";

            if (string.IsNullOrEmpty(PlaylistName.Text))
            {
                MessageUserControl.ShowInfo("Missing Data", "Enter a Playlist name");
            }
            else
            {
                if (PlayList.Rows.Count == 0)
                {
                    MessageUserControl.ShowInfo("Missing Data", "Playlist has no tracks to delete.");
                }
                else
                {
                    //gathering data
                    List <int> trackstodelete    = new List <int>();
                    int        rowsSelected      = 0;
                    CheckBox   playlistSelection = null;

                    //loop through entire rows that currently exist.
                    for (int i = 0; i < PlayList.Rows.Count; i++)
                    {
                        playlistSelection = PlayList.Rows[i].FindControl("Selected") as CheckBox;
                        if (playlistSelection.Checked)
                        {
                            rowsSelected++;
                            trackstodelete.Add(int.Parse((PlayList.Rows[i].FindControl("TrackID") as Label).Text));
                        }
                    }

                    //was at least one row selected ?
                    if (rowsSelected == 0)
                    {
                        MessageUserControl.ShowInfo("Missing data", "You must select at least one track to remove.");
                    }
                    else
                    {
                        //process delete
                        MessageUserControl.TryRun(() =>
                        {
                            PlaylistTracksController sysmgr = new PlaylistTracksController();
                            sysmgr.DeleteTracks(username, PlaylistName.Text, trackstodelete);
                            List <UserPlaylistTrack> info = sysmgr.List_TracksForPlaylist(PlaylistName.Text, username);
                            PlayList.DataSource           = info;
                            PlayList.DataBind();
                        }, "Remove Tracks", "Tracks successfully removed.");
                    }
                }
            }
        }
Ejemplo n.º 28
0
        protected void LookupBtn_Click(object sender, EventArgs e)
        {
            int orderNumber;

            bool isNumeric = int.TryParse(OrderNumber.Text, out orderNumber);


            if (isNumeric.Equals(false))
            {
                MessageUserControl.ShowInfo("Error", "Order Number is a numeric only field.");
            }
            else
            {
                if (string.IsNullOrEmpty(OrderNumber.Text))
                {
                    MessageUserControl.ShowInfo("Error", "Please input the original order number.");
                }
                else
                {
                    int orderID    = int.Parse(OrderNumber.Text);
                    var controller = new SalesController();
                    var refundList = controller.RefundbyOrderNumber(orderID);

                    if (refundList.Count == 0)
                    {
                        MessageUserControl.ShowInfo("No Results Found", "Order Number does not exist.");
                    }
                    else
                    {
                        ReturnGV.DataSource = refundList;
                        ReturnGV.DataBind();

                        foreach (GridViewRow row in ReturnGV.Rows)
                        {
                            HiddenField isRefund    = row.FindControl("IsRefundable") as HiddenField;
                            CheckBox    restock     = row.FindControl("RestockSelect") as CheckBox;
                            CheckBox    reasonCheck = row.FindControl("ReasonSelect") as CheckBox;
                            TextBox     reasonTB    = row.FindControl("Reason") as TextBox;


                            if (isRefund.Value == "False")
                            {
                                restock.Visible     = false;
                                reasonCheck.Visible = false;
                                reasonTB.Visible    = false;
                            }
                        }
                        ReturnGV.Enabled = true;
                    }
                }
            }
        }
Ejemplo n.º 29
0
        protected void TrackListLV_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            string           msg       = null;
            ListViewDataItem alrow     = e.Item as ListViewDataItem;
            string           albumName = (alrow.FindControl("Name") as Label).Text;                    //first column BoundField
            int     milliseconds       = int.Parse((alrow.FindControl("Milliseconds") as Label).Text); //second column BoundField
            int     size  = int.Parse((alrow.FindControl("Bytes") as Label).Text);                     //third column Template Label
            decimal price = decimal.Parse((alrow.FindControl("UnitPrice") as TextBox).Text);           //third column Template TextBox

            msg = "ListView Name is: " + albumName + " M/S is: " + milliseconds.ToString() +
                  " Size is: " + size.ToString() + " Price is: " + price.ToString();
            MessageUserControl.ShowInfo(msg);
        }
Ejemplo n.º 30
0
        protected void TrackListGV_SelectedIndexChanged(object sender, EventArgs e)
        {
            string      msg          = null;
            GridViewRow agrow        = TrackListGV.Rows[TrackListGV.SelectedIndex];
            string      albumName    = agrow.Cells[0].Text;                                             //first column BoundField
            int         milliseconds = int.Parse(agrow.Cells[1].Text);                                  //second column BoundField
            int         size         = int.Parse((agrow.FindControl("Bytes") as Label).Text);           //third column Template Label
            decimal     price        = decimal.Parse((agrow.FindControl("UnitPrice") as TextBox).Text); //third column Template TextBox

            msg = "GridView Name is: " + albumName + " M/S is: " + milliseconds.ToString() +
                  " Size is: " + size.ToString() + " Price is: " + price.ToString();
            MessageUserControl.ShowInfo(msg);
        }