Пример #1
0
 private void cmdDelete_Click(object sender, EventArgs e)
 {
     if (lstST.SelectedItems.Count == 0)
     {
         return;
     }
     if (MessageBox.Show(this, "Do you really want to delete the " + lstST.SelectedItems.Count.ToString() +
                         " Simple Task" + (lstST.SelectedItems.Count == 1 ? "" : "s") + "?", Program.Title, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
     {
         foreach (ListViewItem l in lstST.SelectedItems)
         {
             SimpleTaskLite ST = (SimpleTaskLite)l.Tag;
             Program.net.DeleteSimpleTask(ST.ID);
         }
         LoadData();
     }
 }
Пример #2
0
        public RESTStatus ListSTasks(SQLLib sql, object dummy, NetworkConnectionInfo ni, string id)
        {
            if (ni.HasAcl(ACLFlags.ChangeServerSettings) == false)
            {
                ni.Error   = "Access denied";
                ni.ErrorID = ErrorFlags.AccessDenied;
                return(RESTStatus.Denied);
            }

            lock (ni.sqllock)
            {
                SqlDataReader dr;
                if (string.IsNullOrWhiteSpace(id) == false)
                {
                    if (Computers.MachineExists(sql, id) == false)
                    {
                        ni.Error   = "Access denied";
                        ni.ErrorID = ErrorFlags.InvalidData;
                        return(RESTStatus.NotFound);
                    }

                    dr = sql.ExecSQLReader("select SimpleTasks.*,ComputerName from SimpleTasks inner join ComputerAccounts on ComputerAccounts.MachineID=SimpleTasks.MachineID where SimpleTasks.MachineID=@m order by MachineID,Name",
                                           new SQLParam("@m", id));
                }
                else
                {
                    dr = sql.ExecSQLReader("select SimpleTasks.*,ComputerName from SimpleTasks inner join ComputerAccounts on ComputerAccounts.MachineID=SimpleTasks.MachineID order by MachineID,Name");
                }

                SimpleList      = new SimpleTaskLiteList();
                SimpleList.List = new List <SimpleTaskLite>();

                while (dr.Read())
                {
                    SimpleTaskLite d = new SimpleTaskLite();
                    sql.LoadIntoClass(dr, d);
                    SimpleList.List.Add(d);
                }
                dr.Close();
            }

            return(RESTStatus.Success);
        }
Пример #3
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            if (lstST.SelectedItems.Count == 0)
            {
                return;
            }
            SimpleTaskLite ST  = (SimpleTaskLite)lstST.SelectedItems[0].Tag;
            SimpleTask     stb = Program.net.GetSimpleTaskDetails(ST.ID);

            if (stb == null)
            {
                MessageBox.Show(this, "Cannot get Simple Tasks details: " + Program.net.GetLastError(), Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            frmSimpleTasks stfrm = new frmSimpleTasks(stb);

            if (stfrm.ShowDialog(this) == DialogResult.OK)
            {
                LoadData();
            }
        }