void LoadData(int Type)
    {
        clsSiteProductParts obj = new clsSiteProductParts();

        if (Type == 2)
        {
            obj.Op = 11;
            if (ddlMachine.SelectedIndex != 0)
            {
                obj.SiteMachineID = Convert.ToInt32(ddlMachine.SelectedValue);
                DataTable dt = obj.SiteProductParts(obj).Tables[0];
                LoadDataMachineWise(dt);
            }
        }
        else if (Type == 3)
        {
            obj.Op      = 12;
            obj.SiteID  = Convert.ToInt32(Request.Cookies["SiteID"].Value);
            obj.BillRef = txtPartNo.Text.Trim();
            DataTable dt = obj.SiteProductParts(obj).Tables[0];
            LoadDataPartWise(dt);
        }
        else
        {
            pnlDetail.Controls.Clear();
        }
    }
Пример #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow dr in grd.Rows)
     {
         TextBox             txtPartNo          = dr.FindControl("txtPartNo") as TextBox;
         HiddenField         hdPartID           = dr.FindControl("hdPartID") as HiddenField;
         Label               lblPartName        = dr.FindControl("lblPartName") as Label;
         TextBox             txtReference       = dr.FindControl("txtReference") as TextBox;
         DropDownList        ddlTransactionType = dr.FindControl("ddlTransactionType") as DropDownList;
         TextBox             txtRate            = dr.FindControl("txtRate") as TextBox;
         TextBox             txtQuantity        = dr.FindControl("txtQuantity") as TextBox;
         Label               lblTotal           = dr.FindControl("lblTotal") as Label;
         TextBox             txtRemarks         = dr.FindControl("txtRemarks") as TextBox;
         clsSiteProductParts obj = new clsSiteProductParts();
         //ID, SiteID,SiteMachineID,PartID,EntryDate1,EntryDate2,BillRef,TransactionType,Quantity,Rate,Total,Remarks,Op
         if (hdPartID.Value != "" && Convert.ToInt32(txtQuantity.Text) != 0)
         {
             obj.SiteID        = Convert.ToInt32(Request.Cookies["SiteID"].Value);
             obj.SiteMachineID = Convert.ToInt32(ddlMachines.SelectedValue);
             obj.PartID        = Convert.ToInt32(hdPartID.Value);
             try { obj.EntryDate1 = Convert.ToDateTime(txtDate.Text).ToShortDateString(); }
             catch { }
             obj.BillRef         = txtReference.Text;
             obj.TransactionType = Convert.ToInt32(ddlTransactionType.SelectedValue);
             obj.Quantity        = Convert.ToInt32(txtQuantity.Text);
             obj.Rate            = Convert.ToDouble(txtRate.Text);
             obj.Total           = Convert.ToDouble(lblTotal.Text);
             obj.Remarks         = txtRemarks.Text;
             obj.Op = 1;
             obj.SiteProductParts(obj);
         }
     }
 }
    protected void grd_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        clsIndentItems obj = new clsIndentItems();

        obj.ID = Convert.ToInt32(grd.DataKeys[e.RowIndex].Value);
        obj.Op = 5;
        obj.IndentItemMaster(obj);

        /*Add to items*/
        TextBox             txtLogNo        = grd.Rows[e.RowIndex].FindControl("txtLogNo") as TextBox;
        TextBox             txtPartNo       = grd.Rows[e.RowIndex].FindControl("txtPartNo") as TextBox;
        HiddenField         hdPartID        = grd.Rows[e.RowIndex].FindControl("hdPartID") as HiddenField;
        TextBox             txtItem         = grd.Rows[e.RowIndex].FindControl("txtItem") as TextBox;
        TextBox             txtCurrentStock = grd.Rows[e.RowIndex].FindControl("txtCurrentStock") as TextBox;
        TextBox             txtQuantity     = grd.Rows[e.RowIndex].FindControl("txtQuantity") as TextBox;
        HiddenField         hdPrevQuantity  = grd.Rows[e.RowIndex].FindControl("hdPrevQuantity") as HiddenField;
        TextBox             txtUOM          = grd.Rows[e.RowIndex].FindControl("txtUOM") as TextBox;
        TextBox             txtRemark       = grd.Rows[e.RowIndex].FindControl("txtRemark") as TextBox;
        LinkButton          lnkDelete       = grd.Rows[e.RowIndex].FindControl("lnkDelete") as LinkButton;
        clsSiteProductParts obSPP           = new clsSiteProductParts();

        obSPP.SiteID          = Convert.ToInt32(Request.QueryString["SiteID"]);
        obSPP.SiteMachineID   = Convert.ToInt32(Request.QueryString["SiteMachineID"]);
        obSPP.PartID          = Convert.ToInt32(hdPartID.Value);
        obSPP.Quantity        = Convert.ToInt32(txtCurrentStock.Text) - Convert.ToInt32(txtQuantity.Text);
        obSPP.Op              = 1;
        obSPP.TransactionType = 1;
        obSPP.Remarks         = "Insert against Indent edit";
        obSPP.SiteProductParts(obSPP);
    }
