Example #1
0
    void LoadWorkInspectionDetails()
    {
        try
        {
            if (ddlJudgeList.SelectedIndex > 0 && txtFiscalYear.Text != "")
            {
                ATTJudgeWorkInspection obj = BLLJudgeWorkInspection.GetJudgeWorkInspection(int.Parse(ddlJudgeList.SelectedValue), txtFiscalYear.Text);


                if (obj != null)
                {
                    txtInspection.Text = obj.InspEmpName.ToString();
                    txtInspection.Attributes.Add("InspectorID", obj.InspEmpID.ToString());
                    txtInspectionDate.Text = obj.InspectionDate.ToShortDateString();

                    List <ATTJudgeWorkInspectionDetails> list = obj.Details;

                    List <ATTJudgeWorkInspectionDetails> list1 = list.FindAll(delegate(ATTJudgeWorkInspectionDetails detail)
                    {
                        return(detail.InspectionCaseNo != null && detail.InspectionCaseNo != 0);
                    });



                    Session["WorkDetailsLst"]           = list1;
                    grdWorkInspectionDetails.DataSource = list1;
                    grdWorkInspectionDetails.DataBind();

                    Session["AddEdit"] = "E";

                    btnSave.Visible   = true;
                    btnCancel.Visible = true;

                    ddlJudgeList.Enabled  = false;
                    txtFiscalYear.Enabled = false;

                    cpeDemo.Collapsed = true;
                    Panel3.Enabled    = false;
                }
                else
                {
                    grdWorkInspectionDetails.DataSource = null;
                    grdWorkInspectionDetails.DataBind();

                    Session["WorkDetailsLst"] = null;
                    Session["AddEdit"]        = "A";
                }
            }
            else
            {
                Session["AddEdit"] = "A";
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message.ToString();
            this.programmaticModalPopup.Show();
        }
    }
Example #2
0
 public static bool SaveJudgeWorkInspection(ATTJudgeWorkInspection objWorkInspection)
 {
     try
     {
         return(DLLJudgeWorkInspection.SaveJudgeWorkInspection(objWorkInspection));
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
        public static bool SaveJudgeWorkInspection(ATTJudgeWorkInspection objAtt)
        {
            string            InsertUpdateSP = "";
            OracleTransaction Tran;

            if (objAtt.Action == "A")
            {
                InsertUpdateSP = "SP_ADD_JUDGE_WORK_INSPECTION";
            }
            else if (objAtt.Action == "E")
            {
                InsertUpdateSP = "SP_EDIT_JUDGE_WORK_INSPECTION";
            }

            OracleParameter[] ParamArray = new OracleParameter[5];

            ParamArray[0] = FRAMEWORK.Utilities.GetOraParam(":P_EMP_ID", objAtt.EmployeeID, OracleDbType.Int64, ParameterDirection.Input);
            ParamArray[1] = FRAMEWORK.Utilities.GetOraParam(":P_FISCAL_YEAR", objAtt.FiscalYear, OracleDbType.Varchar2, ParameterDirection.Input);
            ParamArray[2] = FRAMEWORK.Utilities.GetOraParam(":P_INSP_EMP_ID", objAtt.InspEmpID, OracleDbType.Int64, ParameterDirection.Input);
            ParamArray[3] = FRAMEWORK.Utilities.GetOraParam(":P_INSP_DATE", objAtt.InspectionDate, OracleDbType.Date, ParameterDirection.Input);
            ParamArray[4] = FRAMEWORK.Utilities.GetOraParam(":P_ENTRY_BY", objAtt.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input);

            GetConnection GetConn = new GetConnection();

            OracleConnection DBConn = GetConn.GetDbConn(Module.PMS);

            Tran = DBConn.BeginTransaction();

            try
            {
                SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, InsertUpdateSP, ParamArray);

                DLLJudgeWorkInspectionDetails.SaveJudgeWorkInspectionDetails(objAtt.Details, Tran);

                Tran.Commit();

                return(true);
            }
            catch (Exception ex)
            {
                Tran.Rollback();
                throw ex;
            }
            finally
            {
                GetConn.CloseDbConn();
            }
        }
Example #4
0
        public static ATTJudgeWorkInspection GetJudgeWorkInspection(int?empID, string fiscalYear)
        {
            try
            {
                DataTable dt = DLLJudgeWorkInspection.GetJudgeWorkInspection(empID, fiscalYear);
                if (dt.Rows.Count > 0)
                {
                    ATTJudgeWorkInspection obj = new ATTJudgeWorkInspection(int.Parse(dt.Rows[0]["EMP_ID"].ToString()), int.Parse(dt.Rows[0]["INSP_EMP_ID"].ToString()), dt.Rows[0]["FISCAL_YEAR"].ToString(), DateTime.Parse(dt.Rows[0]["INSP_DATE"].ToString()), "");

                    obj.EmployeeName = dt.Rows[0]["JUDGEFULLNAME"].ToString();
                    obj.InspEmpName  = dt.Rows[0]["INSPFULLNAME"].ToString();
                    obj.Details      = BLLJudgeWorkInspectionDetails.GetJudgeWorkInspectionDetails(empID, fiscalYear);
                    return(obj);
                }
                return(null);
            }

            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (grdWorkInspectionDetails.Rows.Count < 1)
            {
                return;
            }


            int    i          = 0;
            string errmessage = "<P><b><U>! Attention </U></b></P>";

            if (ddlJudgeList.SelectedIndex < 1)
            {
                i++; errmessage += i.ToString() + ") Select Judge <br />";
            }
            if (!txtInspection.HasAttributes || txtInspection.Text == "")
            {
                i++; errmessage += i.ToString() + ") Inspector Missing  <br />";
            }
            if (txtInspectionDate.Text == "")
            {
                i++; errmessage += i.ToString() + ") Inspection Date Missing  <br />";
            }
            else
            {
                try
                {
                    DateTime dt = DateTime.Parse(txtInspectionDate.Text);
                }
                catch (Exception)
                {
                    i++; errmessage += i.ToString() + ") Invalid Date  <br />";
                }
            }

            if (i > 0)
            {
                this.lblStatusMessage.Text = errmessage;
                this.programmaticModalPopup.Show();
                return;
            }


            InspectionListInsert = new List <ATTJudgeWorkInspectionDetails>();
            int j = 0;

            foreach (ATTJudgeWorkList work in (List <ATTJudgeWorkList>)Session["WorkList"])
            {
                if (j > 0)
                {
                    ATTJudgeWorkInspectionDetails inspdet = new ATTJudgeWorkInspectionDetails();

                    inspdet.JwcID            = int.Parse(work.JwcID.ToString());
                    inspdet.JwcName          = work.JwcName;
                    inspdet.Action           = (Session["AddEdit"].ToString() == "A" ? "A" : "");
                    inspdet.EmployeeID       = int.Parse(ddlJudgeList.SelectedValue);
                    inspdet.EntryBy          = entryBy;
                    inspdet.EntryOn          = DateTime.Now;
                    inspdet.FiscalYear       = txtFiscalYear.Text;
                    inspdet.InspectionCaseNo = null;
                    inspdet.IsReasonValid    = null;
                    inspdet.NoDoneReason     = "";
                    inspdet.NoOfCase         = null;
                    inspdet.Remarks          = "";
                    inspdet.WorkDone         = false;

                    InspectionListInsert.Add(inspdet);
                }
                j++;
            }

            foreach (ATTJudgeWorkInspectionDetails inspDetails in (List <ATTJudgeWorkInspectionDetails>)Session["WorkDetailsLst"])
            {
                int k = InspectionListInsert.FindIndex(delegate(ATTJudgeWorkInspectionDetails detail)
                {
                    return(detail.JwcID == inspDetails.JwcID);
                });

                InspectionListInsert[k] = inspDetails;
            }

            ATTJudgeWorkInspection workInspection = new ATTJudgeWorkInspection();
            workInspection.EmployeeID = int.Parse(ddlJudgeList.SelectedValue);
            workInspection.FiscalYear = txtFiscalYear.Text;

            string st = txtInspection.Attributes["InspectorID"].ToString();
            workInspection.InspEmpID      = int.Parse(txtInspection.Attributes["InspectorID"].ToString());
            workInspection.InspectionDate = DateTime.Parse(txtInspectionDate.Text);
            workInspection.EntryBy        = entryBy;



            workInspection.Details = InspectionListInsert;
            workInspection.Action  = Session["AddEdit"].ToString();


            if (BLLJudgeWorkInspection.SaveJudgeWorkInspection(workInspection))
            {
                ClearControls(true);
                btnSave.Visible            = true;
                btnCancel.Visible          = true;
                this.lblStatusMessage.Text = "Information Saved.";
                this.programmaticModalPopup.Show();
            }
            else
            {
                this.lblStatusMessage.Text = "Problem Saving Information .";
                this.programmaticModalPopup.Show();
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message.ToString();
            this.programmaticModalPopup.Show();
        }
    }