Exemplo n.º 1
0
 public static Member GetUserById(int idUser)
 {
     openConnection();
     string condition = "id_user = '******'";
     MySqlCommand command = new MySqlCommand(db.SelectSQLQuery(new string[] { LOGIN_ATTR, PASSWORD_ATTR }, Const.USERS_TABLE, condition), connection);
     MySqlDataReader reader = command.ExecuteReader();
     if (reader.Read() == false) {
         return null;
     }
     Member m = new Member(idUser, reader.GetString(LOGIN_ATTR), reader.GetString(PASSWORD_ATTR));
     connection.Close();
     return m;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Send Reminder to user
        /// </summary>
        /// <param name="email">user email</param>
        public void SendReminder(string email)
        {
            Member sendUser = new Member();
            SendMail s = new SendMail();
            try {
                sendUser = Login_DB.GetUserById(Member_DB.GetMemberIdByEmail(email));
            } catch {
                s.Send(email, "Приносим свои извинения, но вы не зарегистрированы в нашей системе. Подробности [email protected].");
                return;
            }

            s.Send(email, imposeMailText(sendUser.Login, sendUser.Password));
        }
Exemplo n.º 3
0
 public void ChangeMember(Member m)
 {
     member = m;
     number.Text = "№" + member.Number.ToString();
     fullName.Text = member.FirstName + " " + member.LastName + " " + member.Family;
     birthDay.Text = ifThereIsNotDate(member.BDate);
     enterDate.Text = ifThereIsNotDate(member.EnterDate);
     email.Text = member.Email;
     local.Text = member.Local;
     city.Text = member.City;
     if (member.Area != "") {
         area.Text = member.Area;
     }
     godFather.Text = Program.Data.GetMICGodFather(member).Family + " " + Program.Data.GetMICGodFather(member).FirstName + " " + Program.Data.GetMICGodFather(member).LastName;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns an instance of the class Member
 /// </summary>
 /// <param name="id">Id man from the base</param>
 /// <returns></returns>
 public Member GetMember(int id)
 {
     MySqlConnection con = new MySqlConnection();
     try {
         con = new MySqlConnection(connectionString);
     } catch {
         Console.WriteLine("Error: couldn't connect to database");
         Console.ReadKey();
         return null;
     }
     MySqlCommand cmd = new MySqlCommand(getMemberQuery + id.ToString(), con);
     try {
         con.Open();
     } catch {
         return null;
     }
     MySqlDataReader reader = cmd.ExecuteReader();
     Member mmbr = new Member();
     while (reader.Read()) {
         mmbr.Area = reader["area"].ToString();
         mmbr.Local = reader["local"].ToString();
         mmbr.Family = reader["family"].ToString();
         mmbr.FirstName = reader["firstName"].ToString();
         mmbr.City = reader["city"].ToString();
         mmbr.LastName = reader["lastName"].ToString();
         mmbr.BDate = getDateTime(reader["b_Year"], reader["b_month"], reader["b_Day"]);
         mmbr.Education = reader["education"].ToString();
         mmbr.Job = reader["job"].ToString();
         mmbr.EnterDate = getDateTime(reader["enter_year"], reader["enter_month"], reader["enter_day"]);
         mmbr.Number = Int32.Parse(reader["number"].ToString());
         mmbr.IndexAdress = Int32.Parse(reader["index_adress"].ToString());
         mmbr.Contacts = reader["contacts"].ToString();
         mmbr.EnterMark = reader["enter_Mark"].ToString();
         mmbr.ChangeDate = reader["change_date"].ToString();
         mmbr.GodFather = Int32.Parse(reader["godFather"].ToString());
         mmbr.Post = reader["post"].ToString();
         mmbr.Email = reader["email"].ToString();
     }
     con.Close();
     return mmbr;
 }
Exemplo n.º 5
0
 public Member GetMICGodFather(Member member)
 {
     help = new DBHelper();
     return help.GetMember(member.God_Father);
 }
Exemplo n.º 6
0
 private Member checkDataInMember(Member m)
 {
     m.Area = thereIsNotData(m.Area);
     m.City = thereIsNotData(m.City);
     m.Contacts = thereIsNotData(m.Education);
     m.Enter_Mark = thereIsNotData(m.Enter_Mark);
     m.Family = thereIsNotData(m.Family);
     m.FirstName = thereIsNotData(m.FirstName);
     m.Home_Adress = thereIsNotData(m.Home_Adress);
     m.Job = thereIsNotData(m.Job);
     m.LastName = thereIsNotData(m.LastName);
     m.Local = thereIsNotData(m.Local);
     m.Post = thereIsNotData(m.Post);
     m.State = thereIsNotData(m.State);
     m.Email = thereIsNotData(m.Email);
     return m;
 }
Exemplo n.º 7
0
 public void SetMainUser(int userIndex, string userLogin, string userPassword)
 {
     MainUser = new Member(userIndex, userLogin, userPassword);
 }
Exemplo n.º 8
0
 public void PutInGodFather(Member member)
 {
     help = new DBHelper();
     Program.MainWindow.PutInMemberCardGodFather(GetMICGodFather(member));
 }
Exemplo n.º 9
0
        public void PutMember(Member m)
        {
            member = m;
            number = new OpacityLabel();
            number.Size = new System.Drawing.Size(100, 30);
            number.Text = "№";
            number.Text += member.Number.ToString();
            number.Location = new System.Drawing.Point(this.Width - number.Width);
            number.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            number.BorderStyle = BorderStyle.Fixed3D;
            this.Controls.Add(number);

            fullName = new OpacityLabel();
            fullName.Text = member.FirstName + " " + member.LastName + " " + member.Family;
            fullName.Size = new System.Drawing.Size(400, 30);
            fullName.Location = new System.Drawing.Point(0, 0);
            fullName.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(fullName);

            birthDayLabel = new OpacityLabel();
            birthDayLabel.Text = "День рождения";
            birthDayLabel.Location = new System.Drawing.Point(0, 40);
            birthDayLabel.Size = new System.Drawing.Size(180, 30);
            birthDayLabel.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(birthDayLabel);

            birthDay = new OpacityLinkLabel();
            birthDay.Text = ifThereIsNotDate(member.BDate);
            birthDay.Size = new System.Drawing.Size(200, 30);
            birthDay.Click += new EventHandler(birthDay_Click);
            birthDay.Location = new System.Drawing.Point(200, 40);
            birthDay.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(birthDay);

            enterDateLabel = new OpacityLabel();
            enterDateLabel.Size = new System.Drawing.Size(190, 30);
            enterDateLabel.Location = new System.Drawing.Point(0, 80);
            enterDateLabel.Text = "Дата вступления";
            enterDateLabel.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(enterDateLabel);

            enterDate = new OpacityLinkLabel();
            enterDate.Size = new System.Drawing.Size(200, 30);
            enterDate.Text = ifThereIsNotDate(member.EnterDate);
            enterDate.Click += new EventHandler(enterDate_Click);
            enterDate.Location = new System.Drawing.Point(200, 80);
            enterDate.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(enterDate);

            emailLabel = new OpacityLabel();
            emailLabel.Size = new System.Drawing.Size(190, 30);
            emailLabel.Location = new System.Drawing.Point(0, 120);
            emailLabel.Text = "E-mail";
            emailLabel.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(emailLabel);

            email = new OpacityLinkLabel();
            email.Size = new System.Drawing.Size(200, 30);
            email.Text = member.Email;
            email.Location = new System.Drawing.Point(200, 120);
            email.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(email);

            local = new OpacityLabel();
            local.Size = new System.Drawing.Size(300, 60);
            local.Text = member.Local;
            local.Location = new System.Drawing.Point(200, 160);
            local.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(local);

            localLabel = new OpacityLabel();
            localLabel.Size = new System.Drawing.Size(200, 30);
            localLabel.Location = new System.Drawing.Point(0, 160);
            localLabel.Text = "Подразделение";
            localLabel.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(localLabel);

            city = new OpacityLinkLabel();
            city.Size = new System.Drawing.Size(350, 30);
            city.Click += new EventHandler(city_Click);
            city.Location = new System.Drawing.Point(200, 240);
            city.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            city.Text = member.City;
            this.Controls.Add(city);

            cityLabel = new OpacityLabel();
            cityLabel.Size = new System.Drawing.Size(200, 30);
            cityLabel.Location = new System.Drawing.Point(0, 240);
            cityLabel.Text = "Населённый пункт";
            cityLabel.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(cityLabel);

            if (member.Area != "") {
                area = new OpacityLinkLabel();
                area.Size = new System.Drawing.Size(350, 30);
                area.Location = new System.Drawing.Point(200, 280);
                area.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
                area.Text = member.Area;
                this.Controls.Add(area);

                areaLabel = new OpacityLabel();
                areaLabel.Size = new System.Drawing.Size(200, 30);
                areaLabel.Location = new System.Drawing.Point(0, 280);
                areaLabel.Text = "Район";
                areaLabel.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
                this.Controls.Add(areaLabel);
            }

            godFather = new OpacityLinkLabel();
            godFather.Size = new System.Drawing.Size(300, 60);
            godFather.Location = new System.Drawing.Point(200, 320);
            godFather.Click += new EventHandler(godFather_Click);
            godFather.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            godFather.Text = Program.Data.GetMICGodFather(member).Family + " " + Program.Data.GetMICGodFather(member).FirstName + " " + Program.Data.GetMICGodFather(member).LastName;
            this.Controls.Add(godFather);

            godFatherLabel = new OpacityLabel();
            godFatherLabel.Size = new System.Drawing.Size(200, 30);
            godFatherLabel.Location = new System.Drawing.Point(0, 320);
            godFatherLabel.Text = "Крёстный в МИЦ";
            godFatherLabel.Font = new System.Drawing.Font("PF BeauSans Pro", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Controls.Add(godFatherLabel);
        }
Exemplo n.º 10
0
 private void GetMemberClick(object sender, EventArgs e)
 {
     this.workSpaceTableLayoutPanel.Controls.Remove(memberCard);
     memberCard = new MemberCard();
     Member member = new Member();
     member = Program.Data.GetMICMember(Int32.Parse(memberList[Const.MEMBERS].SelectedItem.ToString().Split(' ')[0]));
     memberCard.PutMember(member);
     this.workSpaceTableLayoutPanel.Controls.Add(memberCard, 2, 2);
 }
Exemplo n.º 11
0
 public void PutInMemberCardGodFather(Member godFather)
 {
     this.workSpaceTableLayoutPanel.Controls.Remove(memberCard);
     memberCard = new MemberCard();
     memberCard.PutMember(godFather);
     this.workSpaceTableLayoutPanel.Controls.Add(memberCard, 2, 2);
 }
Exemplo n.º 12
0
 private void GetMemberClick(object sender, EventArgs e)
 {
     if ( memberList[Const.MEMBERS].SelectedItem != null ) {
         Member member = new Member();
         member = Program.Data.GetMICMember(Int32.Parse(memberList[Const.MEMBERS].SelectedItem.ToString().Split(' ')[0]));
         int index = this.workSpaceTableLayoutPanel.Controls.IndexOf(memberCard);
         if ( index == -1 ) {
             memberCard = new MemberCard();
             memberCard.PutMember(member);
             this.workSpaceTableLayoutPanel.Controls.Add(memberCard, 2, 2);
         } else {
             ( (MemberCard)this.workSpaceTableLayoutPanel.Controls[index] ).ChangeMember(member);
         }
     }
 }
Exemplo n.º 13
0
        public static Member GetMemberAttrWithOneQuery(int userId)
        {
            openConnection();
            MySqlCommand command = new MySqlCommand(SELECT_MEMBER_ATTRS_QUERY + userId.ToString() + "'", connection);
            MySqlDataReader reader = command.ExecuteReader();
            Member m = new Member();
            m.BDate = new DateTime();
            m.EnterDate = new DateTime();
            while (reader.Read()) {
                string attrName = db.GetAttrNameById(reader.GetInt32(ID_ATTR_COLUMN));
                if (attrName == "b_day") {
                    m.BDate = new DateTime(m.BDate.Year, m.BDate.Month, reader.GetInt32(VALUE_COLUMN));
                    continue;
                }
                if (attrName == "b_month") {
                    m.BDate = new DateTime(m.BDate.Year, reader.GetInt32(VALUE_COLUMN), m.BDate.Day);
                    continue;
                }
                if (attrName == "b_year") {
                    m.BDate = new DateTime(reader.GetInt32(VALUE_COLUMN), m.BDate.Month, m.BDate.Day);
                    continue;
                }
                if (attrName == "enter_day") {
                    m.EnterDate = new DateTime(m.EnterDate.Year, m.EnterDate.Month, reader.GetInt32(VALUE_COLUMN));
                    continue;
                }
                if (attrName == "enter_month") {
                    m.EnterDate = new DateTime(m.EnterDate.Year, reader.GetInt32(VALUE_COLUMN), m.EnterDate.Day);
                    continue;
                }
                if (attrName == "enter_year") {
                    m.EnterDate = new DateTime(reader.GetInt32(VALUE_COLUMN), m.EnterDate.Month, m.EnterDate.Day);
                    continue;
                }
                foreach (FieldInfo f in m.GetType().GetFields()) {
                    if (String.Compare(f.Name, attrName, true) == 0) {
                        if (f.FieldType == typeof(Int32)) {
                            m.GetType().GetField(f.Name).SetValue(m, reader.GetInt32(VALUE_COLUMN));
                            continue;
                        }
                        if ((f.FieldType == typeof(DateTime)) && (f.Name != "BDate") && (f.Name != "EnterDate")) {
                            m.GetType().GetField(f.Name).SetValue(m, DateTime.Parse(reader.GetString(VALUE_COLUMN)));
                            continue;
                        }
                        m.GetType().GetField(f.Name).SetValue(m, reader.GetString(VALUE_COLUMN));
                    }
                }

            }
            return m;
        }