Пример #4
0
    void LoadAllData()
    {
        clsSiteProductParts obj = new clsSiteProductParts();

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

        grdParts.DataSource = dt;
        grdParts.DataBind();
        int Quantity = 0;

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Quantity = Quantity + Convert.ToInt32(dt.Rows[i]["Quantity"]);
        }
        grdParts.FooterRow.Cells[5].Text = Quantity.ToString();
        grdParts.FooterRow.Cells[4].Text = "Total";
        if (grdParts.Rows.Count > 0)
        {
            lblError.Text = "";
        }
        else
        {
            lblError.Text = "No Records found";
        }
    }
    void SaveIssueList(int IndentID)
    {
        clsIndent obj = new clsIndent();

        obj.ID = IndentID;
        obj.Op = 4;
        DataTable      dt   = obj.IndentMaster(obj).Tables[0];
        clsIndentItems obII = new clsIndentItems();

        obII.IndentID = IndentID;
        obII.Op       = 3;
        DataTable dtItems = obII.IndentItemMaster(obII).Tables[0];

        if (dtItems.Rows.Count > 0)
        {
            /*Add To Issue*/
            clsSitePartIssue obSPI = new clsSitePartIssue();
            obSPI.SiteID        = Convert.ToInt32(dt.Rows[0]["SiteID"]);
            obSPI.SiteMachineID = Convert.ToInt32(dt.Rows[0]["SiteMachineID"]);
            obSPI.IndentRef     = dt.Rows[0]["RefNo"].ToString();
            obSPI.Op            = 1;
            /*Stock Management Entry*/
            clsSiteProductParts obSPP = new clsSiteProductParts();
            obSPP.SiteID          = Convert.ToInt32(dt.Rows[0]["SiteID"]);
            obSPP.SiteMachineID   = Convert.ToInt32(dt.Rows[0]["SiteMachineID"]);
            obSPP.BillRef         = dt.Rows[0]["RefNo"].ToString();
            obSPP.Remarks         = "Issued Against Indent";
            obSPP.Op              = 1;
            obSPP.TransactionType = 2;
            foreach (DataRow dr in dtItems.Rows)
            {
                try
                {
                    obSPI.PartID   = Convert.ToInt32(dr["PartID"]);
                    obSPI.PartNo   = dr["PartNo"].ToString();
                    obSPI.PartName = dr["PartName"].ToString();
                    obSPI.Price    = Convert.ToDouble(dr["Price"]);
                    if (Convert.ToInt32(dr["Quantity"]) > Convert.ToInt32(dr["CurrentStock"]))
                    {
                        obSPI.Quantity = Convert.ToInt32(dr["CurrentStock"]);
                        obSPP.Quantity = Convert.ToInt32(dr["CurrentStock"]);
                    }
                    else
                    {
                        obSPI.Quantity = Convert.ToInt32(dr["Quantity"]);
                        obSPP.Quantity = Convert.ToInt32(dr["Quantity"]);
                    }
                    obSPI.SitePartIssue(obSPI);
                    obSPP.PartID = Convert.ToInt32(dr["PartID"]);
                    try { obSPP.Rate = Convert.ToDouble(dr["Price"]); }
                    catch { }
                    obSPP.Total = obSPP.Rate * obSPP.Quantity;
                    obSPP.SiteProductParts(obSPP);
                }
                catch
                {
                }
            }
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        clsIndentItems obj = new clsIndentItems();

        obj.IndentID = Convert.ToInt32(Request.QueryString["IndentID"]);
        foreach (GridViewRow dr in grd.Rows)
        {
            TextBox     txtLogNo        = dr.FindControl("txtLogNo") as TextBox;
            TextBox     txtPartNo       = dr.FindControl("txtPartNo") as TextBox;
            HiddenField hdPartID        = dr.FindControl("hdPartID") as HiddenField;
            TextBox     txtItem         = dr.FindControl("txtItem") as TextBox;
            TextBox     txtCurrentStock = dr.FindControl("txtCurrentStock") as TextBox;
            TextBox     txtQuantity     = dr.FindControl("txtQuantity") as TextBox;
            HiddenField hdPrevQuantity  = dr.FindControl("hdPrevQuantity") as HiddenField;
            TextBox     txtUOM          = dr.FindControl("txtUOM") as TextBox;
            TextBox     txtRemark       = dr.FindControl("txtRemark") as TextBox;
            LinkButton  lnkDelete       = dr.FindControl("lnkDelete") as LinkButton;
            if (hdPartID.Value == "-1")
            {
                if (txtPartNo.Text != "" && txtItem.Text != "" && Convert.ToInt32(txtQuantity.Text) != 0)
                {
                    obj.Op           = 1;
                    obj.LogNo        = txtLogNo.Text;
                    obj.PartNo       = txtPartNo.Text;
                    obj.Particular   = txtItem.Text;
                    obj.CurrentStock = Convert.ToInt32(txtCurrentStock.Text);
                    obj.Quantity     = Convert.ToInt32(txtQuantity.Text);
                    obj.UOM          = txtUOM.Text;
                    obj.Remarks      = txtRemark.Text;
                    obj.IndentItemMaster(obj);
                }
            }
            else
            {
                if (Convert.ToInt32(Request.QueryString["Status"]) == 1)
                {
                    if (txtQuantity.Text != hdPrevQuantity.Value)
                    {
                        obj.Op       = 4;
                        obj.ID       = Convert.ToInt32(grd.DataKeys[dr.RowIndex].Value);
                        obj.Quantity = Convert.ToInt32(txtQuantity.Text);
                        obj.IndentItemMaster(obj);
                        if (Convert.ToInt32(txtCurrentStock.Text) > Convert.ToInt32(txtQuantity.Text))
                        {
                            clsSiteProductParts obSPP = new clsSiteProductParts();
                            obSPP.SiteID          = Convert.ToInt32(Request.QueryString["SiteID"]);
                            obSPP.SiteMachineID   = Convert.ToInt32(Request.QueryString["SiteMachineID"]);
                            obSPP.PartID          = Convert.ToInt32(hdPartID.Value);
                            obSPP.Quantity        = Convert.ToInt32(txtCurrentStock.Text) - Convert.ToInt32(txtQuantity.Text);
                            obSPP.Op              = 1;
                            obSPP.TransactionType = 1;
                            obSPP.Remarks         = "Insert against Indent edit";
                            obSPP.SiteProductParts(obSPP);
                        }
                    }
                }
            }
        }
    }
    protected void btnApprove_Click(object sender, EventArgs e)
    {
        clsIndent obj = new clsIndent();

        obj.Op         = 10;
        obj.ID         = Convert.ToInt32(Request.QueryString["ID"]);
        obj.Status     = 1;
        obj.ApprovedBy = Convert.ToInt32(hdApprovedBy.Value);
        obj.IndentMaster(obj);
        obj.Op = 4;
        DataTable      dt   = obj.IndentMaster(obj).Tables[0];
        clsIndentItems obII = new clsIndentItems();

        obII.IndentID = Convert.ToInt32(Request.QueryString["ID"]);
        obII.Op       = 3;
        DataTable dtItems = obII.IndentItemMaster(obII).Tables[0];

        if (dtItems.Rows.Count > 0)
        {
            /*Add To Issue*/
            clsSitePartIssue obSPI = new clsSitePartIssue();
            obSPI.SiteID        = Convert.ToInt32(dt.Rows[0]["SiteID"]);
            obSPI.SiteMachineID = Convert.ToInt32(dt.Rows[0]["SiteMachineID"]);
            obSPI.IndentRef     = dt.Rows[0]["RefNo"].ToString();
            obSPI.Op            = 1;
            /*Stock Management Entry*/
            clsSiteProductParts obSPP = new clsSiteProductParts();
            obSPP.SiteID          = Convert.ToInt32(dt.Rows[0]["SiteID"]);
            obSPP.SiteMachineID   = Convert.ToInt32(dt.Rows[0]["SiteMachineID"]);
            obSPP.BillRef         = dt.Rows[0]["RefNo"].ToString();
            obSPP.Remarks         = "Issued Against Indent";
            obSPP.Op              = 1;
            obSPP.TransactionType = 2;
            foreach (DataRow dr in dtItems.Rows)
            {
                obSPI.PartID   = Convert.ToInt32(dr["PartID"]);
                obSPI.PartNo   = dr["PartNo"].ToString();
                obSPI.PartName = dr["PartName"].ToString();
                obSPI.Price    = Convert.ToDouble(dr["Price"]);
                if (Convert.ToInt32(dr["Quantity"]) > Convert.ToInt32(dr["CurrentStock"]))
                {
                    obSPI.Quantity = Convert.ToInt32(dr["CurrentStock"]);
                    obSPP.Quantity = Convert.ToInt32(dr["CurrentStock"]);
                }
                else
                {
                    obSPI.Quantity = Convert.ToInt32(dr["Quantity"]);
                    obSPP.Quantity = Convert.ToInt32(dr["Quantity"]);
                }
                obSPI.SitePartIssue(obSPI);
                obSPP.PartID = Convert.ToInt32(dr["PartID"]);
                try { obSPP.Rate = Convert.ToDouble(dr["Price"]); }
                catch { }
                obSPP.Total = obSPP.Rate * obSPP.Quantity;
                obSPP.SiteProductParts(obSPP);
            }
        }
        LoadOrder();
    }
Пример #8
0
    protected void grdParts_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        clsSiteProductParts obj = new clsSiteProductParts();

        obj.Op = 3;
        obj.ID = Convert.ToInt32(grdParts.DataKeys[e.RowIndex].Value);
        obj.SiteProductParts(obj);
        LoadAllData();
    }
    public void GetCurrentStockByProductAndSite(int SiteID, string PartNo)
    {
        clsSiteProductParts obj = new clsSiteProductParts();

        obj.BillRef = PartNo;
        obj.SiteID  = SiteID;
        obj.Op      = 7;
        DataTable dt = obj.SiteProductParts(obj).Tables[0];

        Context.Response.Write(JsonConvert.SerializeObject(dt));
    }
