/// <summary>
 /// Deprecated Method for adding a new object to the CLNMAS EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCLNMAS(CLNMA cLNMA)
 {
     base.AddObject("CLNMAS", cLNMA);
 }
 /// <summary>
 /// Create a new CLNMA object.
 /// </summary>
 /// <param name="client_ID">Initial value of the Client_ID property.</param>
 /// <param name="rowguid">Initial value of the rowguid property.</param>
 public static CLNMA CreateCLNMA(global::System.Int32 client_ID, global::System.Guid rowguid)
 {
     CLNMA cLNMA = new CLNMA();
     cLNMA.Client_ID = client_ID;
     cLNMA.rowguid = rowguid;
     return cLNMA;
 }
Esempio n. 3
0
        public void doClients(Form1 form, System.IO.DirectoryInfo migrationDir)
        {
            var files = migrationDir.GetFiles();
            DateTime myDM = DateTime.Now;
            foreach (var file in files)
            {
                form.updFileLabel(file.Name);
                try
                {
                    using (var t = new StreamReader(file.FullName))
                    {
                        string strOldID = "";
                        var bits = t.ReadToEnd();
                        dynamic json = JsonHelper.Decode(bits);
                        CLNMA item = new CLNMA()
                        {
                            UNIQUE = "AccuAuto",
                            DBA = file.Name,
                            DateMigrated = myDM,
                            CompanyName = json.DisplayName,
                            LNAME = json.Name.LastName,
                            FNAME = json.Name.FirstName,
                            MiddleName = json.Name.MiddleName,
                            SALUTATION = json.Name.Title,
                            SOURCE = json.Source,
                            CSTATUS = (json.ClientStatus == "Prospect") ? "P" : "A",
                        };
                        try
                        {
                            item.ADDRESS1 = json.Addresses[0].Line1;
                            item.CITY = json.Addresses[0].City;
                            item.STATE = json.Addresses[0].State;
                            item.ZIP = json.Addresses[0].Zip;
                            item.ADDRESS2 = json.Addresses[0].Line2;
                        }
                        catch { }
                        try
                        {
                            if (json.Contacts.Count > 0)
                            {
                                foreach (dynamic Contact in json.Contacts)
                                {
                                    if (Contact.ContactType == "HomePhone")
                                    {
                                        item.HPHONE = Contact.Value;
                                    }
                                    else if (Contact.ContactType == "WorkPhone")
                                    {
                                        item.WPHONE = Contact.Value;
                                    }
                                    else if (Contact.ContactType == "MobilePhone")
                                    {
                                        item.Cell = Contact.Value;
                                    }
                                    else if (Contact.ContactType == "Email")
                                    {
                                        item.Email = Contact.Value;
                                    }
                                }
                            }
                        }
                        catch { }
                        try
                        {
                            if (json.Comments != null)
                            {
                                if (json.Comments.Count > 0)
                                {
                                    item.datXDate = Convert.ToDateTime(json.Comments[0].ModifiedDate.Substring(0, 10));
                                    if (item.datXDate < Convert.ToDateTime("1800-01-01")) item.datXDate = null;
                                    item.strXDateComm = json.Comments[0].Text;
                                }
                            }
                        }
                        catch { }
                        try
                        {
                            item.isCOMMERCIAL = (json.ClientType == "Commercial");
                        }
                        catch { }
                        try
                        {
                            item.DOB = Convert.ToDateTime(json.BirthDate.Substring(0, 10));
                            if (item.DOB < Convert.ToDateTime("1800-01-01")) item.DOB = null;
                        }
                        catch { }
                        try
                        {
                            strOldID = json.OldId;
                        }
                        catch { }

                        db.CLNMAS.AddObject(item);
                        db.SaveChanges();
                        client.add(file.Name, item.Client_ID, strOldID);
                        if (item.Client_ID % 100 == 0) form.Refresh();
                    }
                }
                catch { }
            }
        }