Ejemplo n.º 1
0
        public static List <ATTCaseDocumentsLit> GetCaseDocuments(double?caseID, double?litigantID, int?documentID)
        {
            List <ATTCaseDocumentsLit> CaseDocumentLitList = new List <ATTCaseDocumentsLit>();

            try
            {
                foreach (DataRow row in DLLCaseDocumentLit.GetCaseDocuments(caseID, litigantID, documentID).Rows)
                {
                    ATTCaseDocumentsLit objCaseDocLit = new ATTCaseDocumentsLit();
                    objCaseDocLit.CaseID       = double.Parse(row["CASE_ID"].ToString());
                    objCaseDocLit.LitType      = row["LITIGANT_TYPE"].ToString();
                    objCaseDocLit.LitigantID   = double.Parse(row["LITIGANT_ID"].ToString());
                    objCaseDocLit.LitigantName = row["LITIGANTNAME"].ToString();
                    objCaseDocLit.DocumentID   = int.Parse(row["DOCUMENT_ID"].ToString());
                    objCaseDocLit.FileName     = row["DOCUMENT_FILE_NAME"].ToString();
                    objCaseDocLit.Action       = "";
                    CaseDocumentLitList.Add(objCaseDocLit);
                }


                return(CaseDocumentLitList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    protected void btnAddLitDoc_Click(object sender, EventArgs e)
    {
        //int seq=1;

        #region "VALIDATES LITIGANT DOCUMENTS"
        //CHECKS IF THE LAST ROW OF THE DOCUMENT GRID IS ADDED OR NOT
        if (((FileUpload)grdDocuments.Rows[this.grdDocuments.Rows.Count - 1].FindControl("fupDocuments")).HasFile == true)
        {
            this.lblStatusMessage.Text = "Last Document Has Not Been Added To The List";
            this.programmaticModalPopup.Show();
            return;
        }

        //CHECKS EITHER ONLY OF APPELLANT OR RESPONDANT IS SELECTED
        int cntAppellant  = 0;
        int cntRespondant = 0;
        foreach (GridViewRow gvRow in this.grdAppellant.Rows)
        {
            if (((CheckBox)gvRow.FindControl("chkSelect")).Checked == true)
            {
                cntAppellant += 1;
            }
        }

        foreach (GridViewRow gvRow in this.grdRespondant.Rows)
        {
            if (((CheckBox)gvRow.FindControl("chkSelect")).Checked == true)
            {
                cntRespondant += 1;
            }
        }

        if (cntAppellant == 0 && cntRespondant == 0)
        {
            this.lblStatusMessage.Text = "Please Select Either Appellant or Respondant to assign Lawyer";
            this.programmaticModalPopup.Show();
            return;
        }

        if (cntAppellant > 0 && cntRespondant > 0)
        {
            this.lblStatusMessage.Text = "Both Appellant or Respondant Can't Be Selected At the Same Time";
            this.programmaticModalPopup.Show();
            return;
        }
        #endregion


        //INITITALIZING OBJECTS
        List <DocFup>              fupLST     = (List <DocFup>)Session["BindToGrid"];
        List <ATTCaseDocuments>    CaseDocLST = (List <ATTCaseDocuments>)Session["CaseDocuments"];
        ATTCaseDocuments           objCaseDoc;
        List <ATTCaseDocumentsLit> CaseDocLitLST = (List <ATTCaseDocumentsLit>)Session["LitDocuments"];
        ATTCaseDocumentsLit        objCaseDocLit;
        ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]);

        //PREPARING CASE DOCUMENTS
        foreach (DocFup obj in fupLST)
        {
            objCaseDoc                  = new ATTCaseDocuments();
            objCaseDoc.CaseID           = double.Parse(lblCaseNo.Text);
            objCaseDoc.DocSeq           = obj.DocSeq;
            objCaseDoc.DocumentID       = 0;
            objCaseDoc.DocumentFileName = obj.FileName;
            objCaseDoc.DocumentContent  = obj.FileContents;
            objCaseDoc.EntryBy          = user.UserName;
            objCaseDoc.Action           = "A";

            CaseDocLST.Add(objCaseDoc);
        }


        //ADDING DOCUMENTS FOR APPELLANTS
        int documentRowCount = 0;
        foreach (GridViewRow gvRow in this.grdAppellant.Rows)
        {
            documentRowCount = 0;

            if (((CheckBox)gvRow.FindControl("chkSelect")).Checked == true)
            {
                foreach (DocFup obj in fupLST)
                {
                    if (documentRowCount < fupLST.Count - 1)
                    {
                        objCaseDocLit              = new ATTCaseDocumentsLit();
                        objCaseDocLit.CaseID       = double.Parse(this.lblCaseNo.Text);
                        objCaseDocLit.LitigantID   = double.Parse(gvRow.Cells[1].Text);
                        objCaseDocLit.LitType      = "A";
                        objCaseDocLit.LitigantName = gvRow.Cells[2].Text;

                        objCaseDocLit.DocSeq   = obj.DocSeq;
                        objCaseDocLit.FileName = obj.FileName;
                        //objCaseDoc.DocumentFile = obj.FileContents;
                        objCaseDocLit.Action  = "A";
                        objCaseDocLit.EntryBy = user.UserName;

                        CaseDocLitLST.Add(objCaseDocLit);

                        documentRowCount += 1;
                    }
                }
            }
        }


        //ADDING DOCUMENTS FOR RESPONDANTS
        foreach (GridViewRow gvRow in this.grdRespondant.Rows)
        {
            if (((CheckBox)gvRow.FindControl("chkSelect")).Checked == true)
            {
                documentRowCount = 0;
                foreach (DocFup obj in fupLST)
                {
                    if (documentRowCount < fupLST.Count - 1)
                    {
                        objCaseDocLit              = new ATTCaseDocumentsLit();
                        objCaseDocLit.CaseID       = double.Parse(this.lblCaseNo.Text);
                        objCaseDocLit.LitigantID   = double.Parse(gvRow.Cells[1].Text);
                        objCaseDocLit.LitType      = "R";
                        objCaseDocLit.LitigantName = gvRow.Cells[2].Text;

                        objCaseDocLit.DocSeq   = 0;
                        objCaseDocLit.FileName = obj.FileName;
                        //objCaseDoc.DocumentFile = obj.FileContents;
                        objCaseDocLit.EntryBy = user.UserName;
                        objCaseDocLit.Action  = "A";

                        CaseDocLitLST.Add(objCaseDocLit);

                        documentRowCount += 1;
                    }
                }
            }
        }

        CaseDocLitLST.Sort(delegate(ATTCaseDocumentsLit o1, ATTCaseDocumentsLit o2)
        {
            return(o2.LitigantType.CompareTo(o1.LitigantType).CompareTo(o2.LitigantID.CompareTo(o1.LitigantID)));
        });
        this.grdLitDocument.DataSource = CaseDocLitLST;
        this.grdLitDocument.DataBind();


        //Clearing Grid Controls
        foreach (GridViewRow gvRow in this.grdAppellant.Rows)
        {
            ((CheckBox)gvRow.FindControl("chkSelect")).Checked = false;
        }

        foreach (GridViewRow gvRow in this.grdRespondant.Rows)
        {
            ((CheckBox)gvRow.FindControl("chkSelect")).Checked = false;
        }

        fupLST.Clear();
        fupLST.Add(new DocFup());
        this.grdDocuments.DataSource = fupLST;
        this.grdDocuments.DataBind();
    }