public string RemoveApps(DataTable dt, IDbCommand command) { StringBuilder stringBuilder = new StringBuilder(); if (dt == null) { dt = AppFactory.GetToDeleteAppsTable(command); } if (dt == null) { return("No apps to delete"); } //Connections connection = new Connections(); //connection.Init(); foreach (DataRow dr in dt.Rows) { try { App app = new App(dr); RemoveApp(app); stringBuilder.AppendFormat("<br>Completely remove app number {0}", dr["Id"].ToString()); Maps.Instance.DuradosMap.Logger.Log("ProductMaintenance", "RemoveApps", "RemoveApps", null, 3, string.Format("Completely remove app number {0}.", dr["Id"].ToString())); } catch (Exception ex) { Maps.Instance.DuradosMap.Logger.Log("ProductMaintenance", "RemoveApps", "RemoveApps", ex, 2, string.Format("Could not completely remove app number {0}.", dr["Id"].ToString())); stringBuilder.AppendFormat("<br>Failed to completely remove app number" + dr["Id"].ToString() + ". Cause: " + ex.Message); } } return(stringBuilder.ToString()); }
//public void RemoveApp(int appId,string appName) //{ // App app = (appId > 0) ? new AppFactory().GetAppById(appId) : new AppFactory().GetAppByName(appName); // if(app== null || app.AppId<=0) // throw new DuradosException("App was not found"); // RemoveApp(app); //} public bool RemoveApp(string appName) { if (string.IsNullOrEmpty(appName)) { throw new DuradosException("App name is empty"); } App app = new AppFactory().GetAppByName(appName); if (app == null || app.AppId <= 0) { throw new DuradosException("App was not found"); } return(RemoveApp(app)); }
public bool RemoveApp(int appId) { if (appId <= 0) { throw new DuradosException("App could not be 0"); } App app = new AppFactory().GetAppById(appId); if (app == null || app.AppId <= 0) { throw new DuradosException("App was not found"); } return(RemoveApp(app)); }