public NewProjectWin(Project prj)
 {
     NewProject = new Project(prj);
     isUpdateble = true;
     InitializeComponent();
     init();
 }
        private void delUser_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (PrjCatalog.SelectedItem != null)
            {
                int index = PrjCatalog.SelectedIndex;

                Project prj = (Project)PrjCatalog.SelectedItem;
                prj.DeleteProject();

                projects[index] = new Project(prj){IsDelete = true};
            }
        }
Exemplo n.º 3
0
 public Project(Project prj)
 {
     GUID = prj.GUID;
     Description = prj.Description;
     DateStart = prj.DateStart;
     DateEnd = prj.DateEnd;
     DateCreate = prj.DateCreate;
     Customer = new User(prj.Customer);
     Leader = new User(prj.Leader);
     Percents = prj.Percents;
     if(prj.Parent!=null)
     {
         Parent = new Project(prj.Parent);
     }
     Type = prj.Type;
     IsDelete = prj.IsDelete;
 }
Exemplo n.º 4
0
 public static void AddNewProject(Project prj)
 {
     ExecuteNonQuery(
         string.Format(
             "insert into Projects values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')",
             prj.GUID,
             prj.Description,
             DateTimeToSQLiteFormat(prj.DateStart),
             DateTimeToSQLiteFormat(prj.DateEnd),
             DateTimeToSQLiteFormat(prj.DateCreate),
             prj.Customer.GUID,
             prj.Leader.GUID,
             prj.Percents,
             prj.Parent == null ? "" : prj.Parent.GUID,
             prj.Type,
             "...", "...", "...", prj.IsDelete),
             null, true);
 }
Exemplo n.º 5
0
 public Task(Task task)
 {
     GUID = task.GUID;
     OrderDate = task.OrderDate;
     EndDate = task.EndDate;
     Performer = new User(task.Performer);
     Customer = new User(task.Customer);
     Topic = task.Topic;
     Description = task.Description;
     Priority = task.Priority;
     Project = new Project(task.Project);
     TimePlan = task.TimePlan;
     TimeAdjustment = task.TimeAdjustment;
     TimeFact = task.TimeFact;
     Percents = task.Percents;
     IsImportant = task.IsImportant;
     IsNew = task.IsNew;
     IsDelete = task.IsDelete;
 }
 public NewProjectWin()
 {
     NewProject = new Project();
     InitializeComponent();
     init();
 }
Exemplo n.º 7
0
 public static void UpdateProject(Project prj)
 {
     ExecuteNonQuery(
         string.Format(
             "update Projects set Description='{0}',DateStart='{1}',DateEnd='{2}',DateCreate='{3}',Customer='{4}',Leader='{5}',Percents='{6}',Parent='{7}',IsDelete='{8}' where GUID=@GUID",
             prj.Description,
             DateTimeToSQLiteFormat(prj.DateStart),
             DateTimeToSQLiteFormat(prj.DateEnd),
             DateTimeToSQLiteFormat(prj.DateCreate),
             prj.Customer.GUID,
             prj.Leader.GUID,
             prj.Percents,
             prj.Parent,
             prj.IsDelete ? 1:0),
         new List<SQLiteParameter>
             {
                 new SQLiteParameter("GUID", prj.GUID)
             },
             true);
 }
Exemplo n.º 8
0
        public static Project GetParentProjectFromGUID(string guid, bool all = false)
        {
            SQLiteConnection connection = new SQLiteConnection(ConnectionString);
            Project parent = new Project(false);

            try
            {
                connection.Open();
                string command = string.Concat("select * from Projects where GUID=@GUID", all ? "" : " and (IsDelete='False' or IsDelete='0')");
                SQLiteCommand cmd = new SQLiteCommand(command, connection);
                cmd.Parameters.Add(new SQLiteParameter("GUID", guid));
                SQLiteDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    //string parentGUID = reader.GetString(reader.GetOrdinal("Parent"));
                    object o = reader["IsDelete"];

                    parent = new Project(false)
                    {
                        GUID = reader.GetString(reader.GetOrdinal("GUID")),
                        Description = reader.GetString(reader.GetOrdinal("Description")),
                        DateStart = reader.GetDateTime(reader.GetOrdinal("DateStart")),
                        DateEnd = reader.GetDateTime(reader.GetOrdinal("DateEnd")),
                        DateCreate = reader.GetDateTime(reader.GetOrdinal("DateCreate")),
                        Customer = GetUserFromGUID(reader.GetString(reader.GetOrdinal("Customer"))),
                        Leader = GetUserFromGUID(reader.GetString(reader.GetOrdinal("Leader"))),
                        Percents = reader.GetDouble(reader.GetOrdinal("Percents")),
                        Parent = null,/*string.IsNullOrWhiteSpace(parentGUID) ? null : GetParentProjectFromGUID(parentGUID)*/
                        Type = reader.GetInt32(reader.GetOrdinal("Type")),
                        IsDelete = Convert.ToBoolean(o)
                    };
                }
            }
            catch (Exception exc)
            {
                MessageWindows.Show("GetParentProjectFromGUID:Exception", exc.Message);
                return parent;
            }
            finally
            {
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }

            return parent;
        }
Exemplo n.º 9
0
 public static void AddProject(Project prj)
 {
     SQLiteWorker.AddNewProject(prj);
 }