protected void btnSave_Click(object sender, EventArgs e)
 {
     termscondition terms = new termscondition(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
     terms.termscondition_TERMS = txteditterms.Text;
     terms.termscondition_SRNO = -1;
     terms.termscondition_TERMSVALUE = -1;
     if (txteditdescription.Text.Trim().ToString() != string.Empty)
     {
         terms.termscondition_DESCRIPTION = txteditdescription.Text;
     }
     terms.termscondition_STATUS = General.Parse<int>(ddlstatus.SelectedValue.ToString().Trim().ToString());
     string condition = "SRNO=" + ViewState["termid"].ToString();
     if (terms.Insert(false, "termscondition", condition))
     {
         Response.Redirect("termsconditions.aspx?id=1");
     }
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtterms.Text.Trim().ToString() != string.Empty)
        {
            termscondition terms = new termscondition(HttpContext.Current.Server.MapPath("~/XML/database.xml"));

            string sql = "select TERMSVALUE from termscondition  where CATEGORY = '" + ddlcategory.SelectedItem.Text.Trim().ToString() + "'";
            DataTable dtterms = hd.GetTable(sql);
            int tvalue = 0;
            if (dtterms.Rows.Count > 0)
            {
                tvalue = General.Parse<int>(dtterms.Rows[0][0].ToString().Trim());
            }
            else
            {
                tvalue = 1;
            }
            terms.termscondition_SRNO = -1;
            terms.termscondition_CATEGORY = ddlcategory.SelectedItem.Text.Trim();
            if (ddlsubcategory.SelectedIndex > 0)
            {
                terms.termscondition_SUBCATEGORY = ddlsubcategory.SelectedItem.Text.Trim();
            }
            terms.termscondition_TERMS = txtterms.Text;
            terms.termscondition_TERMSVALUE = tvalue + 1;
            if (txtdesc.Text.Trim().ToString() != string.Empty)
            {
                terms.termscondition_DESCRIPTION = txtdesc.Text;
            }
            terms.termscondition_STATUS = 0;
            if (terms.Insert(true, "termscondition"))
            {
                gettermscondition();
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "msgdsa", "showdiv();", true);
        }
    }