Esempio n. 1
0
        //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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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);
                    string msg = string.Format("Completely remove app number {0}", dr["Id"].ToString());
                    if (resultOutput != null)
                    {
                        resultOutput.Text += "\n\r" + msg;
                    }
                    stringBuilder.AppendFormat("<br>{0}", msg);
                    logger.Log("ProductMaintenance", "RemoveApps", "RemoveApps", null, 3, string.Format("Completely remove app number {0}.", dr["Id"].ToString()));
                }
                catch (Exception ex)
                {
                    string msg = string.Format("Could not completely remove app number {0}.", dr["Id"].ToString());
                    if (resultOutput != null)
                    {
                        resultOutput.Text += "\n\r" + msg;
                    }
                    logger.Log("ProductMaintenance", "RemoveApps", "RemoveApps", ex, 2, msg);
                    stringBuilder.AppendFormat("<br>Failed to completely remove app number" + dr["Id"].ToString() + ". Cause: " + ex.Message);
                }
            }
            return(stringBuilder.ToString());
        }