public static int AddCompaign(string name, string cid, int projectid, string provider, string client, APIServiceProviderTypes ptype, decimal balance, decimal maxtransfer) { try { InitConnection(); campaignsTableAdapter adapter = new campaignsTableAdapter(); if (adapter.Connection != null) adapter.Connection.Close(); adapter.Connection = sqlCon; return Convert.ToInt32(adapter.sp_AddCampaign(name, cid, projectid, provider, client, (int)ptype, balance, maxtransfer)); } catch (Exception exObj) { lastErrorString = exObj.Message; string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); System.IO.File.AppendAllText(path.Replace("file:\\", "") + "\\dblog.txt", "[AddCampaign - " + DateTime.Now.ToString() + "]" + exObj.Message + "\r\n"); } return 0; }
public static APIServiceProviderNamespace.main.campaignsDataTable GetCampaignsByProjectID(int projectid) { try { InitConnection(); campaignsTableAdapter adapter = new campaignsTableAdapter(); if (adapter.Connection != null) adapter.Connection.Close(); adapter.Connection = sqlCon; return adapter.sp_GetCampaignsByProjectID(projectid); } catch (Exception exObj) { lastErrorString = exObj.Message; return null; } }
public static bool SetCanTransfer(int campaignid, bool cantransfer) { try { InitConnection(); campaignsTableAdapter adapter = new campaignsTableAdapter(); if (adapter.Connection != null) adapter.Connection.Close(); adapter.Connection = sqlCon; adapter.sp_SetCanTransfer(campaignid, cantransfer); return true; } catch (Exception exObj) { lastErrorString = exObj.Message; string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); System.IO.File.AppendAllText(path.Replace("file:\\", "") + "\\dblog.txt", "[SetCanTransfer - " + DateTime.Now.ToString() + "]" + exObj.Message + "\r\n"); } return false; }