protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString[SystemConstants.StateID] != null) { int stateID = Convert.ToInt32(Request.QueryString[SystemConstants.StateID]); var dac = new AdministrationDAC(); AdministrationEDSC.StateDTRow dr = null; if (stateID != 0) { dr = dac.RetrieveState(stateID); StateSetupUC1.Mode = SystemConstants.FormMode.Edit; StateSetupUC1.SetData(dr); } else { dr = new AdministrationEDSC.StateDTDataTable().NewStateDTRow(); StateSetupUC1.Mode = SystemConstants.FormMode.New; } } CheckSignIn(); } }
protected void lnkDelete_Click(object sender, EventArgs e) { AdministrationDAC dac = new AdministrationDAC(); AdministrationEDSC.StateDTDataTable dt = GetSelected(); foreach (AdministrationEDSC.StateDTRow dr in dt) { dac.DeleteState(dr.ID); } Refresh(); }
public AdministrationEDSC.StateDTRow GetData() { AdministrationEDSC.StateDTRow dr = new AdministrationEDSC.StateDTDataTable().NewStateDTRow(); if (!string.IsNullOrEmpty(hdnStateID.Value)) { dr.ID = Convert.ToInt32(hdnStateID.Value); } dr.StateName = txtAddEditName.Text; dr.StateDetail = txtFullName.Text; return(dr); }
private AdministrationEDSC.StateDTDataTable GetSelected() { AdministrationEDSC.StateDTDataTable dt = new AdministrationEDSC.StateDTDataTable(); 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.NewStateDTRow(); if (CheckBox1.Checked) { dr.ID = Convert.ToInt32(hdnID.Value); dt.AddStateDTRow(dr); } } } return(dt); }
protected void lnkOk1_Click(object sender, EventArgs e) { AdministrationEDSC.StateDTRow dr = new AdministrationEDSC.StateDTDataTable().NewStateDTRow(); dr = GetData(); string userName = SystemConstants.DevUser; //Membership.GetUser().UserName; AdministrationDAC dac = new AdministrationDAC(); if (Mode == SystemConstants.FormMode.New) { dac.CreateState(userName, dr); } else if (Mode == SystemConstants.FormMode.Edit) { dac.UpdateState(userName, dr); } Mode = SystemConstants.FormMode.View; SetData(dr); }