Exemplo n.º 1
0
 public static List <Address> GetAddresses(string crmID)
 {
     try
     {
         string         type      = DiscoverType(crmID);
         List <Address> addresses = new List <Address>();
         DataTable      xlReader  = XLSQL.ReturnTable("Select * from [XLant].[dbo].[Addresses] ('" + crmID + "','" + type + "')");
         if (xlReader.Rows.Count != 0)
         {
             foreach (DataRow row in xlReader.Rows)
             {
                 addresses.Add(new Address(Convert.ToBoolean(row["IsPrimary"].ToString()), row["address1"].ToString(), row["address2"].ToString(), row["address3"].ToString(), row["address4"].ToString(), row["address5"].ToString(), row["postcode"].ToString()));
             }
             return(addresses);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-GetAddresses", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 2
0
 public static List <EntityCouplet> AllClients(bool activeOnly = true)
 {
     try
     {
         List <EntityCouplet> group = new List <EntityCouplet>();
         string query = "SELECT clientcode, name from client";
         if (activeOnly)
         {
             query = query + " where status in ('Active', 'New')";
         }
         query = query + " order by clientcode";
         DataTable xlReader = XLSQL.ReturnTable(query);
         if (xlReader.Rows.Count != 0)
         {
             foreach (DataRow row in xlReader.Rows)
             {
                 group.Add(new EntityCouplet(row["clientcode"].ToString(), row["clientcode"].ToString() + " - " + row["name"].ToString()));
             }
         }
         return(group);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-AllClients", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 3
0
 public static List <EmailAddress> GetEmails(string crmID)
 {
     try
     {
         string type = DiscoverType(crmID);
         List <EmailAddress> emails   = new List <EmailAddress>();
         DataTable           xlReader = XLSQL.ReturnTable("Select * from Emails where CRMID='" + crmID + "'and module='" + type + "' and deleted=0");
         if (xlReader.Rows.Count != 0)
         {
             foreach (DataRow row in xlReader.Rows)
             {
                 string crmid     = row["crmid"].ToString();
                 string email     = row["email"].ToString();
                 bool   isPrimary = Convert.ToBoolean(row["isprimary"]);
                 bool   doNotMail = Convert.ToBoolean(row["donotmail"]);
                 emails.Add(new EmailAddress(crmid, email, email, isPrimary, doNotMail));
             }
         }
         return(emails);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-GetEmails", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 4
0
 public static List <Client> Clients(string id)
 {
     try
     {
         string        type       = DiscoverType(id);
         List <Client> group      = new List <Client>();
         Client        tempClient = null;
         DataTable     xlReader   = XLSQL.ReturnTable("SELECT * from Connections('" + id + "', '" + type + "') where contacttype='Client' and ISNULL(contactid,'')!=''");
         if (xlReader.Rows.Count != 0)
         {
             foreach (DataRow row in xlReader.Rows)
             {
                 tempClient = Client.FetchClient(row["crmid"].ToString());
                 tempClient.relationship = row["reldesc"].ToString();
                 group.Add(tempClient);
             }
         }
         return(group);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-Clients", ex.ToString());
         return(null);
     }
 }
 public static XLMain.Client GetClientFromIndex(string fileID)
 {
     try
     {
         FileInfo info      = FileIndex(fileID);
         string   clientStr = "";
         foreach (IndexPair pair in info.Indexes)
         {
             if (pair.index == "INDEX02")
             {
                 clientStr = pair.value;
                 //once we have found what we want we need not look at other indexes
                 break;
             }
         }
         clientStr = clientStr.Substring(0, clientStr.IndexOf("-"));
         XLMain.Client client = new XLMain.Client();
         client = XLMain.Client.FetchClientFromCode(clientStr.TrimEnd());
         return(client);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLVC-ClientInfofromIndex", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 6
0
 public static Staff FetchStaff(string iD)
 {
     try
     {
         Staff     staff    = new Staff();
         DataTable xlReader = XLSQL.ReturnTable("Select * from Staff where crmID='" + iD + "'");
         if (xlReader.Rows.Count == 1)
         {
             staff.crmID        = xlReader.Rows[0]["crmid"].ToString();
             staff.relationship = ""; //Only used in collections
             staff.username     = xlReader.Rows[0]["username"].ToString();
             staff.name         = xlReader.Rows[0]["fullname"].ToString();
             staff.initials     = xlReader.Rows[0]["initials"].ToString();
             staff.department   = xlReader.Rows[0]["department"].ToString();
             staff.office       = xlReader.Rows[0]["office"].ToString();
             staff.grade        = xlReader.Rows[0]["grade"].ToString();
             staff.emails       = EmailAddress.GetEmails(staff.crmID);
             staff.addresses    = Address.GetAddresses(staff.crmID);
             staff.salutations  = Salutation.GetSalutations(staff.crmID);
             staff.numbers      = Number.GetNumbers(staff.crmID);
         }
         return(staff);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-FetchStaff", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 7
0
 public static DataTable ReturnTable(string query, string param1 = null, string param2 = null)
 {
     try
     {
         SqlDataReader xLReader    = null;
         DataTable     xlDataTable = new DataTable();
         using (SqlConnection xlConnection = ConnecttoSQL())
         {
             using (SqlCommand xLCommand = new SqlCommand(query, xlConnection))
             {
                 if (param1 != null)
                 {
                     xLCommand.Parameters.AddWithValue("param1", param1);
                     if (param2 != null)
                     {
                         xLCommand.Parameters.AddWithValue("param2", param2);
                     }
                 }
                 xLReader = xLCommand.ExecuteReader();
                 xlDataTable.Load(xLReader);
                 return(xlDataTable);
             }
         }
     }
     catch (Exception e)
     {
         XLtools.LogException("XLSQL-Returntable", e.ToString());
         return(null);
     }
 }
 public static List <IndexList> SectionLists(string office, string department, string sectionValue)
 {
     try
     {
         string           fileStore = FileStore(office, department);
         DataTable        xlReader  = XLSQL.ReturnTable("SELECT Label, ListId, indexno FROM [XLant].[dbo].[VCSectionValuesView] where CabinetName='" + fileStore + "' and SectionValue='" + sectionValue + "' and label is not null order by Listid");
         List <IndexList> lists     = new List <IndexList>();
         if (xlReader.Rows.Count != 0)
         {
             foreach (DataRow row in xlReader.Rows)
             {
                 IndexList iList = new IndexList();
                 iList.name  = row["Label"].ToString();
                 iList.index = row["IndexNo"].ToString();
                 DataTable     listReader = XLSQL.ReturnTable("SELECT Value FROM [XLant].[dbo].[VCListsView] where ListId='" + row["ListId"].ToString() + "' order by Value");
                 List <string> list       = new List <string>();
                 if (listReader.Rows.Count != 0)
                 {
                     foreach (DataRow r in listReader.Rows)
                     {
                         list.Add(r["Value"].ToString());
                     }
                 }
                 iList.items = list;
                 lists.Add(iList);
             }
         }
         return(lists);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLVC-SectionLists", ex.ToString());
         return(null);
     }
 }
        public static String UpdateIndexField(string fileID, string index, string newData)
        {
            try
            {
                //get temp path and create a file to fill with our commands
                string tempPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\XLant\\temp\\";

                if (!Directory.Exists(tempPath))
                {
                    Directory.CreateDirectory(tempPath);
                }

                string commandFileLoc = tempPath + "VC.command";

                StreamWriter sw   = new StreamWriter(commandFileLoc, false, System.Text.Encoding.Default);
                string       text = "<<SET " + index + "='" + newData + "'";
                text += " WHERE INDEX01='" + fileID + "'>>";
                sw.WriteLine(text);


                sw.Flush();
                sw.Close();

                return(commandFileLoc);
            }
            catch (Exception ex)
            {
                XLtools.LogException("XLVC-UpdateIndexField", ex.ToString());
                return(null);
            }
        }
Exemplo n.º 10
0
        public static bool RunCommand(string query, List <SqlParameter> parameterCollection)
        {
            try
            {
                int i = 0;
                using (SqlConnection xlConnection = ConnecttoSQL())
                {
                    using (SqlCommand xLCommand = new SqlCommand(query, xlConnection))
                    {
                        if (parameterCollection != null)
                        {
                            foreach (SqlParameter p in parameterCollection)
                            {
                                xLCommand.Parameters.Add(p);
                            }
                        }

                        i = xLCommand.ExecuteNonQuery();
                    }
                }
                return(true);
            }
            catch (Exception e)
            {
                XLtools.LogException("XLSQL-RunCommand", e.ToString());
                return(false);
            }
        }
Exemplo n.º 11
0
        private static string BuildCommandFile(string docPath, FileInfo fileInfo)
        {
            try
            {
                //blanked in an attempt to handle the weird random saving
                string tempPath = "";
                tempPath = XLtools.TempPath();

                string commandFileLoc = tempPath + "VC.command";

                //Create stream and add to file.
                StreamWriter sw = new StreamWriter(commandFileLoc, false, System.Text.Encoding.Default);
                sw.WriteLine("<<MODE=FILE>>");
                sw.WriteLine("<<FILE=" + docPath + ">>");
                sw.WriteLine("<<LEVEL01=" + fileInfo.Cabinet + ">>");
                foreach (IndexPair i in fileInfo.Indexes)
                {
                    sw.WriteLine("<<" + i.index + "=" + i.value + ">>");
                }
                sw.Flush();
                sw.Close();

                //return the location of our new command file.
                return(commandFileLoc);
            }
            catch (Exception ex)
            {
                XLtools.LogException("XLVC-BuildCommandFile with FileInfo", ex.ToString());
                return(null);
            }
        }
Exemplo n.º 12
0
            public static Organisation FetchOrganisation(string iD)
            {
                try
                {
                    //Get contact data from Organisation
                    Organisation org      = new Organisation();
                    DataTable    xlReader = XLSQL.ReturnTable("Select * from Organisations where CRMID='" + iD + "'");
                    if (xlReader.Rows.Count == 1)
                    {
                        org.crmID = iD;
                        org.name  = xlReader.Rows[0]["name"].ToString();

                        //Addresses
                        org.addresses = Address.GetAddresses(org.crmID);
                        //Numbers
                        org.numbers = Number.GetNumbers(org.crmID);
                    }
                    return(org);
                }
                catch (Exception ex)
                {
                    XLtools.LogException("XLMain-FetchOrganisation", ex.ToString());
                    return(null);
                }
            }
Exemplo n.º 13
0
 public static List <Contact> Contacts(string id)
 {
     try
     {
         string         type     = DiscoverType(id);
         List <Contact> contacts = new List <Contact>();
         DataTable      xlReader = XLSQL.ReturnTable("SELECT * from Connections('" + id + "', '" + type + "') where contacttype='Contact' and ISNULL(contactid,'')!=''");
         if (xlReader.Rows.Count != 0)
         {
             foreach (DataRow row in xlReader.Rows)
             {
                 Contact cont = Contact.FetchContact(row["contact_id"].ToString());
                 cont.relationship = row["reldesc"].ToString();
                 contacts.Add(cont);
             }
         }
         contacts.Sort();
         return(contacts);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-Contacts", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 14
0
        public static String Reindex(string fileID, string sender = "", string status = null, string docDate = null)
        {
            try
            {
                //get temp path and create a file to fill with our commands
                string tempPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\XLant\\temp\\";

                if (!Directory.Exists(tempPath))
                {
                    Directory.CreateDirectory(tempPath);
                }

                string commandFileLoc = tempPath + "VC.command";
                string statusIndex    = "";
                string toBeIndex      = "";

                XDocument settingsDoc           = XLtools.settingsDoc;
                IEnumerable <XElement> xIndexes = settingsDoc.Descendants("Indexes");

                foreach (XElement xIndex in xIndexes.Descendants("Index"))
                {
                    if (xIndex.AttributeValueNull("Type") == "Status")
                    {
                        statusIndex = xIndex.ElementValueNull();
                    }
                    else if (xIndex.AttributeValueNull("Type") == "ToBe")
                    {
                        toBeIndex = xIndex.ElementValueNull();
                    }
                }

                StreamWriter sw   = new StreamWriter(commandFileLoc, false, System.Text.Encoding.Default);
                string       text = "<<SET INDEX" + toBeIndex + "='" + sender + "'";
                if (docDate != null)
                {
                    text += ", INDEX20='" + docDate + "'";
                }
                if (status != null)
                {
                    text += ", INDEX" + statusIndex + "='" + status + "'";
                }

                text += " WHERE INDEX01='" + fileID + "'>>";
                sw.WriteLine(text);


                sw.Flush();
                sw.Close();

                return(commandFileLoc);
            }
            catch (Exception ex)
            {
                XLtools.LogException("XLVC-Reindex", ex.ToString());
                return(null);
            }
        }
Exemplo n.º 15
0
        public static BondResult LaunchCabi(string commandFile, Boolean reindex, Boolean silent = false)
        {
            try
            {
                BondResult result = new BondResult();
                //see if cabibond location is already populted and if not do so.
                exeLocation = CabiLocation();

                //Build the command file with the relevant options
                if (File.Exists(commandFile))
                {
                    //configure the execution
                    Process p = new Process();
                    p.StartInfo.UseShellExecute        = false;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.FileName = exeLocation;
                    string args = "";
                    if (silent)
                    {
                        args = args + "-s ";
                    }
                    if (reindex)
                    {
                        args = args + "UPDATEDB " + commandFile;
                    }
                    else
                    {
                        args = args + commandFile;
                    }

                    p.StartInfo.Arguments = args;
                    //start
                    p.Start();


                    //wait for output and return result
                    p.WaitForExit();
                    result.ExitCode       = p.ExitCode;
                    result.StandardOutput = p.StandardOutput.ReadToEnd();
                    result.CommandLine    = p.StartInfo.FileName.ToString() + " " + p.StartInfo.Arguments.ToString();
                }
                else
                {
                    result.ExitCode       = -1;
                    result.StandardOutput = "Unable to find command file";
                }
                return(result);
            }
            catch (Exception ex)
            {
                XLtools.LogException("XLVC-LaunchCabi", ex.ToString());
                return(new BondResult());
            }
        }
Exemplo n.º 16
0
 public static Contact FetchContact(string iD)
 {
     try
     {
         Contact cont = new Contact();
         //Get contact data from MainContact
         DataTable xlReader = XLSQL.ReturnTable("Select * from Contact where CRMID='" + iD + "'");
         if (xlReader.Rows.Count == 1)
         {
             cont.crmID        = iD;
             cont.firstname    = xlReader.Rows[0]["first_name"].ToString();
             cont.lastname     = xlReader.Rows[0]["last_name"].ToString();
             cont.relationship = ""; //only used in collections
             cont.type         = xlReader.Rows[0]["type"].ToString();
             //see whether the title exists in the enum
             if (Enum.IsDefined(typeof(Title), xlReader.Rows[0]["title"].ToString()))
             {
                 cont.title = (Title)Enum.Parse(typeof(Title), xlReader.Rows[0]["title"].ToString(), true);
             }
             else
             {
                 cont.title = (Title)Enum.Parse(typeof(Title), "Mr", true);
             }
             cont.position = xlReader.Rows[0]["position"].ToString();
         }
         //Organisation
         cont.organisation = Organisation.GetOrganisation(cont.crmID);
         //Addresses
         cont.addresses = Address.GetAddresses(cont.crmID);
         //Update the address block with the organisation name
         if (cont.organisation != null)
         {
             foreach (Address add in cont.addresses)
             {
                 add.addressBlock = cont.organisation.name + Environment.NewLine + add.addressBlock;
             }
         }
         //Numbers
         cont.numbers = Number.GetNumbers(cont.crmID);
         //email
         cont.emails = EmailAddress.GetEmails(cont.crmID);
         //salutations
         cont.salutations = Salutation.GetSalutations(cont.crmID);
         //parameters
         cont.parameters = null;
         return(cont);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-FetchContact", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 17
0
 public static Contact FetchContact(string ID, string clientcrmid)
 {
     try
     {
         //Get client data from Client
         Contact   contact  = new Contact();
         DataTable xlReader = XLSQL.ReturnTable("Select * from IPSContact('" + clientcrmid + "') where ID='" + ID + "'");
         if (xlReader.Rows.Count == 1)
         {
             contact.crmID    = ID;
             contact.name     = xlReader.Rows[0]["name"].ToString();
             contact.type     = xlReader.Rows[0]["ctype"].ToString();
             contact.address1 = xlReader.Rows[0]["address1"].ToString();
             contact.address2 = xlReader.Rows[0]["address2"].ToString();
             contact.address3 = xlReader.Rows[0]["address3"].ToString();
             contact.address4 = xlReader.Rows[0]["address4"].ToString();
             contact.address5 = xlReader.Rows[0]["address5"].ToString();
             contact.postcode = xlReader.Rows[0]["postcode"].ToString();
             if (contact.address1 != "")
             {
                 contact.addressBlock = contact.address1 + Environment.NewLine;
             }
             if (contact.address2 != "")
             {
                 contact.addressBlock += contact.address2 + Environment.NewLine;
             }
             if (contact.address3 != "")
             {
                 contact.addressBlock += contact.address3 + Environment.NewLine;
             }
             if (contact.address4 != "")
             {
                 contact.addressBlock += contact.address4 + Environment.NewLine;
             }
             if (contact.address5 != "")
             {
                 contact.addressBlock += contact.address5 + Environment.NewLine;
             }
             if (contact.postcode != "")
             {
                 contact.addressBlock += contact.postcode;
             }
             contact.fax = xlReader.Rows[0]["fax"].ToString();;
         }
         return(contact);
     }
     catch (Exception ex)
     {
         XLtools.LogException("Insol-FetchContact", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 18
0
 public static List <Contact> GetEmployees(string iD)
 {
     try
     {
         List <Contact> connectedContacts = new List <Contact>();
         return(connectedContacts = Contact.Contacts(iD));
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-GetEmployees", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 19
0
        private static string CabiLocation()
        {
            try
            {
                // Check the rigistry for the location of the Cabibond.Net.Exe
                string strExePath = string.Empty;

                Microsoft.Win32.RegistryKey REGKEY1;
                REGKEY1 = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Lindenhouse", false);

                if (REGKEY1 != null)
                {
                    try
                    {
                        strExePath = REGKEY1.GetValue("IntegrationPath", "DOESNOTEXIST").ToString();
                    }
                    catch
                    {
                        strExePath = string.Empty;
                    }
                }

                if (!File.Exists(strExePath))
                {
                    Microsoft.Win32.RegistryKey REGKEY2;
                    REGKEY2 = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Lindenhouse", false);
                    if (REGKEY2 != null)
                    {
                        strExePath = REGKEY1.GetValue("IntegrationPath2", "DOESNOTEXIST").ToString();
                    }
                    //If unable to obtain from registry try the usual program files directories.
                    if (!File.Exists(strExePath))
                    {
                        strExePath = Environment.GetEnvironmentVariable("ProgramFiles") + "\\Lindenhouse Software Ltd\\CabiBond.Net\\CabiBond.Net.exe";

                        if (!File.Exists(strExePath))
                        {
                            strExePath = Environment.GetEnvironmentVariable("ProgramFiles(x86)") + "\\Lindenhouse Software Ltd\\CabiBond.Net\\CabiBond.Net.exe";
                        }
                    }
                }
                return(strExePath);
            }
            catch (Exception ex)
            {
                XLtools.LogException("XLVC-CabiLocation", ex.ToString());
                return(null);
            }
        }
Exemplo n.º 20
0
 public static Client FetchClientFromCode(string clientCode)
 {
     try
     {
         Client    client   = new Client();
         DataTable xlReader = XLSQL.ReturnTable("Select crmid from Client where clientcode='" + clientCode + "'");
         client = FetchClient(xlReader.Rows[0]["crmid"].ToString());
         return(client);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-FetchClientfromcode", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 21
0
 public static BondResult IndexDocument(string docPath, FileInfo fileInfo)
 {
     try
     {
         string     commandFile = BuildCommandFile(docPath, fileInfo);
         BondResult result      = LaunchCabi(commandFile, false);
         result.DocPath = docPath;
         return(result);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLVC-IndexDocument", ex.ToString());
         return(new BondResult());
     }
 }
Exemplo n.º 22
0
        private static SqlConnection ConnecttoSQL()
        {
            string        conn         = BuildConnectionString();
            SqlConnection xLConnection = new SqlConnection(conn);

            try
            {
                xLConnection.Open();
                return(xLConnection);
            }
            catch (Exception e)
            {
                XLtools.LogException("XLSQL-Connection", e.ToString());
                return(null);
            }
        }
Exemplo n.º 23
0
 public static BondResult IndexDocument(string docPath, string cabinet = "", string client = "", string status = "", string sender = "", string section = "", string desc = "", string docDate = null, IndexPair additionalIndex1 = null, IndexPair additionalIndex2 = null)
 {
     try
     {
         if (docDate == null)
         {
             docDate = DateTime.Now.ToString("dd/MM/yyyy");
         }
         string     commandFile = BuildCommandFile(docPath, cabinet, client, status, sender, section, desc, docDate, additionalIndex1, additionalIndex2);
         BondResult result      = LaunchCabi(commandFile, false);
         result.DocPath = docPath;
         return(result);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLVC-IndexDocument", ex.ToString());
         return(new BondResult());
     }
 }
Exemplo n.º 24
0
 public static string GetSubject(string crmiID)
 {
     try
     {
         Contact   contact  = new Contact();
         string    subject  = "";
         DataTable xlReader = XLSQL.ReturnTable("SELECT [XLant].[dbo].[Insol_Subject] ('" + crmiID + "') as subject");
         if (xlReader.Rows.Count == 1)
         {
             subject = xlReader.Rows[0]["subject"].ToString();;
         }
         return(subject);
     }
     catch (Exception ex)
     {
         XLtools.LogException("Insol-GetSubject", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 25
0
 public static Staff GetStaff(string grade, string iD)
 {
     try
     {
         Staff     staff    = new Staff();
         string    type     = DiscoverType(iD);
         DataTable xlReader = XLSQL.ReturnTable("SELECT TOP 1 * from Connections('" + iD + "', '" + type + "') where contacttype='Staff' and reldesc = '" + grade + "' and ISNULL(contactid,'')!=''");
         if (xlReader.Rows.Count == 1)
         {
             staff = FetchStaff(xlReader.Rows[0]["contactid"].ToString());
         }
         return(staff);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-GetStaff", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 26
0
            //public DateTime appdate { get; set; }

            public static KeyData FetchKeyData(string ID)
            {
                try
                {
                    KeyData   data     = new KeyData();
                    DataTable xlReader = XLSQL.ReturnTable("Select * from insol where crmID='" + ID + "'");
                    if (xlReader.Rows.Count == 1)
                    {
                        //data.appdate = Convert.ToDateTime(xlReader["appdate"].ToString()); //DateTime.Parse(xlReader.NiceString("appdate"));
                        data.caseType = xlReader.Rows[0]["type"].ToString();
                        data.sign     = xlReader.Rows[0]["sign"].ToString();
                        data.title    = xlReader.Rows[0]["app"].ToString();
                    }
                    return(data);
                }
                catch (Exception ex)
                {
                    XLtools.LogException("Insol-FetchKeyData", ex.ToString());
                    return(null);
                }
            }
Exemplo n.º 27
0
        public static string FileStore(string office, string department)
        {
            try
            {
                string fileStore = "";

                //query the setting files and try to find a match
                XElement selectedMap = (from map in XLtools.settingsDoc.Descendants("Map")
                                        where (string)map.Attribute("Office") == office && (string)map.Attribute("Department") == department
                                        select map).FirstOrDefault();
                if (selectedMap != null)
                {
                    fileStore = selectedMap.Attribute("FileStore").Value;
                }
                return(fileStore);
            }
            catch (Exception ex)
            {
                XLtools.LogException("XLVC-FileStore", ex.ToString());
                return(null);
            }
        }
Exemplo n.º 28
0
 public static List <string> SectionValues(string office, string department)
 {
     try
     {
         List <string> sections  = new List <string>();
         string        fileStore = FileStore(office, department);
         DataTable     xlReader  = XLSQL.ReturnTable("SELECT Distinct SectionValue FROM [XLant].[dbo].[VCSectionValuesView] where CabinetName='" + fileStore + "' order by SectionValue");
         if (xlReader.Rows.Count != 0)
         {
             foreach (DataRow row in xlReader.Rows)
             {
                 sections.Add(row["SectionValue"].ToString());
             }
         }
         return(sections);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLVC-SectionValues", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 29
0
 public static Number GetNumber(string crmID, string ndesc)
 {
     try
     {
         string    type     = DiscoverType(crmID);
         DataTable xlReader = XLSQL.ReturnTable("SELECT Top 1 * FROM [XLant].[dbo].[Numbers] ('" + crmID + "','" + type + "') where ndesc='" + ndesc + "' and ISNULL(number,'')!='' order by isPrimary desc");
         if (xlReader.Rows.Count == 1)
         {
             Number number = new Number(xlReader.Rows[0]["ndesc"].ToString(), xlReader.Rows[0]["number"].ToString(), Convert.ToBoolean(xlReader.Rows[0]["isPrimary"].ToString()));
             return(number);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-GetNumber", ex.ToString());
         return(null);
     }
 }
Exemplo n.º 30
0
 public static List <Number> GetNumbers(string crmID)
 {
     try
     {
         string        type     = DiscoverType(crmID);
         List <Number> numbers  = new List <Number>();
         DataTable     xlReader = XLSQL.ReturnTable("SELECT * FROM [XLant].[dbo].[Numbers] ('" + crmID + "','" + type + "') where ISNULL(number,'')!=''");
         if (xlReader.Rows.Count != 0)
         {
             foreach (DataRow row in xlReader.Rows)
             {
                 numbers.Add(new Number(row["ndesc"].ToString(), row["number"].ToString(), Convert.ToBoolean(row["isPrimary"].ToString())));
             }
         }
         return(numbers);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLMain-GetNumbers", ex.ToString());
         return(null);
     }
 }