Пример #10
0
    void LoadAllData()
    {
        clsSiteProductParts obj = new clsSiteProductParts();

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

        grdAllStock.DataSource = dt;
        grdAllStock.DataBind();
    }
Пример #11
0
    protected void grdParts_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox             txtEBillRef  = (TextBox)grdParts.Rows[e.RowIndex].FindControl("txtEBillRef");
        TextBox             txtEQuantity = (TextBox)grdParts.Rows[e.RowIndex].FindControl("txtEQuantity");
        clsSiteProductParts obj          = new clsSiteProductParts();

        obj.Op       = 2;
        obj.Quantity = Convert.ToInt32(txtEQuantity.Text);
        obj.BillRef  = txtEBillRef.Text;
        obj.SiteProductParts(obj);
        LoadAllData();
    }
    protected void txtPartNo1_TextChanged(object sender, EventArgs e)
    {
        TextBox     txtPartNo       = (TextBox)sender;
        GridViewRow row             = txtPartNo.NamingContainer as GridViewRow;
        TextBox     txtPartName     = grd.Rows[row.RowIndex].FindControl("txtPartName1") as TextBox;
        Label       lblCurrentStock = grd.Rows[row.RowIndex].FindControl("lblCurrentStock1") as Label;
        HiddenField hdPartID        = grd.Rows[row.RowIndex].FindControl("hdPartID") as HiddenField;
        clsPart     obj             = new clsPart();

        obj.PartName = txtPartNo.Text.Trim();
        obj.Op       = 8;
        DataTable dt = obj.PartMaster(obj).Tables[0];

        if (dt.Rows.Count > 0)
        {
            txtPartName.Text = dt.Rows[0]["PartName"].ToString();
            hdPartID.Value   = dt.Rows[0]["ID"].ToString();
        }
        else
        {
            hdPartID.Value = "";
        }
        clsSiteProductParts obParts = new clsSiteProductParts();

        obParts.SiteID = Convert.ToInt32(ddlSite.SelectedValue);
        try
        {
            obParts.PartID = Convert.ToInt32(dt.Rows[0]["ID"]);
        }
        catch
        {
            obParts.PartID = 0;
        }
        obParts.Op = 8;
        DataTable dtStock = obParts.SiteProductParts(obParts).Tables[0];

        if (dtStock.Rows.Count > 0)
        {
            try
            {
                lblCurrentStock.Text = dtStock.Rows[0]["Quantity"].ToString();
            }
            catch
            {
                lblCurrentStock.Text = "0";
            }
        }
        else
        {
            lblCurrentStock.Text = "0";
        }
    }
