示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["adminid"] != null)
            {
                if (Session["ProjectIDForEdit"] != null)
                {
                    if (!IsPostBack)
                    {
                        int id = Session["ProjectIDForEdit"].ToString().ToInt();

                        ProjectsRepository repArt = new ProjectsRepository();
                        GroupsRepository   repo   = new GroupsRepository();
                        Project            art    = repArt.FindeProjectByID(id);
                        title.Text    = art.Title;
                        Abstract.Text = art.Abstract;
                        editor1.Text  = art.Content;
                        KeyWords.Text = art.KeyWords;
                        Tags.Text     = art.Tags;
                        SelectedSubGroups.DataSource     = repo.FindSubGroupsOfAProject(id);
                        SelectedSubGroups.DataTextField  = "Title";
                        SelectedSubGroups.DataValueField = "GroupID";
                        SelectedSubGroups.DataBind();
                        for (int i = 0; i < SelectedSubGroups.Items.Count; i++)
                        {
                            if (SelectedSubGroups.Items[i].Value == "-1")
                            {
                                SelectedSubGroups.Items[i].Text = "گروه : " + SelectedSubGroups.Items[i].Text;
                            }
                        }

                        DDLGroups2.DataSource     = repo.LoadAllGroups();
                        DDLGroups2.DataTextField  = "Title";
                        DDLGroups2.DataValueField = "GroupID";
                        DDLGroups2.DataBind();
                        DDLGroups2.Items.Insert(0, new ListItem("یک گروه انتخاب کنید", "-2"));
                        oldPhoto.ImageUrl = art.ImgFisrtPage;
                    }
                }
                else
                {
                    Response.Redirect("/Admin/ManageProjects");
                }
            }
            else
            {
                Response.Redirect("/AdminLogin");
            }
        }