コード例 #1
0
 protected void uiLinkButtonCancel_Click(object sender, EventArgs e)
 {
     uiPanelViewAllPages.Visible = true;
     uiPanelEdit.Visible = false;
     Clearfields();
     CurrentPerson = null;
 }
コード例 #2
0
 protected void uiGridViewPersons_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditPerson")
     {
         YMC.BLL.Persons objData = new YMC.BLL.Persons();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         CurrentPerson = objData;
         uiTextBoxArTitle.Text = objData.Name;
         uiTextBoxDetails.Text = objData.Details;
         uiImage.ImageUrl = objData.PersonImage;
         uiPanelViewAllPages.Visible = false;
         uiPanelEdit.Visible = true;
     }
     else if (e.CommandName == "DeletePerson")
     {
         YMC.BLL.Persons objData = new YMC.BLL.Persons();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         BindData();
     }
 }
コード例 #3
0
        private void BindData()
        {
            YMC.BLL.Persons persons = new YMC.BLL.Persons ();
            persons.LoadAll();
            persons.Filter = "IsNationalCommitte <> 1 Or IsNationalCommitte is Null";
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = persons.DefaultView;
            pds.AllowPaging = true;
            pds.PageSize = 10;
            pds.CurrentPageIndex = currentPage;
            uiDataListPersons.DataSource = pds;
            uiDataListPersons.DataBind();
            uiLinkButtonPrev.Enabled = true;
            uiLinkButtonNext.Enabled = true;
            if (currentPage == 0)
            {
                uiLinkButtonPrev.Enabled = false;
            }

            if (currentPage == (pds.PageCount - 1))
            {
                uiLinkButtonNext.Enabled = false;
            }
        }
コード例 #4
0
 protected void uiLinkButtonUpdate_Click(object sender, EventArgs e)
 {
     YMC.BLL.Persons objData = new YMC.BLL.Persons();
     if (CurrentPerson != null)
         objData = CurrentPerson;
     else
     {
         objData.AddNew();
     }
     objData.Name = uiTextBoxArTitle.Text;
     objData.Details = uiTextBoxDetails.Text;
     if (uiFileUploadImage.HasFile)
     {
         uiFileUploadImage.SaveAs(Server.MapPath("~/Userfiles/PersonsImages/") + uiFileUploadImage.FileName);
         objData.PersonImage = "/Userfiles/PersonsImages/" + uiFileUploadImage.FileName;
     }
     objData.Save();
     CurrentPerson = null;
     uiPanelViewAllPages.Visible = true;
     uiPanelEdit.Visible = false;
     BindData();
 }
コード例 #5
0
 private void BindData()
 {
     YMC.BLL.Persons objData = new YMC.BLL.Persons();
     objData.LoadAll();
     objData.Filter = "IsNationalCommitte <> 1 Or IsNationalCommitte is Null";
     uiGridViewPersons.DataSource = objData.DefaultView;
     uiGridViewPersons.DataBind();
 }