Пример #13
0
    void LoadSelectedData(int Index)
    {
        clsSiteProductParts obj = new clsSiteProductParts();

        obj.Op = 10;
        HiddenField hdSiteMachineID = grdAllStock.Rows[Index].FindControl("hdSiteMachineID") as HiddenField;
        HiddenField hdPartID        = grdAllStock.Rows[Index].FindControl("hdPartID") as HiddenField;

        obj.SiteMachineID = Convert.ToInt32(hdSiteMachineID.Value);
        obj.PartID        = Convert.ToInt32(hdPartID.Value);
        DataTable dt = obj.SiteProductParts(obj).Tables[0];

        grdParts.DataSource = dt;
        grdParts.DataBind();
    }
    protected void txtPartNo_TextChanged(object sender, EventArgs e)
    {
        TextBox txtPartNo = sender as TextBox;

        txtPartNo.Text = txtPartNo.Text.Trim();
        GridViewRow row             = txtPartNo.NamingContainer as GridViewRow;
        TextBox     txtItem         = row.FindControl("txtItem") as TextBox;
        TextBox     txtCurrentStock = row.FindControl("txtCurrentStock") as TextBox;
        TextBox     txtQuantity     = row.FindControl("txtQuantity") as TextBox;
        HiddenField hdPartID        = row.FindControl("hdPartID") as HiddenField;
        clsPart     obj             = new clsPart();

        obj.PartName = txtPartNo.Text.Trim();
        obj.Op       = 8;
        DataTable dt = obj.PartMaster(obj).Tables[0];

        if (dt.Rows.Count > 0)
        {
            txtItem.Text   = dt.Rows[0]["PartName"].ToString();
            hdPartID.Value = dt.Rows[0]["ID"].ToString();
            clsSiteProductParts obParts = new clsSiteProductParts();
            obParts.SiteID = Convert.ToInt32(Convert.ToInt32(Request.Cookies["SiteID"].Value));
            obParts.PartID = Convert.ToInt32(dt.Rows[0]["ID"]);
            obParts.Op     = 8;
            DataTable dtStock = obParts.SiteProductParts(obParts).Tables[0];
            if (dtStock.Rows.Count > 0)
            {
                try
                {
                    txtCurrentStock.Text = dtStock.Rows[0]["Quantity"].ToString();
                }
                catch
                {
                    txtCurrentStock.Text = "0";
                }
            }
            else
            {
                txtCurrentStock.Text = "0";
            }
            txtQuantity.Focus();
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('New Item Will Be Added')", true);
            hdPartID.Value = "0";
        }
    }
    protected void txtPartNo_TextChanged(object sender, EventArgs e)
    {
        TextBox txtPartNo = sender as TextBox;

        txtPartNo.Text = txtPartNo.Text.Trim();
        GridViewRow row             = txtPartNo.NamingContainer as GridViewRow;
        TextBox     txtItem         = row.FindControl("txtItem") as TextBox;
        TextBox     txtCurrentStock = row.FindControl("txtCurrentStock") as TextBox;
        TextBox     txtQuantity     = row.FindControl("txtQuantity") as TextBox;

        clsPart obj = new clsPart();

        obj.PartName = txtPartNo.Text.Trim();
        obj.Op       = 8;
        DataTable dt = obj.PartMaster(obj).Tables[0];

        if (dt.Rows.Count > 0)
        {
            txtItem.Text = dt.Rows[0]["PartName"].ToString();

            clsSiteProductParts obParts = new clsSiteProductParts();
            obParts.SiteID = Convert.ToInt32(Convert.ToInt32(Request.QueryString["SiteID"]));
            obParts.PartID = Convert.ToInt32(dt.Rows[0]["ID"]);
            obParts.Op     = 8;
            DataTable dtStock = obParts.SiteProductParts(obParts).Tables[0];
            if (dtStock.Rows.Count > 0)
            {
                try
                {
                    txtCurrentStock.Text = dtStock.Rows[0]["Quantity"].ToString();
                }
                catch
                {
                    txtCurrentStock.Text = "0";
                }
            }
            else
            {
                txtCurrentStock.Text = "0";
            }
            txtQuantity.Focus();
        }
        else
        {
            txtPartNo.Focus();
        }
    }
