public static APIServiceProviderNamespace.main.projectsDataTable GetProjects() { try { InitConnection(); projectsTableAdapter adapter = new projectsTableAdapter(); if (adapter.Connection != null) adapter.Connection.Close(); adapter.Connection = sqlCon; return adapter.GetData(); } catch (Exception exObj) { lastErrorString = exObj.Message; string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); System.IO.File.AppendAllText(path.Replace("file:\\", "") + "\\dblog.txt", "[GetProjects - " + DateTime.Now.ToString() + "]" + exObj.Message + "\r\n"); return null; } }
public static int AddProject(string name, string pid, DateTime startfrom) { try { InitConnection(); projectsTableAdapter adapter = new projectsTableAdapter(); if (adapter.Connection != null) adapter.Connection.Close(); adapter.Connection = sqlCon; return Convert.ToInt32(adapter.sp_AddProject(name, pid, startfrom)); } catch (Exception exObj) { lastErrorString = exObj.Message; string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); System.IO.File.AppendAllText(path.Replace("file:\\", "") + "\\dblog.txt", "[AddProject - " + DateTime.Now.ToString() + "]" + exObj.Message + "\r\n"); } return 0; }