protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Session["UserName"] == null)
                {
                    Response.Redirect("index.aspx");
                }
                else
                {
                    UserName = Session["UserName"].ToString();
                }

                lblGreet.Text = "Hello " + UserName;
                SearchFile srch = new SearchFile();
                GridView1.DataSource = srch.SearchByUser(UserName);
                GridView1.DataBind();

                UploadDocument up = new UploadDocument();
                DataTable      dt = up.RetrieveSpace(lblGreet.Text.Substring(6));
                lblSpaceAllocated.Text = "Space Allocated : " + dt.Rows[0]["SpaceAllocated"].ToString();
                lblSpaceUsed.Text      = "Space Used : " + dt.Rows[0]["SpaceUsed"].ToString();
            }
            catch (Exception ex)
            {
                Response.Redirect("index.aspx");
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    if (Session["UserName"] == null)
                    {
                        Response.Redirect("index.aspx");
                    }
                    else
                    {
                        UserName = Session["UserName"].ToString();
                    }

                    lblGreet.Text = "Hello " + UserName;
                }
                catch (Exception ex)
                {
                    Response.Redirect("index.aspx");
                }
            }
            else
            {
                //string Name =(string)DistCache.Get("Name");
            }

            UploadDocument up = new UploadDocument();
            DataTable      dt = up.RetrieveSpace(lblGreet.Text.Substring(6));

            lblSpaceAllocated.Text = "Space Allocated : " + dt.Rows[0]["SpaceAllocated"].ToString();
            lblSpaceUsed.Text      = "Space Used : " + dt.Rows[0]["SpaceUsed"].ToString();
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Session["UserName"] == null)
                {
                    var     accessToken = Session["AccessToken"].ToString();
                    var     client      = new FacebookClient(accessToken);
                    dynamic result      = client.Get("me", new { fields = "name" });
                    UserName = result.name;
                }
                else
                {
                    UserName = Session["UserName"].ToString();
                }

                lblGreet.Text = "Hello " + UserName;

                UploadDocument up = new UploadDocument();
                DataTable      dt = up.RetrieveSpace(lblGreet.Text.Substring(6));
                lblSpaceAllocated.Text = "Space Allocated : " + dt.Rows[0]["SpaceAllocated"].ToString();
                lblSpaceUsed.Text      = "Space Used : " + dt.Rows[0]["SpaceUsed"].ToString();
            }
            catch (Exception ex)
            {
                Response.Redirect("index.aspx");
            }
        }
Beispiel #4
0
        protected void btnUploadFile_Click(object sender, EventArgs e)
        {
            try
            {
                //DistCache.Add("FileUp", FileUp.PostedFile.FileName);
                string ActualFileName = FileUp.PostedFile.FileName;
                string ext            = ActualFileName.Substring(ActualFileName.LastIndexOf('.'));
                Filename = txtFileName.Text + ext;
                FileDesc = txtDesc.Text;
                if (rdoAccess.Items[0].Selected)
                {
                    FileAccess = "Private";
                }
                else
                {
                    FileAccess = "Public";
                }
                FileData = FileUp.FileBytes;
                FileSize = FileUp.PostedFile.ContentLength.ToString();
                UploadDocument ws = new UploadDocument();
                ws.Upload(lblGreet.Text.Substring(6), Filename, FileAccess, FileData, FileSize, FileDesc);
                ws.UpdateSpace(lblGreet.Text.Substring(6), FileSize);
                txtFileName.Text = string.Empty;
                txtDesc.Text     = string.Empty;
                FileUp.Attributes.Clear();
                rdoAccess.Items[1].Selected = true;
                lblMessage.Text             = "File Upload Successful !!!";
                lblMessage.Visible          = true;

                UploadDocument up = new UploadDocument();
                DataTable      dt = up.RetrieveSpace(lblGreet.Text.Substring(6));
                lblSpaceAllocated.Text = "Space Allocated : " + dt.Rows[0]["SpaceAllocated"].ToString();
                lblSpaceUsed.Text      = "Space Used : " + dt.Rows[0]["SpaceUsed"].ToString();
            }
            catch (Exception ex)
            {
                lblMessage.Text      = "FileName Already Exists !!!";
                lblMessage.ForeColor = System.Drawing.Color.Red;
                lblMessage.Visible   = true;
            }
        }