Ejemplo n.º 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        SuperZone _objSzm = new SuperZone();

        _objSzm.SuperZoneID   = Convert.ToInt32(lblID.Text);
        _objSzm.SuperZoneCode = txtSZCode.Text.Trim();
        _objSzm.SuperZoneName = txtSZName.Text.Trim();
        _objSzm.SDZoneID      = Convert.ToInt32(DDLSDZone.SelectedValue);
        _objSzm.SEmailID      = Txtsemail.Text.ToString();
        _objSzm.IsActive      = Chekacv.Checked;
        try
        {
            _objSzm.Save();
            MessageBox("Record saved successfully");
            grdSuperZoneDetails.DataSource = BindGvSuperZoneDetail();
            grdSuperZoneDetails.DataBind();
            if (btnSave.Text == "Update")
            {
                pnlSuperZoneDetails.Visible = true;
                pnlSuperZone.Visible        = false;
                btnSave.Visible             = false;
                btnSave.Text      = "Save";
                txtSZCode.Enabled = true;
                filter.Visible    = true;
            }
            else
            {
                pnlSuperZoneDetails.Visible = false;
                pnlSuperZone.Visible        = true;
                txtSZCode.Text = "";
                txtSZName.Text = "";
                Txtsemail.Text = "";
                txtSZCode.Focus();
            }
        }
        catch
        {
        }
    }
Ejemplo n.º 2
0
    protected void grdSuperZoneDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        SuperZone _objSZM = new SuperZone();

        _objSZM.SuperZoneID   = Convert.ToInt32(((Label)grdSuperZoneDetails.Rows[e.RowIndex].FindControl("lblSZID")).Text);
        _objSZM.SuperZoneCode = ((Label)grdSuperZoneDetails.Rows[e.RowIndex].FindControl("lblSZCode")).Text;
        _objSZM.SuperZoneName = ((Label)grdSuperZoneDetails.Rows[e.RowIndex].FindControl("lblSZName")).Text;


        _objSZM.IsActive  = Convert.ToBoolean(false);
        _objSZM.IsDeleted = Convert.ToBoolean(true);
        try
        {
            _objSZM.Save();
            MessageBox("Your record is Deleted");
            grdSuperZoneDetails.DataSource = BindGvSuperZoneDetail();
            grdSuperZoneDetails.DataBind();
            pnlSuperZoneDetails.Visible = true;
            pnlSuperZone.Visible        = false;
        }
        catch
        {
        }
    }