protected void grdParts_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        clsSitePartRequest obj = new clsSitePartRequest();

        obj.ID = Convert.ToInt32(grdParts.DataKeys[e.RowIndex].Value);
        obj.Op = 6;
        obj.SitePartRequest(obj);
        LoadData();
    }
Beispiel #2
0
    protected void grdPartRequest_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        clsSitePartRequest obj = new clsSitePartRequest();

        obj.Op       = 7;
        obj.ID       = Convert.ToInt32(grdPartRequest.DataKeys[e.RowIndex].Value);
        obj.FromSite = Convert.ToInt32(Request.Cookies["SiteID"].Value);
        obj.SitePartRequest(obj);
        LoadData();
    }
    protected void grdParts_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        DropDownList       ddlEStatus = (DropDownList)grdParts.Rows[e.RowIndex].FindControl("ddlEStatus");
        TextBox            txtEPartNo = (TextBox)grdParts.Rows[e.RowIndex].FindControl("txtEPartNo");
        clsSitePartRequest obj        = new clsSitePartRequest();

        obj.Op     = 2;
        obj.ID     = Convert.ToInt32(grdParts.DataKeys[e.RowIndex].Value);
        obj.PartNo = txtEPartNo.Text;
        obj.Status = Convert.ToInt32(ddlEStatus.SelectedValue);
        obj.SitePartRequest(obj);
        grdParts.EditIndex = -1;
        LoadData();
    }
    void LoadDataBySite()
    {
        clsSitePartRequest obj = new clsSitePartRequest();

        obj.Op     = 4;
        obj.SiteID = Convert.ToInt32(ddlSite.SelectedValue);
        DataTable dt = obj.SitePartRequest(obj).Tables[0];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["Photo"] = "~/" + dt.Rows[i]["Photo"];
        }
        grdPartRequest.DataSource = dt;
        grdPartRequest.DataBind();
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        clsSitePartRequest obj = new clsSitePartRequest();

        //ID, SiteID, UserID, PartNo, Description, Photo, Status
        obj.SiteID      = Convert.ToInt32(Request.Cookies["SiteID"].Value);
        obj.UserID      = Convert.ToInt32(Request.Cookies["User"].Value);
        obj.EntryDate   = DateTime.Today.ToShortDateString();
        obj.PartNo      = txtPartNo.Text;
        obj.Description = txtDescription.Text;
        obj.Status      = 0;
        obj.Photo       = UploadPhoto();
        obj.FromSite    = Convert.ToInt32(ddlSite.SelectedValue);
        obj.ItemType    = Convert.ToInt32(rdItemType.SelectedValue);
        obj.Op          = 1;
        obj.SitePartRequest(obj);
        LoadData();
        pnlExisting.Visible = true;
        txtPartNo.Text      = "";
        txtDescription.Text = "";
    }
    void LoadData()
    {
        clsSitePartRequest obj = new clsSitePartRequest();

        obj.Op = 3;
        DataTable dt = obj.SitePartRequest(obj).Tables[0];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["Photo"] = "~/" + dt.Rows[i]["Photo"];
        }
        grdPartRequest.DataSource = dt;
        grdPartRequest.DataBind();
        if (grdPartRequest.Rows.Count == 0)
        {
            lblError.Text = "No Records found";
        }
        else
        {
            lblError.Text = "";
        }
    }
Beispiel #7
0
    void LoadData()
    {
        clsSitePartRequest obj = new clsSitePartRequest();

        obj.Op       = 8;
        obj.FromSite = Convert.ToInt32(Request.Cookies["SiteID"].Value);
        DataTable dt = obj.SitePartRequest(obj).Tables[0];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["Photo"] = "~/" + dt.Rows[i]["Photo"];
        }
        grdPartRequest.DataSource = dt;
        grdPartRequest.DataBind();
        if (grdPartRequest.Rows.Count > 0)
        {
            lblError.Text = "";
        }
        else
        {
            lblError.Text = "No Records found";
        }
    }
    void LoadData()
    {
        clsSitePartRequest obj = new clsSitePartRequest();

        if (ddlSites.SelectedIndex == ddlSites.Items.Count - 1)
        {
            obj.Op = 3;
        }
        else
        {
            obj.SiteID = Convert.ToInt32(ddlSites.SelectedValue);
            obj.Op     = 4;
        }
        DataTable dt = obj.SitePartRequest(obj).Tables[0];

        foreach (DataRow dr in dt.Rows)
        {
            if (dr["Photo"] != "")
            {
                dr["Photo"] = "~/" + dr["Photo"];
            }
            else
            {
                dr["Photo"] = "No Image";
            }
        }
        grdParts.DataSource = dt;
        grdParts.DataBind();
        if (grdParts.Rows.Count > 0)
        {
            lblError.Text = "";
        }
        else
        {
            lblError.Text = "No Records Found";
        }
    }