Пример #16
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (hdMachineID.Value != "" && hdPartID.Value != "")
     {
         clsSiteProductParts obj = new clsSiteProductParts();
         //ID,SiteID,MachineID, PartID, EntryDate, BillRef, TransactionType, Quantity
         obj.SiteID          = Convert.ToInt32(Request.Cookies["SiteID"].Value);
         obj.SiteMachineID   = Convert.ToInt32(hdMachineID.Value);
         obj.PartID          = Convert.ToInt32(hdPartID.Value);
         obj.EntryDate1      = txtEntryDate.Text;
         obj.BillRef         = txtBillRef.Text;
         obj.TransactionType = Convert.ToInt32(ddlTransactionType.SelectedValue);
         obj.Quantity        = Convert.ToInt32(txtQuantity.Text);
         obj.Op = 1;
         obj.SiteProductParts(obj);
         LoadAllData();
     }
 }
    public void SaveProductStock(int SiteID, int SiteMachineID, int PartID, string EntryDate, string BillRef, int TransactionType, int Quantity, double Rate, double Total, string Remarks)
    {
        clsSiteProductParts obj = new clsSiteProductParts();

        obj.SiteID          = SiteID;
        obj.SiteMachineID   = SiteMachineID;
        obj.PartID          = PartID;
        obj.EntryDate1      = EntryDate;
        obj.BillRef         = BillRef;
        obj.TransactionType = TransactionType;
        obj.Quantity        = Quantity;
        obj.Rate            = Rate;
        obj.Total           = Total;
        obj.Remarks         = Remarks;
        obj.Op = 1;
        obj.SiteProductParts(obj);
        Context.Response.Write(JsonConvert.SerializeObject("Saved"));
    }
