Exemplo n.º 1
0
        private void cmdCustom_Click(object sender, System.EventArgs e)
        {
            //Make sure case is not closed or suspended. --Sszathmary 11/4/2004 (MJennings)
            if (!ICI_Functions.IsCaseModificationPermitted(this, m_case_pkey, this.Name, true))
            {
                return;
            }

            DialogResult rc        = new DialogResult();
            string       strCustom = "";
            Form         f         = new Forms.InputBox("Custom Worksheet", "Please enter worksheet data.");

            rc = f.ShowDialog();

            if (rc == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            TextBox txtCustom = ((Forms.InputBox)f).txtText;

            txtCustom.MaxLength = 255;

            strCustom = txtCustom.Text;
            while (MessageBox.Show(this, "Do you have more Custom Worksheet Data to Enter?", "Custom Worksheet", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                rc = f.ShowDialog();
                if (rc == System.Windows.Forms.DialogResult.OK)
                {
                    txtCustom           = ((Forms.InputBox)f).txtText;
                    txtCustom.MaxLength = 255;

                    strCustom = strCustom + "/" + txtCustom.Text;
                }
            }
            txtCustomWorksheet.Text = strCustom;
        }
Exemplo n.º 2
0
        private void cmdSave_Click(object sender, System.EventArgs e)
        {
            //Make sure case is not closed or suspended. --Sszathmary 11/4/2004 (MJennings)
            if (!ICI_Functions.IsCaseModificationPermitted(this, m_case_pkey, this.Name, true))
            {
                return;
            }

            string strPrompts = "";

            if (pnlPrompts.Controls.Count > 0)
            {
                foreach (Control ltbx in pnlPrompts.Controls)
                {
                    if (ltbx.GetType().ToString() != "System.Windows.Forms.TextBox")
                    {
                        continue;
                    }

                    if (((TextBox)ltbx).Text.Trim() == "")
                    {
                        MessageBox.Show(this, "All prompts Fields must be populated.", "Set Line Item", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ltbx.Focus();
                        return;
                    }
                    else
                    {
                        strPrompts = strPrompts + "/|" + ltbx.Tag.ToString() + "," + ltbx.Text + "|";
                    }
                }
            }
            // Need to determine if it is prefix or postfix to the last element in the ReferencePoint.
            if (tvwForms.SelectedNode.Nodes.Count > 0)
            {
                // Prompts are appended to the end
                txtReferenceNumber.Text = txtReferenceNumber.Text + strPrompts;
            }
            else
            {
                // Prompts are appended before the last element
                int lholder = txtReferenceNumber.Text.LastIndexOf("/");

                if (lholder >= 0)
                {
                    string strstart = txtReferenceNumber.Text.Substring(0, lholder);
                    string strEnd   = txtReferenceNumber.Text.Substring(lholder);
                    txtReferenceNumber.Text = strstart + strPrompts + strEnd;
                }
            }

            // Write the TaxLine (ReferenceNumber) and CustomWorksheet data to the 5701 xml doc
            try
            {
                Logger.Log(LogLevel.Debug, "SetLineItem.cmdCustom_Click", "Saving ReferenceNumber (TaxLine) and CustomWorksheet data to 5701 Infopath xml document. ");

                string str5701Path = Application.StartupPath + "\\Cases\\" + m_case_pkey.ToString() + "\\Issues\\" + m_doc_guid + ".xml";

                // MJennings - 11/3/2004 - Issue 19267: remove the front portion of the ReferenceNumber (i.e. everything up to "/Line")
                string strReferenceNumber = txtReferenceNumber.Text;

                // MJennings - 11/8/2004 - Issue 19374: write the full ReferenceNumber to the xml doc, and handle the formatting within the InfoPath form
                // strReferenceNumber = strReferenceNumber.Remove(0, strReferenceNumber.IndexOf("/Line") + 1);

                ICI_Functions.SetIssueDocumentXMLData(str5701Path, "my:ReferenceNumber", strReferenceNumber);
                ICI_Functions.SetIssueDocumentXMLData(str5701Path, "my:CustomWorksheet", txtCustomWorksheet.Text);
            }
            catch (System.Exception ex)
            {
                Logger.Log(LogLevel.Debug, "SetLineItem.cmdCustom_Click", "Error saving data to 5701 Infopath xml document " + ex.ToString() + " . ");
            }

            if (m_doc_guid != null)
            {
                try
                {
                    object[] spParams;

                    // Save TaxLine to IMS_DOCUMENT_DEMOGRAPHIC
                    spParams = new object[6];
                    spParams.SetValue(m_doc_guid, 0);
                    spParams.SetValue("TaxLine", 1);
                    spParams.SetValue(null, 2);
                    spParams.SetValue(txtReferenceNumber.Text, 3);
                    spParams.SetValue(null, 4);
                    spParams.SetValue(null, 5);

                    SqlHelper.ExecuteNonQuery(ICI_Functions.GetConnectionString(), "PSP_Save_IMS_Document_Demographic", spParams);

                    // Save CustomWorksheet to IMS_DOCUMENT_DEMOGRAPHIC
                    spParams = new object[6];
                    spParams.SetValue(m_doc_guid, 0);
                    spParams.SetValue("CustomWorksheet", 1);
                    spParams.SetValue(null, 2);
                    spParams.SetValue(txtCustomWorksheet.Text, 3);
                    spParams.SetValue(null, 4);
                    spParams.SetValue(null, 5);

                    SqlHelper.ExecuteNonQuery(ICI_Functions.GetConnectionString(), "PSP_Save_IMS_Document_Demographic", spParams);
                }
                catch (Exception ex)
                {
                    //	MessageBox.Show(this, "Error saving Custom Worksheet to database", "Custom Worksheet");
                    Logger.Log(LogLevel.Debug, "SetLineItem.cmdCustom_Click", "Error Saving TaxLine/CustomWorksheet " + ex.ToString() + " . ");
                }
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }