Exemplo n.º 1
0
        private void generateTemplate_Click(object sender, EventArgs e)
        {
            string json = JsonConvert.SerializeObject(new
            {
                data = new
                {
                    batch_id         = "${batch_id}",
                    reference_id     = "${id}",
                    jurisdiction     = getSelectedValue(jurisdiction, "jurisdiction"),
                    case_category    = getSelectedValue(casecategory, "casecategory"),
                    case_type        = getSelectedValue(casetype, "casetype"),
                    payment_account  = getSelectedValue(paymentaccount, "paymentaccount"),
                    filing_attorney  = getSelectedValue(filingattorney, "filingattorney"),
                    filer_type       = getSelectedValue(filertype, "filertype"),
                    damage_amount    = getSelectedValue(datamageamount, "datamageamount"),
                    procedure_remedy = createProcedureRemedy(),
                    filing           = new[] { createFiling(1) },
                    case_party       = createcaseParties()
                }
            }, Formatting.Indented);;

            frmPayload frmPayload = new frmPayload(this.settings);

            frmPayload.Payload = json;
            frmPayload.ShowDialog();
        }
Exemplo n.º 2
0
        private void dgCases_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex == -1)
                {
                    return;
                }
                int selectedIndex = dgCases.CurrentCell.RowIndex;
                int selectedCol   = dgCases.CurrentCell.ColumnIndex;

                var id = dgCases.Rows[selectedIndex].Cells[0].Value;


                string templatepath = Path.Combine(txtJsonTemplateLocation.Text, AppConstants.LoginState);

                List <Dictionary <string, string> > parsedTable = BatchBL.ParseXSVFile(txtTSVFileLocation.Text);

                Dictionary <string, string> templates = BatchBL.InitiTemplates(templatepath);

                foreach (var tableRow in parsedTable)
                {
                    //Read each row of data
                    if (id.Equals(tableRow["id"]))
                    {
                        tableRow.Add("batch_id", BatchId);

                        var line = string.Join(AppConstants.XSV_SEPERATOR, tableRow.Values);

                        String payload  = null;
                        string template = null;

                        if (tableRow.ContainsKey("template"))
                        {
                            template = tableRow["template"];
                        }

                        if (template != null && template.Trim().Length > 0)
                        {
                            if (templates.ContainsKey(template))
                            {
                                payload = templates[template];
                            }
                        }
                        else
                        {
                            if (!tableRow.ContainsKey("case_number") || tableRow["case_number"].ToString().Trim().Length == 0)
                            {
                                template = "NEW";
                            }
                            else
                            {
                                template = "EXISTING";
                            }

                            if (templates.ContainsKey(template))
                            {
                                payload = templates[template];
                            }
                        }

                        if (payload == null)
                        {
                            MessageBox.Show("Template: " + template + " Not Found");
                        }
                        else
                        {
                            foreach (KeyValuePair <string, string> entry in tableRow)
                            {
                                var value = entry.Value;
                                if (entry.Value.EndsWith(AppConstants.PDF_PATTERN))
                                {
                                    value = Path.GetFileName(value);
                                }
                                payload = payload.Replace("${" + entry.Key + "}", value);
                            }

                            frmPayload frmPayload = new frmPayload();
                            frmPayload.Payload = payload;
                            frmPayload.ShowDialog();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex);
            }
        }
Exemplo n.º 3
0
        //----------------------------------------------------------------------------------------------------
        //Filing code
        //----------------------------------------------------------------------------------------------------


        private void previewtemplate1_Click(object sender, EventArgs e)
        {
            frmPayload pa = new frmPayload(payload);

            pa.Show();
        }