示例#1
0
        ///<summary>Returns true if the communications were successful, and false if they failed. If they failed, a rollback will happen automatically by deleting the previously created X12 file. The batchnum is supplied for the possible rollback.  Also used for mail retrieval.</summary>
        public static bool Launch(Clearinghouse clearhouse, int batchNum)
        {
            string arguments = "";

            try{
                if (!Directory.Exists(clearhouse.ExportPath))
                {
                    throw new Exception("Clearinghouse export path is invalid.");
                }
                if (!Directory.Exists(clearhouse.ResponsePath))
                {
                    throw new Exception("Clearinghouse response path is invalid.");
                }
                if (!File.Exists(clearhouse.ClientProgram))
                {
                    throw new Exception("Client program not installed properly.");
                }
                arguments = clearhouse.ExportPath + "*.* "  //upload claims path
                            + clearhouse.ResponsePath + " " //Mail path
                            + "316 "                        //vendor number.
                            + clearhouse.LoginID + " "      //Client number. Assigned by us, and we have to coordinate for all other 'vendors' of Open Dental, because there is only one vendor number for OD for now.
                            + clearhouse.Password;
                //call the WebMD client program
                Process process = Process.Start(clearhouse.ClientProgram, arguments);
                process.EnableRaisingEvents = true;
                process.WaitForExit();
                //delete the uploaded claims
                string[] files = Directory.GetFiles(clearhouse.ExportPath);
                for (int i = 0; i < files.Length; i++)
                {
                    //string t=files[i];
                    File.Delete(files[i]);
                }
                //rename the downloaded mail files to end with txt
                files = Directory.GetFiles(clearhouse.ResponsePath);
                for (int i = 0; i < files.Length; i++)
                {
                    //string t=files[i];
                    if (Path.GetExtension(files[i]) != ".txt")
                    {
                        File.Move(files[i], files[i] + ".txt");
                    }
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);                //+"\r\n"+clearhouse.ClientProgram+" "+arguments);
                X12.Rollback(clearhouse, batchNum);
                return(false);
            }
            return(true);
        }
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="Rest.ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (AS2 != null)
     {
         AS2.Validate();
     }
     if (X12 != null)
     {
         X12.Validate();
     }
     if (Edifact != null)
     {
         Edifact.Validate();
     }
 }
示例#3
0
        ///<summary>Returns a string describing all missing data on this claim.  Claim will not be allowed to be sent electronically unless this string comes back empty.</summary>
        public static string GetMissingData(ClaimSendQueueItem queueItem)
        {
            Clearinghouse clearhouse = Clearinghouses.GetClearinghouse(queueItem.ClearinghouseNum);

            if (clearhouse.Eformat == ElectronicClaimFormat.X12)
            {
                return(X12.GetMissingData(queueItem));
            }
            else if (clearhouse.Eformat == ElectronicClaimFormat.Renaissance)
            {
                return(Renaissance.GetMissingData(queueItem));
            }
            else if (clearhouse.Eformat == ElectronicClaimFormat.Canadian)
            {
                return(Canadian.GetMissingData(queueItem));
            }
            return("");
        }
