protected void btnSave_Click(object sender, EventArgs e) { int id = 0; if (ViewState["ID"] != null) { id = Convert.ToInt32(ViewState["ID"]); } _invoice = new Vendor.BO.Invoice().GetData(id); try { RefreshObject(); _invoice.Status = "Entry"; _invoice.Save(); _message.Text = "Data Saved Successfully"; _message.CssClass = "MessageSuccess"; if (id > 0) { Response.Redirect("InvoiceList.aspx"); } else { _invoice = new Vendor.BO.Invoice(); 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 = "Invoice Detail"; if (!IsPostBack) { int id = 0; if (Page.Request.QueryString["ID"] != null) { id = Convert.ToInt32(Page.Request.QueryString["ID"]); } ViewState["ID"] = id; _invoice = new Vendor.BO.Invoice().GetData(id); RefreshControl(); } }