Ejemplo n.º 1
0
 public NewUserWin(User user)
 {
     NewUser = new User(user);
     isUpdateble = true;
     InitializeComponent();
     init();
 }
Ejemplo n.º 2
0
 public User(User user)
 {
     if (user != null)
     {
         GUID = user.GUID;
         Name = user.Name;
         Email = user.Email;
         IsDelete = user.IsDelete;
     }
 }
Ejemplo n.º 3
0
 public Comment(Comment comment)
 {
     GUID = comment.GUID;
     TaskGUID = comment.TaskGUID;
     User = new User(comment.User);
     Date = new DateTime(comment.Date.Year, comment.Date.Month, comment.Date.Day, comment.Date.Hour,
                         comment.Date.Minute, comment.Date.Second, comment.Date.Millisecond);
     Data = comment.Data;
     IsNew = comment.IsNew;
 }
Ejemplo n.º 4
0
 public Comment(bool generate = true)
 {
     if (generate)
     {
         GUID = SQLiteWorker.GenerateGUID();
         Date = DateTime.Now;
         User = new User(Settings.CurrentUser);
         IsNew = false;
     }
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
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;
 }
Ejemplo n.º 7
0
 public NewUserWin()
 {
     NewUser = new User();
     InitializeComponent();
     init();
 }
Ejemplo n.º 8
0
 public static void AddNewUser(User user)
 {
     ExecuteNonQuery(string.Format(
             "insert into  Users values('{0}', '{1}', '{2}', '{3}')",
             user.GUID,
             user.Name,
             user.Email,
             user.IsDelete), null, true);
 }
Ejemplo n.º 9
0
 public static void UpdateUser(User user)
 {
     ExecuteNonQuery("update Users set Name=@Name, Email=@Email where GUID=@GUID",
                     new List<SQLiteParameter>
                         {
                             new SQLiteParameter("GUID", user.GUID),
                             new SQLiteParameter("Name", user.Name),
                             new SQLiteParameter("Email", user.Email)
                         },
                         true);
 }
Ejemplo n.º 10
0
        public static User GetUserFromGUID(string guid)
        {
            SQLiteConnection connection = new SQLiteConnection(ConnectionString);
            User user = new User(guid);

            try
            {
                connection.Open();
                SQLiteCommand cmd = new SQLiteCommand("select name, Email, IsDelete from USERS where guid=@GUID", connection);
                cmd.Parameters.Add(new SQLiteParameter("GUID", guid));
                SQLiteDataReader reader = cmd.ExecuteReader();

                reader.Read();
                user.Name = reader.GetString(reader.GetOrdinal("name"));
                user.Email = reader.GetString(reader.GetOrdinal("Email"));
                object o = reader["IsDelete"];
                user.IsDelete = Convert.ToBoolean(o);
            }
            catch (Exception exc)
            {
                MessageWindows.Show("GetUserFromGUID:Exception", exc.Message);
                return null;
            }
            finally
            {
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }

            return user;
        }