Esempio n. 1
0
        public static bool DeleteStatisticsRecords(int projectid, DateTime dt)
        {
            try
            {
                InitConnection();

                statisticsTableAdapter adapter = new statisticsTableAdapter();
                if (adapter.Connection != null)
                    adapter.Connection.Close();

                adapter.Connection = sqlCon;
                adapter.sp_DeleteStatisticsRecords(projectid, dt);
                return true;
            }
            catch (Exception exObj)
            {
                lastErrorString = exObj.Message;
                string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
                System.IO.File.AppendAllText(path.Replace("file:\\", "") + "\\dblog.txt", "[DeleteStatisticsRecords - " + DateTime.Now.ToString() + "]" + exObj.Message + "\r\n");
            }

            return false;
        }
Esempio n. 2
0
        public static bool AddStatisticsRecord(int campaignid, DateTime datetime, int views, int clicks, decimal price, string data, StatLevel sl, int projectid, string keyword)
        {
            try
            {
                InitConnection();

                statisticsTableAdapter adapter = new statisticsTableAdapter();
                if (adapter.Connection != null)
                    adapter.Connection.Close();

                adapter.Connection = sqlCon;
                adapter.sp_AddStatisticsRecord(campaignid, datetime, views, clicks, price, data, (int)sl, projectid, keyword);
                return true;
            }
            catch (Exception exObj)
            {
                lastErrorString = exObj.Message;
                string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
                System.IO.File.AppendAllText(path.Replace("file:\\", "") + "\\dblog.txt", "[AddStatisticsRecord - " + DateTime.Now.ToString() + "]" + exObj.Message + "\r\n");
            }

            return false;
        }