Example #1
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });
                string name = txtName.Text.Trim();

                if (string.IsNullOrEmpty(name))
                {
                    return;
                }

                Container.Create(Request.Cookies[SiteHelper.ACCOUNT].Value,
                                 Request.Cookies[SiteHelper.KEY].Value,
                                 name,
                                 chkPublic.Checked);

                lblMessage.Text = string.Format("Container '{0}' has been created.", name);
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
            finally
            {
                ReloadContainers();
            }
        }
Example #2
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                string name = txtName.Text.Trim();
                UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });

                if (string.IsNullOrEmpty(name))
                {
                    return;
                }

                StorageHelper.Queue.Create(Request.Cookies[SiteHelper.ACCOUNT].Value, Request.Cookies[SiteHelper.KEY].Value, name);
                lblMessage.Text = $"Queue '{name}' has been created.";
                txtName.Text    = string.Empty;
            }
            catch (StorageException sex)
            {
                lblError.Text = sex.RequestInformation.HttpStatusMessage;
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
            finally
            {
                ReloadQueues();
            }
        }
        protected void btnExecute_Click(object sender, EventArgs e)
        {
            try
            {
                UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });

                grdEntities.DataSource = null;
                grdEntities.DataBind();

                //IEnumerable<TableEntity> list = StorageHelper.Table.Query(Request.Cookies[SiteHelper.ACCOUNT].Value,
                //                                        Request.Cookies[SiteHelper.KEY].Value,
                //                                        Request.Params["table"],
                //                                        txtQuery.Text);

                //grdEntities.RowDataBound += new GridViewRowEventHandler(grdEntities_RowDataBound);

                DSEntities ds = TableHelper.Query(Request.Cookies[SiteHelper.ACCOUNT].Value,
                                                  Request.Cookies[SiteHelper.KEY].Value,
                                                  Request.Params["table"],
                                                  txtQuery.Text);

                //grdEntities.DataSource = list;
                grdEntities.DataSource = ds;
                grdEntities.DataMember = "TableEntity";
                grdEntities.DataBind();
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
        protected void grdEntities_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });

                if (e.CommandName == "DeleteEntity")
                {
                    int    index        = int.Parse(e.CommandArgument.ToString());
                    string partitionKey = grdEntities.DataKeys[index][0].ToString();
                    string rowKey       = grdEntities.DataKeys[index][1].ToString();

                    StorageHelper.Table.DeleteEntity(Request.Cookies[SiteHelper.ACCOUNT].Value,
                                                     Request.Cookies[SiteHelper.KEY].Value,
                                                     Request.Params["table"],
                                                     partitionKey,
                                                     rowKey);

                    lblMessage.Text = "Entity deleted";

                    grdEntities.DataSource = null;
                    grdEntities.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            try
            {
                UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });

                if (FileUpload.HasFile)
                {
                    string container = Request.QueryString["container"];
                    Container.CreateBlob(Request.Cookies[SiteHelper.ACCOUNT].Value,
                                         Request.Cookies[SiteHelper.KEY].Value,
                                         container,
                                         FileUpload.FileName,
                                         FileUpload.FileContent);

                    grdBlobs.DataBind();
                }
            }
            catch (StorageException sex)
            {
                lblError.Text = sex.RequestInformation.HttpStatusMessage;
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
 public void ItemCommand(object source, DataListCommandEventArgs args)
 {
     try
     {
         UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });
         if (args.CommandName == "TableClick")
         {
             Response.Redirect("Default.aspx?type=table&table=" + args.CommandArgument.ToString());
         }
         else if (args.CommandName == "DeleteTable")
         {
             DeleteTable(args.CommandArgument.ToString());
         }
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
        protected void btnMessage_Click(object sender, EventArgs e)
        {
            try
            {
                UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });

                Queue.CreateMessage(Request.Cookies[SiteHelper.ACCOUNT].Value,
                                    Request.Cookies[SiteHelper.KEY].Value,
                                    Request.QueryString["queue"],
                                    txtMessage.Text);
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
            finally
            {
                grdMessages.DataBind();
            }
        }
Example #8
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });

                if (e.CommandName == "DeleteBlob")
                {
                    DeleteBlob(grdBlobs.DataKeys[int.Parse(e.CommandArgument.ToString())].Value.ToString());
                }
                else if (e.CommandName == "DownloadBlob")
                {
                    string blobUrl  = grdBlobs.DataKeys[int.Parse(e.CommandArgument.ToString())].Value.ToString();
                    string fileName = blobUrl.Substring(blobUrl.LastIndexOf("/") + 1);
                    DownloadBlob(blobUrl, fileName);
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            try
            {
                UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });

                StorageHelper.Table.Insert(Request.Cookies[SiteHelper.ACCOUNT].Value,
                                           Request.Cookies[SiteHelper.KEY].Value,
                                           Request.Params["table"],
                                           txtQuery.Text);

                lblMessage.Text = "Entity saved";
                txtQuery.Text   = string.Empty;

                grdEntities.DataSource = null;
                grdEntities.DataBind();
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
        protected void btnExecute_Click(object sender, EventArgs e)
        {
            try
            {
                UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });

                grdEntities.DataSource = null;
                grdEntities.DataBind();

                DSEntities ds = TableHelper.Query(Request.Cookies[SiteHelper.ACCOUNT].Value,
                                                  Request.Cookies[SiteHelper.KEY].Value,
                                                  Request.Params["table"],
                                                  txtQuery.Text);

                grdEntities.DataSource = ds;
                grdEntities.DataMember = "TableEntity";
                grdEntities.DataBind();
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
        protected void grdMessages_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                UCHelper.CleanUpLabels(new Label[] { lblMessage, lblError });

                if (e.CommandName == "DeleteMessage")
                {
                    int index = int.Parse(e.CommandArgument.ToString());
                    MessageHelper.Delete(Request.Cookies[SiteHelper.ACCOUNT].Value,
                                         Request.Cookies[SiteHelper.KEY].Value,
                                         Request.QueryString["queue"],
                                         grdMessages.DataKeys[index].Value.ToString());
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
            finally
            {
                grdMessages.DataBind();
            }
        }