Ejemplo n.º 1
0
    private void LoadControls(SqlInt32 JobworkOrderID)
    {
        JobworkOrderENT entJobworkOrder = new JobworkOrderENT();
        JobworkOrderBAL balJobworkOrder = new JobworkOrderBAL();

        entJobworkOrder = balJobworkOrder.SelectByPK(JobworkOrderID);

        if (!entJobworkOrder.CustomerID.IsNull)
        {
            ddlCustomer.SelectedValue = entJobworkOrder.CustomerID.Value.ToString();
        }
        if (!entJobworkOrder.ProductID.IsNull)
        {
            ddlProduct.Text = entJobworkOrder.ProductID.Value.ToString();
        }
        if (!entJobworkOrder.Gross.IsNull)
        {
            txtGross.Text = entJobworkOrder.Gross.Value.ToString();
        }
        if (!entJobworkOrder.Rate.IsNull)
        {
            txtRate.Text = entJobworkOrder.Rate.Value.ToString();
        }
        if (!entJobworkOrder.IssueDate.IsNull)
        {
            txtIssueDate.Text = entJobworkOrder.IssueDate.Value.ToString();
        }
        if (!entJobworkOrder.ReturnDate.IsNull)
        {
            txtReturnDate.Text = entJobworkOrder.ReturnDate.Value.ToString();
        }
    }
Ejemplo n.º 2
0
    protected void gvJobworkOrder_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "DeleteRecord" && e.CommandArgument != null)
        {
            JobworkOrderBAL balJobworkOrder = new JobworkOrderBAL();

            if (balJobworkOrder.Delete(Convert.ToInt32(e.CommandArgument)))
            {
                FillJobworkOrderGridView(Convert.ToInt32(Session["UserID"]));
            }
            else
            {
                lblMessage.Text = balJobworkOrder.Message;
            }
        }
    }
Ejemplo n.º 3
0
    private void FillJobworkOrderGridView(SqlInt32 UserID)
    {
        JobworkOrderBAL balJobworkOrder = new JobworkOrderBAL();

        DataTable dtJobworkOrder = balJobworkOrder.SelectAll(UserID);

        if (dtJobworkOrder != null && dtJobworkOrder.Rows.Count > 0)
        {
            gvJobworkOrder.DataSource = dtJobworkOrder;
            gvJobworkOrder.DataBind();
            lblMessage.Text = "No Of Record : " + dtJobworkOrder.Rows.Count.ToString();
        }
        else
        {
            lblMessage.Text           = "No Data Here";
            gvJobworkOrder.DataSource = null;
            gvJobworkOrder.DataBind();
        }
    }
Ejemplo n.º 4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        #region ServerSide Validation


        #endregion ServerSide Validations

        JobworkOrderENT entJobworkOrder = new JobworkOrderENT();
        JobworkOrderBAL balJobworkOrder = new JobworkOrderBAL();

        JobworkReturnENT entJobworkReturn = new JobworkReturnENT();
        JobworkReturnBAL balJobworkReturn = new JobworkReturnBAL();

        #region Gather Data
        if (ddlCustomer.SelectedIndex > 0)
        {
            entJobworkOrder.CustomerID  = Convert.ToInt32(ddlCustomer.SelectedValue);
            entJobworkReturn.CustomerID = Convert.ToInt32(ddlCustomer.SelectedValue);
        }
        if (ddlProduct.SelectedIndex > 0)
        {
            entJobworkOrder.ProductID  = Convert.ToInt32(ddlProduct.SelectedValue);
            entJobworkReturn.ProductID = Convert.ToInt32(ddlProduct.SelectedValue);
        }
        if (txtGross.Text.Trim() != String.Empty)
        {
            entJobworkOrder.Gross         = Convert.ToInt32(txtGross.Text.Trim());
            entJobworkReturn.IssueGross   = Convert.ToInt32(txtGross.Text.Trim());
            entJobworkReturn.PendingGross = Convert.ToInt32(txtGross.Text.Trim());
        }
        if (txtRate.Text.Trim() != String.Empty)
        {
            entJobworkOrder.Rate = Convert.ToInt32(txtRate.Text.Trim());
        }
        if (txtIssueDate.Text.Trim() != String.Empty)
        {
            entJobworkOrder.IssueDate = Convert.ToDateTime(txtIssueDate.Text.Trim());
        }
        if (txtReturnDate.Text.Trim() != String.Empty)
        {
            entJobworkOrder.ReturnDate = Convert.ToDateTime(txtReturnDate.Text.Trim());
        }

        entJobworkReturn.ReturnGross = 0;

        entJobworkOrder.CreationDate  = DateTime.Now;
        entJobworkReturn.CreationDate = DateTime.Now;

        entJobworkOrder.UserID  = Convert.ToInt32(Session["UserID"]);
        entJobworkReturn.UserID = Convert.ToInt32(Session["UserID"]);

        if (Request.QueryString["JobworkOrderID"] == null)
        {
            Int32 JobworkOrderID = balJobworkOrder.Insert(entJobworkOrder);
            if (JobworkOrderID > 0)
            {
                entJobworkReturn.JobworkOrderID = JobworkOrderID;
            }

            balJobworkReturn.Insert(entJobworkReturn);

            lblMessage.Text = "Data Insert SuccessFully";
            ClearControl();
        }
        else
        {
            entJobworkOrder.JobworkOrderID = Convert.ToInt32(Request.QueryString["JobworkOrderID"]);
            balJobworkOrder.Update(entJobworkOrder);
            Response.Redirect("~/AdminPanel/JobworkOrder/JobworkOrderList.aspx");
        }

        #endregion Gather Data
    }