Exemplo n.º 1
0
        protected void lnkOk1_Click(object sender, EventArgs e)
        {
            AdministrationEDSC.SuburbDTRow dr = new AdministrationEDSC.SuburbDTDataTable().NewSuburbDTRow();
            dr = GetData();
            if (ddlCouncil.SelectedValue == "0")
            {
                lblerror.Visible = true;
            }
            else
            {
                string userName = SystemConstants.DevUser;
                //Membership.GetUser().UserName;

                AdministrationDAC dac = new AdministrationDAC();

                if (Mode == SystemConstants.FormMode.New)
                {
                    dac.CreateSuburb(userName, dr);
                }
                else if (Mode == SystemConstants.FormMode.Edit)
                {
                    dac.UpdateSuburb(userName, dr);
                }
                Mode = SystemConstants.FormMode.View;
            }
        }
Exemplo n.º 2
0
        protected void lnkDelete_Click(object sender, EventArgs e)
        {
            AdministrationDAC dac = new AdministrationDAC();

            AdministrationEDSC.SuburbDTDataTable dt = GetSelected();
            foreach (AdministrationEDSC.SuburbDTRow dr in dt)
            {
                dac.DeleteSuburb(dr.ID);
            }
            Refresh();
        }
Exemplo n.º 3
0
        public AdministrationEDSC.SuburbDTRow GetData()
        {
            AdministrationEDSC.SuburbDTRow dr = new AdministrationEDSC.SuburbDTDataTable().NewSuburbDTRow();

            if (!string.IsNullOrEmpty(hdnSuburbID.Value))
            {
                dr.ID = Convert.ToInt32(hdnSuburbID.Value);
            }
            dr.Name      = txtAddEditName.Text;
            dr.PostCode  = Convert.ToInt32(txtPostcode.Text);
            dr.CouncilID = Convert.ToInt32(ddlCouncil.SelectedValue);

            return(dr);
        }
Exemplo n.º 4
0
 private AdministrationEDSC.SuburbDTDataTable GetSelected()
 {
     AdministrationEDSC.SuburbDTDataTable dt = new AdministrationEDSC.SuburbDTDataTable();
     foreach (GridViewRow row in GridView1.Rows)
     {
         if (row.RowType == DataControlRowType.DataRow)
         {
             CheckBox    CheckBox1 = row.FindControl("chkboxSelected") as CheckBox;
             HiddenField hdnID     = row.FindControl("hdnID") as HiddenField;
             var         dr        = dt.NewSuburbDTRow();
             if (CheckBox1.Checked)
             {
                 dr.ID = Convert.ToInt32(hdnID.Value);
                 dt.AddSuburbDTRow(dr);
             }
         }
     }
     return(dt);
 }