Exemplo n.º 1
0
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     obj    = new clsMiscellaneous();
     objPrp = new clsMiscellaneousPrp();
     objPrp.Pmiscellaneous_id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex][0]);
     obj.del_rec(objPrp);
     Free_Memory();
     grid_bind();
 }
Exemplo n.º 2
0
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        obj                       = new clsMiscellaneous();
        objPrp                    = new clsMiscellaneousPrp();
        item_form.Visible         = true;
        GridView1_heading.Visible = false;
        Label1.Visible            = true; //ID text
        Label2.Visible            = true; //ID value

        //ViewState["Index_Of_Editing_Row"] = Convert.ToInt32(GridView1.DataKeys[e.NewEditIndex][0]);
        ViewState["Index_Of_Editing_Row"] = objPrp.Pmiscellaneous_id = Convert.ToInt32(GridView1.DataKeys[e.NewEditIndex][0]);

        objPrp = obj.find_rec(objPrp);

        Label1.Text   = "ID";
        Label2.Text   = Convert.ToString(objPrp.Pmiscellaneous_id);
        TextBox1.Text = objPrp.Pmiscellaneous_product_name;
        TextBox2.Text = objPrp.Pmiscellaneous_manufacturer;
        if (objPrp.Pmiscellaneous_purchase_date != null)
        {
            TextBox3.Text = Convert.ToString(objPrp.Pmiscellaneous_purchase_date).Substring(0, 10);
        }
        TextBox4.Text = objPrp.Pmiscellaneous_purchase_file_number;
        if (objPrp.Pmiscellaneous_warrenty_from != null && objPrp.Pmiscellaneous_warrenty_from != null)
        {
            TextBox5.Text = Convert.ToString(objPrp.Pmiscellaneous_warrenty_from).Substring(0, 10);
            TextBox6.Text = Convert.ToString(objPrp.Pmiscellaneous_warrenty_to).Substring(0, 10);
        }
        if (objPrp.Pmiscellaneous_annual_maintenance_contract_from != null && objPrp.Pmiscellaneous_annual_maintenance_contract_to != null)
        {
            TextBox7.Text = Convert.ToString(objPrp.Pmiscellaneous_annual_maintenance_contract_from).Substring(0, 10);
            TextBox8.Text = Convert.ToString(objPrp.Pmiscellaneous_annual_maintenance_contract_to).Substring(0, 10);
        }
        TextArea1.Value = objPrp.Pmiscellaneous_annual_maintenance_contract_detail;
        TextBox9.Text   = objPrp.Pmiscellaneous_annual_maintenance_contract_number;
        TextBox10.Text  = objPrp.Pmiscellaneous_serial_no_or_service_tag_number;
        TextBox11.Text  = objPrp.Pmiscellaneous_quantity.ToString();
        if (objPrp.Pmiscellaneous_emp_id != 0)
        {
            DropDownList1.SelectedValue = objPrp.Pmiscellaneous_emp_id.ToString();
            CheckBox1.Checked           = false;
            DropDownList1.Enabled       = true;
        }
        else
        {
            CheckBox1.Checked     = true;
            DropDownList1.Enabled = false;
        }

        Btn_Submit_Update.Text = "Update";
        //Btn_Cancel.Visible = true;
        Btn_Reset_Cancel.Text = "Cancel";

        Free_Memory();
    }
Exemplo n.º 3
0
    protected void Btn_Submit_Update_Click(object sender, EventArgs e)
    {
        obj    = new clsMiscellaneous();
        objPrp = new clsMiscellaneousPrp();
        objPrp.Pmiscellaneous_product_name         = TextBox1.Text;
        objPrp.Pmiscellaneous_manufacturer         = TextBox2.Text;
        objPrp.Pmiscellaneous_purchase_date        = Convert.ToDateTime(TextBox3.Text);
        objPrp.Pmiscellaneous_purchase_file_number = TextBox4.Text;
        if (TextBox5.Text != "" && TextBox6.Text != "")
        {
            objPrp.Pmiscellaneous_warrenty_from = Convert.ToDateTime(TextBox5.Text);
            objPrp.Pmiscellaneous_warrenty_to   = Convert.ToDateTime(TextBox6.Text);
        }
        if (TextBox7.Text != "" && TextBox8.Text != "")
        {
            objPrp.Pmiscellaneous_annual_maintenance_contract_from = Convert.ToDateTime(TextBox7.Text);
            objPrp.Pmiscellaneous_annual_maintenance_contract_to   = Convert.ToDateTime(TextBox8.Text);
        }
        objPrp.Pmiscellaneous_annual_maintenance_contract_detail = TextArea1.Value;
        objPrp.Pmiscellaneous_annual_maintenance_contract_number = TextBox9.Text;
        objPrp.Pmiscellaneous_serial_no_or_service_tag_number    = TextBox10.Text;
        if (TextBox11.Text != "")
        {
            objPrp.Pmiscellaneous_quantity = Convert.ToInt32(TextBox11.Text);
        }
        else
        {
            objPrp.Pmiscellaneous_quantity = null;
        }
        if (CheckBox1.Checked == false)
        {
            objPrp.Pmiscellaneous_emp_id = Convert.ToInt32(DropDownList1.SelectedValue);
        }


        if (Btn_Submit_Update.Text == "Save")
        {
            obj.save_rec(objPrp);
            TextBox1.Focus();
        }
        else if (Btn_Submit_Update.Text == "Update")
        {
            objPrp.Pmiscellaneous_id = Convert.ToInt32(ViewState["Index_Of_Editing_Row"]);
            obj.upd_rec(objPrp);
            Btn_Submit_Update.Text = "Save";
            Btn_Reset_Cancel.Text  = "Reset";
            Label1.Visible         = false; //ID text
            Label2.Visible         = false; //ID value
        }
        clear_rec();
        grid_bind();
        Free_Memory();
    }
Exemplo n.º 4
0
 private void Free_Memory()
 {
     objPrp = null;
     obj    = null;
     GC.Collect();
 }