public void AddCommandArguments(DsioNonVAItem item)
        {
            // Input Parameter are now IEN, NAME, TYP, ACT, PCON, ADDR, and PHONE where ADDR and PHONE
            //are lists used like WEBM SAVE PERSON with the exception of FAX as the fourth entry for PHONE.

//IEN,NAME,TYP,ACT,PCON,ADDR,PHONE
//;  ADDR = ARRAY OF LABELS: 1,2,3,CITY,STATE,ZIP
//; PHONE = ARRAY OF LABLES: H,MC,WP


            List <string> telParamList = new List <string>();

            if (item.TelephoneList != null)
            {
                foreach (DsioTelephone tel in item.TelephoneList)
                {
                    telParamList.Add(tel.ToParam());
                }
            }

            this.CommandArgs = new object[] {
                item.Ien,
                item.EntityName,
                item.EntityType,
                item.Inactive,
                item.PrimaryContact,
                item.Address.ToParameter(),
                telParamList.ToArray()
            };

            //List<string> argList = new List<string>();

            //if (string.IsNullOrWhiteSpace(item.OriginalEntityName))
            //    argList.Add(string.Format("NAME^{0}^{1}", item.EntityName, ""));
            //else if (item.OriginalEntityName != item.EntityName)
            //    argList.Add(string.Format("NAME^{0}^{1}", item.OriginalEntityName, item.EntityName));
            //else
            //    argList.Add(string.Format("NAME^{0}^{1}", item.OriginalEntityName, ""));

            //argList.Add(string.Format("TYPE^{0}", item.EntityType));
            //argList.Add(string.Format("INACTIVE^{0}", item.Inactive));
            //argList.Add(string.Format("PRIMARY CONTACT^{0}", item.PrimaryContact));
            //argList.Add(string.Format("STREET ADDRESS 1^{0}", item.AddressLine1));
            //argList.Add(string.Format("STREET ADDRESS 2^{0}", item.AddressLine2));
            //argList.Add(string.Format("CITY^{0}", item.City));
            //argList.Add(string.Format("STATE^{0}", item.State));
            //argList.Add(string.Format("ZIP CODE^{0}", item.Zip));
            //argList.Add(string.Format("PHONE NUMBER (OFFICE)^{0}", item.PhoneNumber));
            //argList.Add(string.Format("FAX NUMBER^{0}", item.FaxNumber));

            //string[] arg = argList.ToArray();

            //this.CommandArgs = new object[] { arg};
        }
Exemplo n.º 2
0
        //protected override void ProcessResponse()
        //{
        //    if (!string.IsNullOrWhiteSpace(this.Response.Data))
        //    {
        //        string piece1 = Util.Piece(this.Response.Lines[0], "^", 1);

        //        if (piece1 == "-1")
        //        {
        //            this.Response.InformationalMessage = Util.Piece(this.Response.Lines[0], Caret, 2);
        //            this.Response.Status = RpcResponseStatus.Fail;
        //        }
        //        else if (piece1 == "0")
        //        {
        //            this.Response.Status = RpcResponseStatus.Success;
        //            this.TotalResults = 0;
        //            this.Response.InformationalMessage = "Nothing Found";
        //        }
        //        else
        //        {
        //            string[] lines = this.Response.Lines;

        //            bool first = this.FirstLineIsCount;

        //            foreach (string line in lines)
        //            {
        //                // *** First line is total result ***
        //                if (first)
        //                {
        //                    int total = -1;
        //                    if (int.TryParse(line, out total))
        //                        this.TotalResults = total;
        //                    first = false;
        //                }
        //                else
        //                {
        //                    DsioNonVAItem entity = new DsioNonVAItem();

        //                    entity.Ien = Util.Piece(line, Caret, 1);
        //                    entity.EntityName = Util.Piece(line, Caret, 2);
        //                    entity.EntityType = Util.Piece(line, Caret, 3);
        //                    entity.Inactive = Util.Piece(line, Caret, 4);
        //                    entity.PrimaryContact = Util.Piece(line, Caret, 5);
        //                    entity.Address.StreetLine1 = Util.Piece(line, Caret, 6);
        //                    entity.Address.StreetLine2 = Util.Piece(line, Caret, 7);
        //                    entity.Address.City = Util.Piece(line, Caret, 9);
        //                    entity.Address.State = Util.Piece(line, Caret, 10);
        //                    entity.Address.ZipCode = Util.Piece(line, Caret, 11);

        //                    // 07/08/2014 : Pieces Re-ordered...

        //                    string tel = Util.Piece(line, Caret, 14);

        //                    if (!string.IsNullOrWhiteSpace(tel))
        //                        entity.TelephoneList.Add(new DsioTelephone() { Usage = DsioTelephone.WorkPhoneUsage, Number = tel });

        //                    string fax = Util.Piece(line, Caret, 15);

        //                    if (!string.IsNullOrWhiteSpace(fax))
        //                        entity.TelephoneList.Add(new DsioTelephone() { Usage = DsioTelephone.FaxUsage, Number = fax });


        //                    this.NonVAEntities.Add(entity);

        //                    if (!this.FirstLineIsCount)
        //                        this.TotalResults += 1;
        //                }
        //            }

        //            this.Response.Status = RpcResponseStatus.Success;
        //        }
        //    }
        //}

        protected override void ProcessLine(string line)
        {
            DsioNonVAItem entity = new DsioNonVAItem();

            entity.Ien                 = Util.Piece(line, Caret, 1);
            entity.EntityName          = Util.Piece(line, Caret, 2);
            entity.EntityType          = Util.Piece(line, Caret, 3);
            entity.Inactive            = Util.Piece(line, Caret, 4);
            entity.PrimaryContact      = Util.Piece(line, Caret, 5);
            entity.Address.StreetLine1 = Util.Piece(line, Caret, 6);
            entity.Address.StreetLine2 = Util.Piece(line, Caret, 7);
            entity.Address.City        = Util.Piece(line, Caret, 9);
            entity.Address.State       = Util.Piece(line, Caret, 10);
            entity.Address.ZipCode     = Util.Piece(line, Caret, 11);

            // 07/08/2014 : Pieces Re-ordered...

            string tel = Util.Piece(line, Caret, 13);

            if (!string.IsNullOrWhiteSpace(tel))
            {
                entity.TelephoneList.Add(new DsioTelephone()
                {
                    Usage = DsioTelephone.WorkPhoneUsage, Number = tel
                });
            }

            string fax = Util.Piece(line, Caret, 15);

            if (!string.IsNullOrWhiteSpace(fax))
            {
                entity.TelephoneList.Add(new DsioTelephone()
                {
                    Usage = DsioTelephone.FaxUsage, Number = fax
                });
            }

            if (this.NonVAEntities == null)
            {
                this.NonVAEntities = new List <DsioNonVAItem>();
            }

            this.NonVAEntities.Add(entity);
        }