Exemplo n.º 1
0
 public string GetImageUrl(object imageId)
 {
     if (imageId != null)
     {
         var id = Convert.ToInt32(imageId.ToString());
         using (var helper = new DbHelper.WorkingWithFiles())
         {
             return(helper.GetImageUrl(id));
         }
     }
     return("");
 }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var user = Page.User as CustomPrincipal;

            if (user != null)
            {
                lblConfirmCheck.Visible      = false;
                lblPasswordError.Visible     = false;
                lblQuestionSaveError.Visible = false;
                lblQuestionError.Visible     = false;
                if (!IsPostBack)
                {
                    txtearlierPswrd1.Text = "";
                    using (var helper = new DbHelper.User())
                        using (var file = new DbHelper.WorkingWithFiles())
                        {
                            var usr = helper.GetUser(user.Id);
                            if (usr != null)
                            {
                                if (SiteMap.CurrentNode != null)
                                {
                                    var list = new List <IdAndName>()
                                    {
                                        new IdAndName()
                                        {
                                            Name    = SiteMap.RootNode.Title
                                            , Value = SiteMap.RootNode.Url
                                            , Void  = true
                                        },
                                        new IdAndName()
                                        {
                                            Name = SiteMap.CurrentNode.Title
                                                   //,Value = SiteMap.CurrentNode.ParentNode.Url
                                                   //,Void=true
                                        }
                                    };
                                    SiteMapUc.SetData(list);
                                }
                                lblName.Text     = usr.FullName;
                                lblEmail.Text    = string.IsNullOrEmpty(usr.Email)? "  -  ":usr.Email;
                                lblUsername.Text = usr.UserName;

                                img.ImageUrl           = file.GetImageUrl(usr.UserImageId ?? 0);
                                ddlQuestion.DataSource = DbHelper.StaticValues.SecurityQuestion();
                                ddlQuestion.DataBind();


                                try
                                {
                                    var progBatch = usr.Student.FirstOrDefault().StudentBatch.FirstOrDefault().ProgramBatch;
                                    //batch.ProgramBatch.NameFromBatch;
                                    phProfileInfo.Controls.Add(new Literal()
                                    {
                                        Text = "<tr><td class='data-type'>"
                                               + "Batch" + "</td><td class='data-value'>" + progBatch.Batch.Name
                                               + "</td></tr>"
                                    });
                                    phProfileInfo.Controls.Add(new Literal()
                                    {
                                        Text = "<tr><td class='data-type'>"
                                               + "Program" + "</td><td  class='data-value'>" + progBatch.Program.Name
                                               + "</td></tr>"
                                    });
                                    phProfileInfo.Visible = true;
                                }
                                catch {}
                            }
                        }
                    SetView();
                }
            }
        }