Ejemplo n.º 1
0
        public static PlanCase CreateCase(SqlDataReader dr, int planId, int defendantId)
        {
            PlanCase tmpcase = null;

            if (!dr.IsClosed && dr.HasRows)
            {
                // getting id that uniquely identifies the object
                string   casename    = dr["casename"].ToString();
                string   updatedby   = dr["updatedby"].ToString();
                DateTime updateddate = (DateTime)dr["updateddate"];

                tmpcase = new PlanCase(planId, defendantId, casename, updatedby, updateddate);

                tmpcase.RaiseChangedEvents = false;

                tmpcase.CountyId  = (!dr.IsDBNull(dr.GetOrdinal("countyid"))) ? Convert.ToInt32(dr["countyid"]) : -1;
                tmpcase.Committed = Convert.ToBoolean(dr["committed"].ToString());
                if (!dr.IsDBNull(dr.GetOrdinal("commitdate")))
                {
                    tmpcase.CommitDate = dr["commitdate"].ToString();
                }
                if (!dr.IsDBNull(dr.GetOrdinal("commitbasedate")))
                {
                    tmpcase.CommitBaseDate = dr["commitbasedate"].ToString();
                }
                tmpcase.CommitDaysTill = (!dr.IsDBNull(dr.GetOrdinal("commitdaystill"))) ? Convert.ToDouble(dr["commitdaystill"]) : 0;
                tmpcase.CAPP           = Convert.ToBoolean(dr["capp"].ToString());
                tmpcase.Save();

                tmpcase.RaiseChangedEvents = true;
            }

            return(tmpcase);
        }
Ejemplo n.º 2
0
        public PlanCase Clone()
        {
            PlanCase tmpcase = new PlanCase(this.ID, this.DefendantId, this.CaseName, this.UpdatedBy, this.UpdatedDate);

            tmpcase.RaiseChangedEvents = false;

            tmpcase.CountyId       = this.CountyId;
            tmpcase.Committed      = this.Committed;
            tmpcase.CommitDate     = this.CommitDate;
            tmpcase.CommitBaseDate = this.CommitBaseDate;
            tmpcase.CommitDaysTill = this.CommitDaysTill;
            tmpcase.CAPP           = this.CAPP;
            tmpcase.Save();

            tmpcase.RaiseChangedEvents = true;

            return(tmpcase);
        }
Ejemplo n.º 3
0
        public static PlanCase UpdateCaseIds(PlanCase planCase, int planId, int defendantId)
        {
            PlanCase tmpcase = null;

            // getting id that uniquely identifies the object
            tmpcase = new PlanCase(planId, defendantId, planCase.CaseName, planCase.UpdatedBy, planCase.UpdatedDate);

            tmpcase.RaiseChangedEvents = false;

            tmpcase.CountyId       = planCase.CountyId;
            tmpcase.Committed      = planCase.Committed;
            tmpcase.CommitDate     = planCase.CommitDate;
            tmpcase.CommitBaseDate = planCase.CommitBaseDate;
            tmpcase.CommitDaysTill = planCase.CommitDaysTill;
            tmpcase.CAPP           = planCase.CAPP;
            tmpcase.Save();

            tmpcase.MyState = planCase.MyState;

            tmpcase.RaiseChangedEvents = true;

            return(tmpcase);
        }
Ejemplo n.º 4
0
        /*
         *
         * This particular function is very specific in how it pastes data based on specific client requests.
         *
         * in this case I don't care about all the cells that come out of the columns.
         * All we really want is the first column.  This should accomodate pasting using ALT, or
         * selecting all rows and columns and then pasting.
         */
        private void PasteClipboard()
        {
            bool   dataFormatCorrect = true;
            bool   excludedDupes     = false;
            bool   excludedPrefixes  = false;
            string strCaseName       = string.Empty;
            string strClipboardData  = string.Empty;

            string[] rowSplitter = { "\r\n", "\r", "\n" };

            this.SuspendLayout();
            dgvCases.SuspendLayout();

            // get text from clipboard
            try
            {
                strClipboardData = ((IDataObject)Clipboard.GetDataObject()).GetData(DataFormats.Text).ToString();
            }
            catch { }

            if (!string.IsNullOrEmpty(strClipboardData))
            {
                // split clipboard data into lines and add each as row in datagridview
                foreach (string strRow in strClipboardData.Split(rowSplitter, StringSplitOptions.RemoveEmptyEntries))
                {
                    // 132 character matches input file.
                    if (strRow.Length == 132)
                    {
                        // checking obligor, owed, paid, and balance columns
                        if (!strRow.Substring(78, 14).Contains("$") || !strRow.Substring(93, 14).Contains("$") ||
                            !strRow.Substring(108, 14).Contains("$") || strRow.Substring(28, 25).Trim().Length < 1)
                        {
                            dataFormatCorrect = false;
                            continue;
                        }

                        strCaseName = strRow.Substring(0, 18).Trim();
                    }
                    else if (strRow.Trim().Length <= 18 && strRow.Trim().Length > 0 && !strRow.ToLower().Contains("rows selected"))
                    {
                        strCaseName = strRow.Trim();
                    }
                    else
                    {
                        dataFormatCorrect = false;
                        continue;
                    }

                    // does the case already exist
                    if (CaseExists(strCaseName))
                    {
                        excludedDupes = true;
                        continue;
                    }

                    // does the case have an excluded prefix
                    if (Helper.HasRestrictedCasePrefix(strCaseName))
                    {
                        excludedPrefixes = true;
                        continue;
                    }

                    // adding case
                    PlanCase plancase = (PlanCase)bindingCases.AddNew();
                    plancase.CaseName = strCaseName;
                    if (strCaseName.ToUpper().Contains("NT") || strCaseName.ToUpper().Contains("ST"))
                    {
                        plancase.CAPP = true;
                    }
                }

                bindingCases.ResetBindings(false);
            }

            dgvCases.ResumeLayout(false);
            this.ResumeLayout(false);

            if (excludedDupes || excludedPrefixes || !dataFormatCorrect)
            {
                string strMessage = "";

                if (excludedDupes)
                {
                    strMessage += "Duplicate case(s) encountered.\n";
                }

                if (excludedPrefixes)
                {
                    strMessage += "Case(s) encountered that had an excluded prefix.\n";
                }

                if (!dataFormatCorrect)
                {
                    strMessage += "*Clipboard line(s) encountered that do not match a recognizable format:\n\n"
                                  + "1.  a line exactly 132 characters.\n"
                                  + "2.  a line that is 19 characters or less.\n\n"
                                  + "*This message should be expected if pasting an entire file and not specific rows.";
                }

                MessageBox.Show(this, strMessage, "Cases", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }