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); } }
protected void cmdReset_Click(object sender, EventArgs e) { try { pnlException.Visible = false; //cmdSaveJobReturn.Enabled = true; //cmdSaveJob.Enabled = true; //cmdUpdateJob.Enabled = false; Reset(); ResetReturn(); //MyAccordion.Visible = true; //pnlDetails.Visible = false; ModalPopupJob.Hide(); //lnkBtnAdd.Visible = true; //gvJob.Visible = true; } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
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); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.Cookies["Company"] != null) { sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); } if (!IsPostBack) { //txtRefno.Focus(); //MyAccordion.Visible = true; //pnlDetails.Visible = false; gvJob.PageSize = 8; Reset(); GetJobDetails("0"); updatePnlPurchase.Update(); ModalPopupJob.Hide(); rvReturnDate.MinimumValue = System.DateTime.Now.AddYears(-100).ToShortDateString(); rvReturnDate.MaximumValue = System.DateTime.Now.ToShortDateString(); rvAssignedDate.MinimumValue = System.DateTime.Now.AddYears(-100).ToShortDateString(); rvAssignedDate.MaximumValue = System.DateTime.Now.ToShortDateString(); string connection = Request.Cookies["Company"].Value; string usernam = Request.Cookies["LoggedUserName"].Value; BusinessLogic bl = new BusinessLogic(sDataSource); if (bl.CheckUserHaveAdd(usernam, "JOBENT")) { lnkBtnAdd.Enabled = false; lnkBtnAdd.ToolTip = "You are not allowed to make Add New "; } else { lnkBtnAdd.Enabled = true; lnkBtnAdd.ToolTip = "Click to Add New "; } } string dbfileName = sDataSource.Remove(0, sDataSource.LastIndexOf(@"App_Data\") + 9); dbfileName = dbfileName.Remove(dbfileName.LastIndexOf(";Persist Security Info")); BusinessLogic objChk = new BusinessLogic(); if (objChk.CheckForOffline(Server.MapPath("Offline\\" + dbfileName + ".offline"))) { lnkBtnAdd.Visible = false; gvJob.Columns[6].Visible = false; gvJob.Columns[7].Visible = false; } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }