protected void btnSave_Click(object sender, EventArgs e) { int id = 0; if (ViewState["ID"] != null) { id = Convert.ToInt32(ViewState["ID"]); } _holiday = new Vendor.BO.Holiday().GetData(id); try { RefreshObject(); _holiday.Save(); _message.Text = "Data Saved Successfully"; _message.CssClass = "MessageSuccess"; if (id > 0) { Response.Redirect("HolidayList.aspx"); } else { _holiday = new Vendor.BO.Holiday(); RefreshControl(); } } catch (Exception exp) { _message.Text = exp.Message; _message.CssClass = "MessageError"; } }
protected void Page_Load(object sender, EventArgs e) { _message = (Label)Master.FindControl("lblMessage"); Label header = (Label)Master.FindControl("lblHeader"); header.Text = "Holiday Detail"; if (!IsPostBack) { int id = 0; if (Page.Request.QueryString["ID"] != null) { id = Convert.ToInt32(Page.Request.QueryString["ID"]); } ViewState["ID"] = id; _holiday = new Vendor.BO.Holiday().GetData(id); RefreshControl(); } }
public static List <Holiday> GetAllData() { List <Holiday> items = Holiday.GetAllData("ID", "0123"); return(items); }