private void DataExtract(MPOP_Dashboard.Contestant contestant) { contestant.ContestantID = hfContestantID.Value; contestant.Name = txtContestantName.Text.Trim(); contestant.CreatedData = null; contestant.CreatedBy = Session["username"].ToString(); contestant.UpdatedDate = null; contestant.UpdatedBy = Session["username"].ToString(); contestant.VoteCount = int.Parse(txtVoteCount.Text); contestant.Remark = txtRemark.Text; contestant.ContestantNo = txtContestantNo.Text; if (btnSave.Text == "Save") { contestant.Flag = (int)MPOP_Dashboard_Enum.StoredProcedureType.Insert; } else if (btnSave.Text == "Update") { contestant.Flag = (int)MPOP_Dashboard_Enum.StoredProcedureType.Update; } else if (btnSave.Text == "Delete") { contestant.Flag = (int)MPOP_Dashboard_Enum.StoredProcedureType.Delete; } }
protected void btnSave_Click(object sender, EventArgs e) { MPOP_Dashboard.MPOP_Dashoard_Class mpop_dashboard_class = new MPOP_Dashoard_Class(); MPOP_Dashboard.Contestant contestant = new MPOP_Dashboard.Contestant(); DataExtract(contestant); db.sp_MPOP_Dashboard_Contestant_CRUD( contestant.ContestantID, contestant.Name, contestant.CreatedData, contestant.CreatedBy, contestant.UpdatedDate, contestant.UpdatedBy, contestant.VoteCount, contestant.Remark, contestant.ContestantNo, contestant.Flag ); Response.Redirect("Contestant_List.aspx?"); }