protected void btnaddrecord_Click(object sender, EventArgs e)
 {
    reportingmaster obj = new reportingmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
     obj.reportingmaster_SRNO = -1;
     obj.reportingmaster_NAME = txtprospect.Text.Trim();
     obj.reportingmaster_CONTACTNO = txtcontactno.Text.Trim();
     obj.reportingmaster_ACTIVITY = txtactivity.Text.Trim();
     obj.reportingmaster_RESULT = txtresult.Text.Trim();
     obj.reportingmaster_REMARK = txtremark.Text.Trim();
     obj.reportingmaster_RELATIONSHIPID = -1;
     obj.reportingmaster_STATUS = -1;
     string condition = "SRNO=" + ViewState["srno"].ToString();
     if (obj.Insert(false, "reportingmaster", condition))
     {
         DataTable dtcontract = FillMemberList(txtfromdate.Text.Trim(), txttodate.Text.Trim(), txtname.Text.Trim());
         ViewState["list"] = dtcontract;
         if (dtcontract.Rows.Count > 0)
         {
             gvmemberlist.DataSource = (DataTable)ViewState["list"];
             gvmemberlist.DataBind();
         }
         else
         {
             gvmemberlist.DataSource = null;
             gvmemberlist.DataBind();
         }
     }
 }
 protected void lnkdelete_Click(object sender, EventArgs e)
 {
     LinkButton lnk = (LinkButton)sender;
     reportingmaster obj = new reportingmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
     obj.reportingmaster_SRNO = -1;
     obj.reportingmaster_RELATIONSHIPID = -1;
     obj.reportingmaster_STATUS = 1;
     string condition = "SRNO=" + lnk.CommandArgument.ToString();
     if (obj.Insert(false, "reportingmaster", condition))
     {
         DataTable dtcontract = FillMemberList(txtfromdate.Text.Trim(), txttodate.Text.Trim(), txtname.Text.Trim());
         ViewState["list"] = dtcontract;
         if (dtcontract.Rows.Count > 0)
         {
             gvmemberlist.DataSource = (DataTable)ViewState["list"];
             gvmemberlist.DataBind();
         }
         else
         {
             gvmemberlist.DataSource = null;
             gvmemberlist.DataBind();
         }
     }
 }
Ejemplo n.º 3
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        if (ViewState["data"] != null)
        {
            if (((DataTable)ViewState["data"]).Rows.Count > 0)
            {
                DataTable dt = (DataTable)ViewState["data"];
                ViewState["data"] = null;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][0].ToString().Trim() != string.Empty)
                    {
                        reportingmaster obj = new reportingmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                        obj.reportingmaster_SRNO = -1;
                        obj.reportingmaster_DATE = txtdate.Text.Trim();
                        obj.reportingmaster_NAME = dt.Rows[i][1].ToString();
                        obj.reportingmaster_CONTACTNO = dt.Rows[i][2].ToString();
                        obj.reportingmaster_ACTIVITY = dt.Rows[i][3].ToString();
                        obj.reportingmaster_RESULT = dt.Rows[i][4].ToString();
                        obj.reportingmaster_REMARK = dt.Rows[i][5].ToString();
                        obj.reportingmaster_RELATIONSHIPID = General.Parse<int>(Session["userid"].ToString());
                        obj.reportingmaster_STATUS = 0;
                        if (obj.Insert(true, "reportingmaster"))
                        {
                            dt.Rows[i].Delete();

                        }
                    }
                }
                Response.Redirect("searchrecord.aspx?upload=1");
            }
        }
        else
        {
            MessageBox("Please Upload Record");
        }
        btnsubmit.Enabled = true;
    }