示例#4
0
文件: ninject.cs 项目: szloveni/di
class X20 { public X20(X10 p1, X11 p2, X12 p3, X13 p4, X14 p5, X15 p6, X16 p7, X17 p8, X18 p9, X19 p10)
            {
            }
示例#5
0
文件: ninject.cs 项目: szloveni/di
class X19 { public X19(X09 p1, X10 p2, X11 p3, X12 p4, X13 p5, X14 p6, X15 p7, X16 p8, X17 p9, X18 p10)
            {
            }
示例#6
0
文件: ninject.cs 项目: szloveni/di
class X18 { public X18(X08 p1, X09 p2, X10 p3, X11 p4, X12 p5, X13 p6, X14 p7, X15 p8, X16 p9, X17 p10)
            {
            }
示例#7
0
文件: ninject.cs 项目: szloveni/di
class X17 { public X17(X07 p1, X08 p2, X09 p3, X10 p4, X11 p5, X12 p6, X13 p7, X14 p8, X15 p9, X16 p10)
            {
            }
示例#8
0
文件: ninject.cs 项目: szloveni/di
class X16 { public X16(X06 p1, X07 p2, X08 p3, X09 p4, X10 p5, X11 p6, X12 p7, X13 p8, X14 p9, X15 p10)
            {
            }
示例#9
0
文件: ninject.cs 项目: szloveni/di
class X15 { public X15(X05 p1, X06 p2, X07 p3, X08 p4, X09 p5, X10 p6, X11 p7, X12 p8, X13 p9, X14 p10)
            {
            }
示例#10
0
        ///<summary>Supply an arrayList of type ClaimSendQueueItem. Called from FormClaimSend.  Can send to multiple clearinghouses simultaneously.</summary>
        public static void SendBatches(ArrayList queueItems)
        {
            //claimsByCHouse is of type ClaimSendQueueItem
            ArrayList[] claimsByCHouse = new ArrayList[Clearinghouses.List.Length];
            for (int i = 0; i < claimsByCHouse.Length; i++)
            {
                claimsByCHouse[i] = new ArrayList();
            }
            //divide the items by clearinghouse:
            for (int i = 0; i < queueItems.Count; i++)
            {
                claimsByCHouse[Clearinghouses.GetIndex(((ClaimSendQueueItem)queueItems[i]).ClearinghouseNum)]
                .Add(queueItems[i]);
            }
            //for any clearinghouses with claims, send them:
            int  batchNum;
            bool result = true;

            for (int i = 0; i < claimsByCHouse.Length; i++)
            {
                if (claimsByCHouse[i].Count == 0)
                {
                    continue;
                }
                //get next batch number for this clearinghouse
                batchNum = Clearinghouses.GetNextBatchNumber(Clearinghouses.List[i]);
                //---------------------------------------------------------------------------------------
                //Create the claim file(s) for this clearinghouse
                if (Clearinghouses.List[i].Eformat == ElectronicClaimFormat.X12)
                {
                    result = X12.SendBatch(claimsByCHouse[i], batchNum);
                }
                else if (Clearinghouses.List[i].Eformat == ElectronicClaimFormat.Renaissance)
                {
                    result = Renaissance.SendBatch(claimsByCHouse[i], batchNum);
                }
                else if (Clearinghouses.List[i].Eformat == ElectronicClaimFormat.Canadian)
                {
                    //Canadian is a little different because we need the sequence numbers.
                    //So all programs are launched and statuses changed from within Canadian.SendBatch()
                    //We don't care what the result is.
                    Canadian.SendBatch(claimsByCHouse[i], batchNum);
                    continue;
                }
                else
                {
                    result = false;         //(ElectronicClaimFormat.None does not get sent)
                }
                if (!result)                //if failed to create claim file properly,
                {
                    continue;               //don't launch program or change claim status
                }
                //----------------------------------------------------------------------------------------
                //Launch Client Program for this clearinghouse if applicable
                if (Clearinghouses.List[i].CommBridge == EclaimsCommBridge.None)
                {
                    AttemptLaunch(Clearinghouses.List[i], batchNum);
                }
                else if (Clearinghouses.List[i].CommBridge == EclaimsCommBridge.WebMD)
                {
                    if (!WebMD.Launch(Clearinghouses.List[i], batchNum))
                    {
                        MessageBox.Show(Lan.g("Eclaims", "Error sending."));
                        continue;
                    }
                }
                else if (Clearinghouses.List[i].CommBridge == EclaimsCommBridge.BCBSGA)
                {
                    if (!BCBSGA.Launch(Clearinghouses.List[i], batchNum))
                    {
                        MessageBox.Show(Lan.g("Eclaims", "Error sending."));
                        continue;
                    }
                }
                else if (Clearinghouses.List[i].CommBridge == EclaimsCommBridge.Renaissance)
                {
                    AttemptLaunch(Clearinghouses.List[i], batchNum);
                }
                else if (Clearinghouses.List[i].CommBridge == EclaimsCommBridge.ClaimConnect)
                {
                    if (!WebClaim.Launch(Clearinghouses.List[i], batchNum))
                    {
                        MessageBox.Show(Lan.g("Eclaims", "Error sending."));
                        continue;
                    }
                }
                else if (Clearinghouses.List[i].CommBridge == EclaimsCommBridge.RECS)
                {
                    if (!RECS.Launch(Clearinghouses.List[i], batchNum))
                    {
                        MessageBox.Show("Claim file created, but could not launch RECS client.");
                        //continue;
                    }
                }
                else if (Clearinghouses.List[i].CommBridge == EclaimsCommBridge.Inmediata)
                {
                    if (!Inmediata.Launch(Clearinghouses.List[i], batchNum))
                    {
                        MessageBox.Show("Claim file created, but could not launch Inmediata client.");
                        //continue;
                    }
                }
                else if (Clearinghouses.List[i].CommBridge == EclaimsCommBridge.AOS)               // added by SPK 7/13/05
                {
                    if (!AOS.Launch(Clearinghouses.List[i], batchNum))
                    {
                        MessageBox.Show("Claim file created, but could not launch AOS Communicator.");
                        //continue;
                    }
                }
                else if (Clearinghouses.List[i].CommBridge == EclaimsCommBridge.PostnTrack)
                {
                    AttemptLaunch(Clearinghouses.List[i], batchNum);
                    //if(!PostnTrack.Launch(Clearinghouses.List[i],batchNum)){
                    //	MessageBox.Show("Claim file created, but could not launch AOS Communicator.");
                    //continue;
                    //}
                }
                //----------------------------------------------------------------------------------------
                //finally, mark the claims sent. (only if not Canadian)
                EtransType etype = EtransType.ClaimSent;
                if (Clearinghouses.List[i].Eformat == ElectronicClaimFormat.Renaissance)
                {
                    etype = EtransType.Claim_Ren;
                }
                if (Clearinghouses.List[i].Eformat != ElectronicClaimFormat.Canadian)
                {
                    for (int j = 0; j < claimsByCHouse[i].Count; j++)
                    {
                        Etranss.SetClaimSentOrPrinted(((ClaimSendQueueItem)claimsByCHouse[i][j]).ClaimNum,
                                                      ((ClaimSendQueueItem)claimsByCHouse[i][j]).PatNum,
                                                      Clearinghouses.List[i].ClearinghouseNum, etype);
                    }
                }
            }            //for(int i=0;i<claimsByCHouse.Length;i++){
        }
示例#11
0
文件: ninject.cs 项目: szloveni/di
class X13 { public X13(X03 p1, X04 p2, X05 p3, X06 p4, X07 p5, X08 p6, X09 p7, X10 p8, X11 p9, X12 p10)
            {
            }
示例#12
0
        ///<summary>Returns true if the communications were successful, and false if they failed. If they failed, a rollback will happen automatically by deleting the previously created X12 file. The batchnum is supplied for the possible rollback.</summary>
        public static bool Launch(Clearinghouse clearhouse, int batchNum)
        {
            bool         retVal = true;
            FormTerminal FormT  = new FormTerminal();

            try{
                FormT.Show();
                FormT.OpenConnection(clearhouse.ModemPort);
                //1. Dial
                FormT.Dial("17065713158");
                //2. Wait for connect, then pause 3 seconds
                FormT.WaitFor("CONNECT 9600", 50000);
                FormT.Pause(3000);
                FormT.ClearRxBuff();
                //3. Send Submitter login record
                string submitterLogin =
                    //position,length indicated for each
                    "/SLRON"                                 //1,6 /SLRON=Submitter login
                    + FormT.Sout(clearhouse.LoginID, 12, 12) //7,12 Submitter ID
                    + FormT.Sout(clearhouse.Password, 8, 8)  //19,8 submitter password
                    + "NAT"                                  //27,3 use NAT
                                                             //30,8 suggested 8-BYTE CRC of the file for unique ID. No spaces.
                                                             //But I used the batch number instead
                    + batchNum.ToString().PadLeft(8, '0')
                    + "ANSI837D  1    "                      //38,15 "ANSI837D  1    "=Dental claims
                    + "X"                                    //53,1 X=Xmodem, or Y for transmission protocol
                    + "ANSI"                                 //54,4 use ANSI
                    + "BCS"                                  //58,3 BCS=BlueCrossBlueShield
                    + "00";                                  //61,2 use 00 for filler
                FormT.Send(submitterLogin);
                //4. Receive Y, indicating login accepted
                if (FormT.WaitFor("Y", "N", 20000) == "Y")
                {
                    //5. Wait 1 second.
                    FormT.Pause(1000);
                }
                else
                {
                    //6. If login rejected, receive an N,
                    //followed by Transmission acknowledgement explaining
                    throw new Exception(FormT.Receive(5000));
                }
                //7. Send file using X-modem or Z-modem
                FormT.UploadXmodem(clearhouse.ExportPath + "claims" + batchNum.ToString() + ".txt");
                //8. After transmitting, pause for 1 second.
                FormT.Pause(1000);
                FormT.ClearRxBuff();
                //9. Send submitter logout record
                string submitterLogout =
                    "/SLROFF"                                //1,7 /SLROFF=Submitter logout
                    + FormT.Sout(clearhouse.LoginID, 12, 12) //8,12 Submitter ID
                    + batchNum.ToString().PadLeft(8, '0')    //20,8 matches field in submitter Login
                    + "!"                                    //28,1 use ! to retrieve transmission acknowledgement record
                    + "\r\n";
                FormT.Send(submitterLogout);
                //10. Prepare to receive the Transmission acknowledgement.  This is a receipt.
                FormT.Receive(5000);//this is displayed in the progress box so user can see.
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                X12.Rollback(clearhouse, batchNum);
                retVal = false;
            }
            finally{
                FormT.CloseConnection();
            }
            return(retVal);
        }
示例#13
0
        ///<summary>Returns true if the communications were successful, and false if they failed. If they failed, a rollback will happen automatically by deleting the previously created X12 file. The batchnum is supplied for the possible rollback.</summary>
        public static bool Launch(Clearinghouse clearhouse, int batchNum)
        {
            try{
                //Step 1: Post authentication request:
                Version        myVersion = new Version(Application.ProductVersion);
                HttpWebRequest webReq;
                WebResponse    response;
                StreamReader   readStream;
                string         str;
                string[]       responseParams;
                string         status     = "";
                string         group      = "";
                string         userid     = "";
                string         authid     = "";
                string         errormsg   = "";
                string         alertmsg   = "";
                string         curParam   = "";
                string         serverName =       //"https://prelive.dentalxchange.com/dci/upload.svl";
                                            "https://claimconnect.dentalxchange.com/dci/upload.svl";
                webReq = (HttpWebRequest)WebRequest.Create(serverName);
                string postData =
                    "Function=Auth"                   //CONSTANT; signifies that this is an authentication request
                    + "&Source=EDI"                   //CONSTANT; file format
                    + "&Username="******"&Password="******"&UploaderName=OpenDental"                                                           //CONSTANT
                    + "&UploaderVersion=" + myVersion.Major.ToString() + "." + myVersion.Minor.ToString(); //eg 3.4
                webReq.KeepAlive     = false;
                webReq.Method        = "POST";
                webReq.ContentType   = "application/x-www-form-urlencoded";
                webReq.ContentLength = postData.Length;
                ASCIIEncoding encoding  = new ASCIIEncoding();
                byte[]        bytes     = encoding.GetBytes(postData);
                Stream        streamOut = webReq.GetRequestStream();
                streamOut.Write(bytes, 0, bytes.Length);
                streamOut.Close();
                response = webReq.GetResponse();
                //Process the authentication response:
                readStream = new StreamReader(response.GetResponseStream(), Encoding.ASCII);
                str        = readStream.ReadToEnd();
                readStream.Close();
                //MessageBox.Show(str);
                responseParams = str.Split('&');
                for (int i = 0; i < responseParams.Length; i++)
                {
                    curParam = GetParam(responseParams[i]);
                    switch (curParam)
                    {
                    case "Status":
                        status = GetParamValue(responseParams[i]);
                        break;

                    case "GROUP":
                        group = GetParamValue(responseParams[i]);
                        break;

                    case "UserID":
                        userid = GetParamValue(responseParams[i]);
                        break;

                    case "AuthenticationID":
                        authid = GetParamValue(responseParams[i]);
                        break;

                    case "ErrorMessage":
                        errormsg = GetParamValue(responseParams[i]);
                        break;

                    case "AlertMessage":
                        alertmsg = GetParamValue(responseParams[i]);
                        break;

                    default:
                        throw new Exception("Unexpected parameter: " + curParam);
                    }
                }
                //Process response for errors:
                if (alertmsg != "")
                {
                    MessageBox.Show(alertmsg);
                }
                switch (status)
                {
                case "0":
                    //MessageBox.Show("Authentication successful.");
                    break;

                case "1":
                    throw new Exception("Authentication failed. " + errormsg);

                case "2":
                    throw new Exception("Cannot authenticate at this time. " + errormsg);

                case "3":
                    throw new Exception("Invalid authentication request. " + errormsg);

                case "4":
                    throw new Exception("Invalid program version. " + errormsg);

                case "5":
                    throw new Exception("No customer contract. " + errormsg);
                }
                //Step 2: Post upload request:
                string fileName = Directory.GetFiles(clearhouse.ExportPath)[0];
                string boundary = "------------7d13e425b00d0";
                postData =
                    "--" + boundary + "\r\n"
                    + "Content-Disposition: form-data; name=\"Function\"\r\n"
                    + "\r\n"
                    + "Upload\r\n"
                    + "--" + boundary + "\r\n"
                    + "Content-Disposition: form-data; name=\"Source\"\r\n"
                    + "\r\n"
                    + "EDI\r\n"
                    + "--" + boundary + "\r\n"
                    + "Content-Disposition: form-data; name=\"AuthenticationID\"\r\n"
                    + "\r\n"
                    + authid + "\r\n"
                    + "--" + boundary + "\r\n"
                    + "Content-Disposition: form-data; name=\"File\"; filename=\""
                    + fileName + "\"\r\n"
                    + "Content-Type: text/plain\r\n"
                    + "\r\n";
                using (StreamReader sr = new StreamReader(fileName)){
                    postData += sr.ReadToEnd() + "\r\n"
                                + "--" + boundary + "--";
                }
                //Debug.Write(postData);
                //MessageBox.Show(postData);
                webReq               = (HttpWebRequest)WebRequest.Create(serverName);
                webReq.KeepAlive     = false;
                webReq.Method        = "POST";
                webReq.ContentType   = "multipart/form-data; boundary=" + boundary;
                webReq.ContentLength = postData.Length;
                bytes     = encoding.GetBytes(postData);
                streamOut = webReq.GetRequestStream();
                streamOut.Write(bytes, 0, bytes.Length);
                streamOut.Close();
                response = webReq.GetResponse();
                //Process the response
                readStream = new StreamReader(response.GetResponseStream(), Encoding.ASCII);
                str        = readStream.ReadToEnd();
                readStream.Close();
                errormsg = "";
                status   = "";
                str      = str.Replace("\r\n", "");
                Debug.Write(str);
                if (str.Length > 300)
                {
                    throw new Exception("Unknown lengthy error message received.");
                }
                responseParams = str.Split('&');
                for (int i = 0; i < responseParams.Length; i++)
                {
                    curParam = GetParam(responseParams[i]);
                    switch (curParam)
                    {
                    case "Status":
                        status = GetParamValue(responseParams[i]);
                        break;

                    case "ErrorMessage":
                        errormsg = GetParamValue(responseParams[i]);
                        break;

                    case "Filename":
                    case "Timestamp":
                        break;

                    case "":                            //errorMessage blank
                        break;

                    default:
                        throw new Exception("Unexpected parameter: " + curParam + "*");
                    }
                }
                switch (status)
                {
                case "0":
                    MessageBox.Show("Upload successful.");
                    break;

                case "1":
                    throw new Exception("Authentication failed. " + errormsg);

                case "2":
                    throw new Exception("Cannot upload at this time. " + errormsg);
                }
                //delete the uploaded claim
                File.Delete(fileName);
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
                X12.Rollback(clearhouse, batchNum);
                return(false);
            }
            return(true);
        }
示例#14
0
        private void button1_Click(object sender, EventArgs e)
        {
            button2.Visible = true;
            button3.Visible = true;
            button4.Visible = true;
            dataGridView2.Rows.Clear();
            for (int c = 0; c < 4; c++)
            {
                for (int r = 0; r < 5; r++)
                {
                    dataGridView1[c, r].Value           = String.Empty;
                    dataGridView1[c, r].Style.BackColor = Color.White;
                }
            }

            for (int r = 0; r < 12; r++)
            {
                dataGridView2.Rows.Add();
                dataGridView2.Rows[r].HeaderCell.Value = (r + 1).ToString();
            }

            X1  = dateTimePicker1.Value.Day;
            X2  = (X1 % 10);
            X1  = (X1 / 10);
            X3  = dateTimePicker1.Value.Month;
            X4  = (X3 % 10);
            X3  = (X3 / 10);
            X5  = dateTimePicker1.Value.Year;
            X6  = (X5 % 1000) / 100;
            X7  = (X5 % 100) / 10;
            X8  = (X5 % 10);
            X5  = (X5 / 1000);
            X9  = X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8;
            X10 = (X9 % 10) + (X9 / 10);
            X11 = X9 - (X1 * 2);
            X12 = (X11 % 10) + (X11 / 10);
            X13 = X9 + X11;
            X14 = X10 + X12;

            textBox1.Text = X9.ToString();
            textBox2.Text = X10.ToString();
            textBox3.Text = X11.ToString();
            textBox4.Text = X12.ToString();
            textBox5.Text = X13.ToString();
            textBox6.Text = X14.ToString();

            bigN = dateTimePicker1.Value.ToShortDateString() + textBox1.Text +
                   textBox2.Text + textBox3.Text + textBox4.Text;
            smlN = textBox5.Text + textBox6.Text;

            Calc(0);

            for (int i = 0; i < 3; i++)
            {
                bn = 0; sn = 0;
                for (int j = 1; j < 4; j++)
                {
                    Calc(i * 3 + j);
                }
                if (bn > 12)
                {
                    bn = (bn % 10) + (bn / 10);
                }
                if (sn > 12)
                {
                    sn = (sn % 10) + (sn / 10);
                }
                dataGridView1[3, i + 1].Value = bn.ToString() + '(' + sn.ToString() + ')';
            }

            for (int i = 10; i < 13; i++)
            {
                if ((i == X13) || (i == X14))
                {
                    switch (i)
                    {
                    case 10:
                        dataGridView1[0, 4].Value           = "(10)";
                        dataGridView1[0, 4].Style.BackColor = Color.Blue;
                        break;

                    case 11:
                        dataGridView1[1, 4].Value           = "(11)";
                        dataGridView1[1, 4].Style.BackColor = Color.Blue;
                        break;

                    case 12:
                        dataGridView1[2, 4].Value           = "(12)";
                        dataGridView1[2, 4].Style.BackColor = Color.Blue;
                        break;
                    }
                    dataGridView1[3, 4].Value = '(' + i.ToString() + ')';
                }
            }

            BigTable();
            GrafMake();
        }
示例#15
0
文件: ninject.cs 项目: szloveni/di
class X21 { public X21(X11 p1, X12 p2, X13 p3, X14 p4, X15 p5, X16 p6, X17 p7, X18 p8, X19 p9, X20 p10)
            {
            }
示例#16
0
文件: ninject.cs 项目: szloveni/di
class X22 { public X22(X12 p1, X13 p2, X14 p3, X15 p4, X16 p5, X17 p6, X18 p7, X19 p8, X20 p9, X21 p10)
            {
            }
示例#17
0
文件: ninject.cs 项目: szloveni/di
class X14 { public X14(X04 p1, X05 p2, X06 p3, X07 p4, X08 p5, X09 p6, X10 p7, X11 p8, X12 p9, X13 p10)
            {
            }