void LoadMachines()
    {
        clsMachineMaster obj = new clsMachineMaster();

        obj.Op = 4;
        DataTable dt = obj.MachineMaster(obj).Tables[0];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (dt.Rows[i]["Photo"] != "")
            {
                dt.Rows[i]["Photo"] = "~/" + dt.Rows[i]["Photo"];
            }
        }
        grdMachine.DataSource = dt;
        grdMachine.DataBind();
        if (grdMachine.Rows.Count > 0)
        {
            lblError.Text = "";
        }
        else
        {
            lblError.Text = "No Records Found";
        }
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        clsMachineMaster obj = new clsMachineMaster();

        obj.ID = Convert.ToInt32(hdEID.Value);
        obj.Op = 3;
        obj.MachineMaster(obj);
        msg.Text = "<script type='text/javascript'>alert('Deleted');</script>";
    }
Beispiel #3
0
    protected void txtMachine_TextChanged(object sender, EventArgs e)
    {
        clsMachineMaster obj = new clsMachineMaster();

        obj.ModelNo = txtMachine.Text;
        obj.Op      = 7;
        DataTable dt = obj.MachineMaster(obj).Tables[0];

        grdMachine.DataSource = dt;
        grdMachine.DataBind();
        grdMachine.Visible = true;
    }
    void LoadMachines()
    {
        clsMachineMaster obj = new clsMachineMaster();

        obj.Op = 4;
        DataTable dt = obj.MachineMaster(obj).Tables[0];

        ddlMachine.DataSource     = dt;
        ddlMachine.DataValueField = "ID";
        ddlMachine.DataTextField  = "ModelNo";
        ddlMachine.DataBind();
        ddlEMachine.DataSource     = dt;
        ddlEMachine.DataValueField = "ID";
        ddlEMachine.DataTextField  = "ModelNo";
        ddlEMachine.DataBind();
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        clsMachineMaster obj = new clsMachineMaster();

        obj.ID           = Convert.ToInt32(hdEID.Value);
        obj.SerialNo     = txtESerial.Text;
        obj.ModelNo      = txtEModel.Text;
        obj.Manufacturer = ddlEManufacturer.SelectedItem.Text;
        obj.MachineType  = Convert.ToInt32(ddlEMachineType.SelectedValue);
        obj.Description  = txtEDescription.Text;
        obj.Photo        = UpdateImage();
        obj.Op           = 2;
        obj.MachineMaster(obj);
        pnlUpdate.Visible   = false;
        pnlExisting.Visible = true;
        LoadMachines();
        msg.Text = "<script type='text/javascript'>alert('Updated');</script>";
    }
    protected void txtMachineName_TextChanged(object sender, EventArgs e)
    {
        clsMachineMaster obj = new clsMachineMaster();

        obj.ModelNo = txtMachineName.Text;
        obj.Op      = 7;
        DataTable dt = obj.MachineMaster(obj).Tables[0];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (dt.Rows[i]["Photo"] != "")
            {
                dt.Rows[i]["Photo"] = "~/" + dt.Rows[i]["Photo"];
            }
        }
        grdMachine.DataSource = dt;
        grdMachine.DataBind();
    }
    protected void grdMachine_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        HiddenField      hdID = (HiddenField)grdMachine.Rows[e.RowIndex].FindControl("hdID");
        clsMachineMaster obj  = new clsMachineMaster();

        obj.ID = Convert.ToInt32(hdID.Value);
        obj.Op = 5;
        DataTable dt = obj.MachineMaster(obj).Tables[0];

        hdEID.Value                        = hdID.Value;
        txtESerial.Text                    = dt.Rows[0]["SerialNo"].ToString();
        txtEModel.Text                     = dt.Rows[0]["ModelNo"].ToString();
        txtEDescription.Text               = dt.Rows[0]["Description"].ToString();
        ddlEMachineType.SelectedValue      = dt.Rows[0]["MachineType"].ToString();
        ddlEManufacturer.SelectedItem.Text = dt.Rows[0]["Manufacturer"].ToString();
        if (dt.Rows[0]["Photo"].ToString() != "")
        {
            imgEPhoto.ImageUrl = "~/" + dt.Rows[0]["Photo"].ToString();
        }
        pnlUpdate.Visible   = true;
        pnlExisting.Visible = false;
    }