Пример #18
0
    protected void grdParts_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox             txtEBillRef   = (TextBox)grdParts.Rows[e.RowIndex].FindControl("txtEBillRef");
        TextBox             txtEQuantity  = (TextBox)grdParts.Rows[e.RowIndex].FindControl("txtEQuantity");
        Label               lblTotalPrice = (Label)grdParts.Rows[e.RowIndex].FindControl("lblTotalPrice");
        TextBox             txtERate      = (TextBox)grdParts.Rows[e.RowIndex].FindControl("txtERate");
        clsSiteProductParts obj           = new clsSiteProductParts();

        obj.ID       = Convert.ToInt32(grdParts.DataKeys[e.RowIndex].Value);
        obj.Op       = 2;
        obj.Quantity = Convert.ToInt32(txtEQuantity.Text);
        obj.BillRef  = txtEBillRef.Text;
        try { obj.Rate = Convert.ToDouble(txtERate.Text); }
        catch { }
        try { obj.Total = (Convert.ToDouble(txtERate.Text) * Convert.ToInt32(txtEQuantity.Text)); }
        catch { }
        obj.SiteProductParts(obj);
        LoadSelectedData(grdAllStock.SelectedIndex);
    }
    protected void txtPartNo_TextChanged(object sender, EventArgs e)
    {
        clsPart obj = new clsPart();

        obj.PartName = txtPartNo.Text.Trim();
        obj.Op       = 8;
        DataTable dt = obj.PartMaster(obj).Tables[0];

        if (dt.Rows.Count > 0)
        {
            lblPartNo.Text   = dt.Rows[0]["SerialNo"].ToString();
            lblPartName.Text = dt.Rows[0]["PartName"].ToString();
            //txtPartName.Text = dt.Rows[0]["PartName"].ToString();

            txtDetail.Text = "Machine Model/Name: " + dt.Rows[0]["ModelNo"].ToString() + "\n Manufacturer/Supplier: " + dt.Rows[0]["Manufacturer"].ToString() + "\n Part No:" + dt.Rows[0]["SerialNo"].ToString() + "\n Part Name:" + dt.Rows[0]["PartName"].ToString();
            clsSiteProductParts obParts = new clsSiteProductParts();
            obParts.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value);
            obParts.PartID = Convert.ToInt32(dt.Rows[0]["ID"]);
            obParts.Op     = 8;
            DataTable dtStock = obParts.SiteProductParts(obParts).Tables[0];
            if (dtStock.Rows.Count > 0)
            {
                try
                {
                    txtCurrentStock.Text = dtStock.Rows[0]["Quantity"].ToString();
                }
                catch
                {
                    txtCurrentStock.Text = "0";
                }
            }
            else
            {
                txtCurrentStock.Text = "0";
            }
        }
        else
        {
            txtPartNo.Focus();
        }
    }