Beispiel #1
0
    protected void cmdUpdateJob_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                pnlException.Visible = false;
                string strRef        = string.Empty;
                string strJobTitle   = string.Empty;
                string strJobDesc    = string.Empty;
                int    iAssgn        = 0;
                double dQtyAss       = 0;
                string strAssDate    = string.Empty;
                string strExpRetDate = string.Empty;
                double dQtyRet       = 0;

                strRef      = txtRefno.Text.Trim();
                strJobTitle = txtJobTitle.Text.Trim();
                strJobDesc  = txtDesc.Text.Trim();
                if (drpIncharge.SelectedIndex > 0)
                {
                    iAssgn = Convert.ToInt32(drpIncharge.SelectedItem.Value);
                }
                dQtyAss       = Convert.ToDouble(txtAssQty.Text.Trim());
                strAssDate    = txtAssignedDate.Text.Trim();
                strExpRetDate = txtExpRetDate.Text.Trim();
                dQtyRet       = Convert.ToDouble(lblRetQty.Text);
                int    jobID  = Convert.ToInt32(hdJobID.Value);
                string isComp = "N";
                /* Insert into the Job Table */
                BusinessLogic bl    = new BusinessLogic(sDataSource);
                int           jobid = bl.UpdateJobDetails(strRef, strJobTitle, strJobDesc, iAssgn, strAssDate, strExpRetDate, dQtyAss, dQtyRet, jobID, isComp);

                ModalPopupJob.Hide();
                UpdatePnlMaster.Update();

                Reset();
                GetJobDetails("0");
                //pnlValidation.Visible = false ;
                //lnkBtnAdd.Visible = true;
                //pnlDetails.Visible = false;


                gvJob.Visible = true;
                tabs2.Visible = false;
                //TabPanel1.Visible = false;

                //MyAccordion.Visible = true;
                //gvJob.Visible = true;
            }
            else
            {
                //pnlValidation.Visible = true;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Beispiel #2
0
    protected void cmdSaveJobReturn_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                pnlException.Visible = false;
                string strRemarks = string.Empty;
                string strRetDate = string.Empty;
                double dQtyRet    = 0;
                int    jobID      = 0;
                int    jobCompID  = 0;
                double QtyAss     = 0;
                strRemarks = txtRemarks.Text.Trim();
                strRetDate = txtCRetDate.Text.Trim();
                dQtyRet    = Convert.ToDouble(txtCRetQty.Text);
                jobID      = Convert.ToInt32(hdJobID.Value);
                if (txtAssQty.Text.Trim() != string.Empty)
                {
                    QtyAss = Convert.ToDouble(txtAssQty.Text.Trim());
                }
                BusinessLogic bl = new BusinessLogic(sDataSource);
                if (jobID > 0)
                {
                    jobCompID = bl.InsertJobReturnDetails(strRemarks, jobID, dQtyRet, strRetDate, QtyAss);
                    System.Threading.Thread.Sleep(1000);
                    if (jobCompID == -1)
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Qty. Returned Should not be greater than assigned');", true);
                        return;
                    }

                    DataSet ds = new DataSet();
                    ds = bl.ListJobReturn(jobID);
                    if (ds != null)
                    {
                        gvJobReturn.DataSource = ds;
                        gvJobReturn.DataBind();
                    }

                    double dRet = Convert.ToDouble(lblRetQty.Text);
                    dRet           = dRet + dQtyRet;
                    lblRetQty.Text = dRet.ToString();
                    ResetReturn();
                    GetJobDetails("0");

                    gvJob.Visible = true;
                    tabs2.Visible = false;

                    //lnkBtnAdd.Visible = true;
                    //pnlDetails.Visible = false;
                    ModalPopupJob.Hide();
                    UpdatePnlMaster.Update();
                    //MyAccordion.Visible = true;
                    //gvJob.Visible = true;
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Qty. Returned Successfully Saved');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Select the job before you return the qty.');", true);
                }
                //pnlValidation.Visible = false;
            }
            else
            {
                //pnlValidation.Visible = true;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }