Exemple #1
0
 private void Show(Control control)
 {
     if (control.Equals(requestComboBox))
     {
         requestComboBox.ResetText();
         requestComboBox.Show();
         requestDateTimePicker.Hide();
         requestDigitTextBox.Hide();
         requestTextBox.Hide();
     }
     else if (control.Equals(requestDateTimePicker))
     {
         requestDateTimePicker.ResetText();
         requestDateTimePicker.Show();
         requestComboBox.Hide();
         requestDigitTextBox.Hide();
         requestTextBox.Hide();
     }
     else if (control.Equals(requestTextBox))
     {
         requestTextBox.ResetText();
         requestTextBox.Show();
         requestDateTimePicker.Hide();
         requestDigitTextBox.Hide();
         requestComboBox.Hide();
     }
     else if (control.Equals(requestDigitTextBox))
     {
         requestDigitTextBox.ResetText();
         requestDigitTextBox.Show();
         requestTextBox.Hide();
         requestComboBox.Hide();
         requestDateTimePicker.Hide();
     }
 }
Exemple #2
0
 private void txtCheckInBRName_TextChanged(object sender, EventArgs e)
 {
     errorCheckIn.Hide();
     notifyCheckIn.Hide();
     datePickerDateIn.Hide();
     gdCheckIn.DataSource         = null;
     gdCheckIn.AllowUserToAddRows = false;
 }
Exemple #3
0
        protected void CreateEditControl(Control parent)
        {
            switch (Type)
            {
            case SubItemEditType.TYPE_TEXT:
            case SubItemEditType.TYPE_PASSWORD:
            case SubItemEditType.TYPE_FLOAT:
            case SubItemEditType.TYPE_DECIMAL:
                MaterialSingleLineTextField ctrlT = new MaterialSingleLineTextField();
                //EditControl = new TextBox();
                ctrlT.Parent       = parent;
                ctrlT.Size         = new Size(0, 0);
                ctrlT.Location     = new System.Drawing.Point(0, 0);
                ctrlT.Anchor       = AnchorStyles.Left;
                ctrlT.TextChanged += new EventHandler(this.TextChanged);
                ctrlT.KeyPress    += new System.Windows.Forms.KeyPressEventHandler(this.EditOver);
                ctrlT.LostFocus   += new System.EventHandler(this.EditFocusOver);
                ctrlT.Hide();
                ctrlT.Text          = "";
                ctrlT.AcceptsReturn = true;
                EditControl         = ctrlT;

                break;

            case SubItemEditType.TYPE_DATETIME:
                DateTimePicker ctrlD = new DateTimePicker();
                ctrlD.Parent       = parent;
                ctrlD.Size         = new Size(0, 0);
                ctrlD.Location     = new System.Drawing.Point(0, 0);
                ctrlD.Anchor       = AnchorStyles.Left;
                ctrlD.TextChanged += new EventHandler(this.TextChanged);
                ctrlD.KeyPress    += new System.Windows.Forms.KeyPressEventHandler(this.EditOver);
                ctrlD.LostFocus   += new System.EventHandler(this.EditFocusOver);
                ctrlD.Hide();
                ctrlD.Text         = "";
                ctrlD.Format       = DateTimePickerFormat.Custom;
                ctrlD.CustomFormat = "yyyy-MM-dd HH:mm:ss";
                EditControl        = ctrlD;
                break;

            case SubItemEditType.TYPE_CHECKBOX:
                MaterialCheckBox ctrlC = new MaterialCheckBox();
                ctrlC.Parent             = parent;
                ctrlC.Size               = new Size(0, 0);
                ctrlC.Location           = new System.Drawing.Point(0, 0);
                ctrlC.Anchor             = AnchorStyles.Left;
                ctrlC.KeyPress          += new System.Windows.Forms.KeyPressEventHandler(this.EditOver);
                ctrlC.LostFocus         += new System.EventHandler(this.EditFocusOver);
                ctrlC.CheckStateChanged += new System.EventHandler(this.EditFocusOver);
                ctrlC.Hide();
                ctrlC.Text  = "";
                EditControl = ctrlC;
                break;

            default:
                break;
            }

            Clicked += OnClicked;
        }
Exemple #4
0
        private void InitControls()
        {
            //MonthPicker
            MonthPicker              = new DateTimePicker();
            MonthPicker.Parent       = this;
            MonthPicker.Width        = 100;
            MonthPicker.Location     = new System.Drawing.Point(btn_IssueMonth.Location.X - (MonthPicker.Width - btn_IssueMonth.Width) / 2, btn_IssueMonth.Location.Y + 24);
            MonthPicker.Format       = DateTimePickerFormat.Custom;
            MonthPicker.CustomFormat = "   yyyy/MM";
            MonthPicker.ShowUpDown   = true;
            MonthPicker.LostFocus   += MonthPicker_LostFocus;
            MonthPicker.Hide();
            //btn_IssueMonth
            btn_IssueMonth.TextChanged += Btn_IssueMonth_TextChanged;
            //cb_IssueType
            var types = Enum.GetNames(typeof(EIssueType)).Select(c => new { Name = c, Value = (int)Enum.Parse(typeof(EIssueType), c) }).ToList();

            cb_IssueType.DisplayMember = "Name";
            cb_IssueType.ValueMember   = "Value";
            cb_IssueType.DataSource    = types;
            //dgv
            dgv.AutoGenerateColumns        = false;
            dgv_Date.DataPropertyName      = nameof(TList.IssueDate);
            dgv_Imported.DataPropertyName  = nameof(TList.dgv_Imported);
            dgv_Operation.DataPropertyName = nameof(TList.dgv_Operation);
            //form
            this.Shown += ListForm_Shown;
        }
 /// <summary>
 /// DateTimePicker失去焦点,认为此时完成编辑,隐藏控件,并退出编辑模式
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DateTimePicker_LostFocus(object sender, EventArgs e)
 {
     if (DataGridViewCellCancelEventArgs != null)
     {
         if (DateTimePicker.Value > DateTime.Now.AddMinutes(1))
         {
             MessageBox.Show("限制输入晚于系统的时间");
             return;
         }
         var data = (dgv_ImplementationInfo.Rows[DataGridViewCellCancelEventArgs.RowIndex].DataBoundItem as EarthworkBlockImplementationInfo);
         if (dgv_ImplementationInfo.Columns[DataGridViewCellCancelEventArgs.ColumnIndex].DataPropertyName == nameof(EarthworkBlockImplementationInfo.StartTimeStr) &&
             (data.EndTime != DateTime.MinValue && DateTimePicker.Value > data.EndTime))
         {
             MessageBox.Show("开始时间不可晚于结束时间");
             return;
         }
         if (dgv_ImplementationInfo.Columns[DataGridViewCellCancelEventArgs.ColumnIndex].DataPropertyName == nameof(EarthworkBlockImplementationInfo.EndTimeStr) &&
             DateTimePicker.Value < data.StartTime)
         {
             MessageBox.Show("结束时间不可早于开始时间");
             return;
         }
         dgv_ImplementationInfo[DataGridViewCellCancelEventArgs.ColumnIndex, DataGridViewCellCancelEventArgs.RowIndex].Value = DateTimePicker.Value;
     }
     DateTimePicker.Hide();
     dgv_ImplementationInfo.EndEdit();
 }
Exemple #6
0
        private void dtp_TextChange(object sender, EventArgs e)
        {
            //////////////////
            ///usar a variavel ePubl que pega o endereço da celula ativa e atualiar manualmente a data;

            try
            {
                var col = GridCarrinho.Rows[GridCarrinho.CurrentCell.RowIndex].Cells[GridCarrinho.CurrentCell.RowIndex].OwningColumn.Name;
                //Debug.WriteLine("GridCarrinho.CurrentCell.RowIndex : " + GridCarrinho.CurrentCell.RowIndex + " |ePubl RowIndex: " + ePubl.RowIndex + " ColIndex: " + ePubl.ColumnIndex + "| dtp: " + dtp.Text.ToString() + "| colanme: " + col);
                if (ePubl.ColumnIndex != null)
                {
                    //GridCarrinho.CurrentCell.Value = dtp.Text.ToString();
                    // Debug.WriteLine("GridCarrinho.CurrentCell.RowIndex : " + GridCarrinho.CurrentCell.RowIndex  + "| dtp.txt: " + dtp.Text.ToString() + " | dt grid before" + GridCarrinho.Rows[ePubl.RowIndex].Cells["Disp_DataAceite"].Value.ToString());
                    GridCarrinho.Rows[ePubl.RowIndex].Cells["Disp_DataAceite"].Value = dtp.Text.ToString();

                    TabEmissaoPedidoEdit(GridCarrinho.Rows[GridCarrinho.CurrentCell.RowIndex].Cells["Iditem"].Value.ToString(), dtp.Text.ToString(), 0);

                    GridCarrinho.Rows[GridCarrinho.CurrentCell.RowIndex].Cells["Disp_Decendio"].Selected = true;
                    //Debug.WriteLine("GridCarrinho.CurrentCell.RowIndex : " + GridCarrinho.CurrentCell.RowIndex  + "| dtp.txt: " + dtp.Text.ToString() + " | dt grid after" + GridCarrinho.Rows[ePubl.RowIndex].Cells["Disp_DataAceite"].Value.ToString());
                    dtp.Visible = false;

                    dtp.Hide();

                    dtp.Focus();
                }
            }
            catch (Exception)
            {
            }
        }
Exemple #7
0
 static public void DateTimePickerFormatter(DateTimePicker datet)
 {
     datet.MinDate      = DateTime.Now.AddDays((8 - DateTime.Today.DayOfWeek - DayOfWeek.Sunday));
     datet.MaxDate      = DateTime.Now.AddDays((8 - DateTime.Today.DayOfWeek - DayOfWeek.Sunday)).AddDays(5);
     datet.Format       = DateTimePickerFormat.Custom;
     datet.CustomFormat = "yyyy-MM-dddd";
     datet.Hide();
 }
Exemple #8
0
        /// <summary>
        /// Método que se ejecuta cuando el valor del datepicker cambia.
        /// Añade el calor del combobox a la celda.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dtp_TextChange(object sender, EventArgs e)
        {
            DateTime?date = new DateTime(dtp.Value.Ticks);

            parent.sendMessage(dtp.Text.ToString());
            dataGridView1.BeginEdit(true);
            dataGridView1.CurrentCell.Value = date.Value.ToString();
            dataGridView1.EndEdit();
            dtp.Hide();
        }
 public static void hideSomeComponents()
 {
     if (initialized == false)
     {
         return;
     }
     textBoxStudentName.Hide();
     panelGender.Hide();
     dateTimePicker1.Hide();
     textBoxEmail.Hide();
     textBoxContact.Hide();
     textBoxAddress.Hide();
     labelOldPassword.Hide();
     labelNewPassword.Hide();
     labelConfirmPassword.Hide();
     textBoxOldPassword.Hide();
     textBoxNewPassword.Hide();
     textBoxConfirmPassword.Hide();
     buttonSave.Hide();
     buttonCancel.Hide();
 }
Exemple #10
0
 private void NextBtn_Click(object sender, EventArgs e)
 {
     if (time.SelectedItem != null && saal.SelectedItem != null)
     {
         this.Size = new Size(650, 450);
         for (int i = 0; i < 4; i++)
         {
             infoLabel[i].Hide();
         }
         datetime_.Hide();
         saal.Hide();
         nextBtn.Hide();
         data_.Hide();
         poster.Hide();
         time.Hide();
         seats_load();
     }
     else
     {
         MessageBox.Show("Нужно выбрать время и зал");
     }
 }
Exemple #11
0
 /// <summary>
 /// DatePicker失去焦点
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DatePicker_LostFocus(object sender, EventArgs e)
 {
     DatePicker_TextChanged(null, null);
     DatePicker.Hide();
 }
Exemple #12
0
        private void InitForm()
        {
            //初始化参数
            ShowDialogType = ShowDialogType.Idle;
            //dgv_Blocks
            dgv_Blocks.AutoGenerateColumns = false;
            Node_Name.DataPropertyName     = nameof(EarthworkBlock.Name);
            Node_Name.Tag        = nameof(EarthworkBlock.Name);
            Node_Description.Tag = nameof(EarthworkBlock.Description);
            Node_Description.DataPropertyName = nameof(EarthworkBlock.Description);
            PmSoft.Common.CommonClass.FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(EarthworkBlockingForm), m_Doc);
            var blockingStr = "";

            recorder.ReadValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlocking, 1), ref blockingStr, recorder.GetValueAsInt(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlocking_Size, 1), 1000) + 2);
            if (blockingStr != "")
            {
                Blocking = Newtonsoft.Json.JsonConvert.DeserializeObject <EarthworkBlocking>(blockingStr);
            }
            else
            {
                Blocking = new EarthworkBlocking();
            }
            Blocking.InitByDocument(m_Doc);
            Blocking.Start();
            if (Blocking.Count() > 0)
            {
                dgv_Blocks.DataSource = Blocking.Blocks;
            }
            else
            {
                dgv_Blocks.DataSource = null;
            }
            //dgv_ConstructionInfo
            dgv_ImplementationInfo.AutoGenerateColumns     = false;
            ConstructionNode_Name.DataPropertyName         = nameof(EarthworkBlockImplementationInfo.Name);
            ConstructionNode_Name.ReadOnly                 = true;
            ConstructionNode_StartTime.DataPropertyName    = nameof(EarthworkBlockImplementationInfo.StartTimeStr);
            ConstructionNode_StartTime.Tag                 = nameof(DateTime);
            ConstructionNode_ExposureTime.DataPropertyName = nameof(EarthworkBlockImplementationInfo.ExposureTime);
            ConstructionNode_EndTime.DataPropertyName      = nameof(EarthworkBlockImplementationInfo.EndTimeStr);
            ConstructionNode_EndTime.Tag = nameof(DateTime);
            //初始化按钮
            ToolTip tip = new ToolTip();

            tip.SetToolTip(btn_AddNode, "新增节点");
            tip.SetToolTip(btn_DeleteNode, "删除选中节点");
            tip.SetToolTip(btn_UpNode, "上移节点");
            tip.SetToolTip(btn_DownNode, "下移节点");
            tip.SetToolTip(btn_AddElement, "新增构件");
            tip.SetToolTip(btn_DeleteElement, "删除构件");
            tip.SetToolTip(btn_ViewGt6, "查看(无支撑暴露时间)>6被标红的视图");
            tip.SetToolTip(btn_Preview, "查看按完工和未完工标注颜色的视图");
            //DatePicker
            DatePicker              = new DateTimePicker();
            DatePicker.Parent       = this;
            DatePicker.Width        = 100;
            DatePicker.Format       = DateTimePickerFormat.Custom;
            DatePicker.CustomFormat = "yyyy/MM/dd";
            DatePicker.ShowCheckBox = true;
            DatePicker.Hide();
            DatePicker.LostFocus   += DatePicker_LostFocus;
            DatePicker.TextChanged += DatePicker_TextChanged;
            //DateTimePicker
            DateTimePicker    = new DateTimePicker();
            DatePicker.Parent = this;
            DateTimePicker.Hide();
            DateTimePicker.Format       = DateTimePickerFormat.Custom;
            DateTimePicker.CustomFormat = "yyyy/MM/dd HH:mm";
            DateTimePicker.LostFocus   += DateTimePicker_LostFocus;
            dgv_ImplementationInfo.Controls.Add(DateTimePicker);
            this.FormClosing += EarthworkBlockingForm_FormClosing;
            //Color Buttons
            RenderColorButton(btn_Completed, Blocking.ColorForSettled);
            RenderColorButton(btn_Uncompleted, Blocking.ColorForUnsettled);
        }
Exemple #13
0
        void Init()
        {
            BackColor     = Color.BlanchedAlmond;
            StartPosition = FormStartPosition.CenterScreen;
            Name          = "Authorization";
            int width = this.Width / 2 - 50;

            LoginLabel = new Label
            {
                Location = new Point(width, 40),
                Size     = new Size(width, 25),
                Text     = "Логин"
            };
            LoginText = new TextBox {
                Location = new Point(width, 70),
                Size     = new Size(width, 25)
            };
            PaswordLabel = new Label
            {
                Location = new Point(width, 100),
                Size     = new Size(width, 25),
                Text     = "Пароль"
            };
            PaswordText = new TextBox
            {
                Location     = new Point(width, 130),
                Size         = new Size(width, 25),
                Text         = "",
                PasswordChar = '*',
                MaxLength    = 14
            };
            DateLabel = new Label
            {
                Location = new Point(width, 160),
                Size     = new Size(width, 25),
                Text     = "Дата рождения"
            };
            DateLabel.Hide();


            datePicker = new DateTimePicker
            {
                Location = new Point(width, 190),
                Size     = new Size(width, 25)
            };
            datePicker.Hide();



            LoginBtn = new Button
            {
                Location = new Point(width, 210),
                Size     = new Size(width, 25),
                Text     = "Авторизация"
            };
            LoginBtn.Click += LoginBtn_Click;
            RegBtn          = new Button
            {
                Location = new Point(width, 240),
                Size     = new Size(width, 25),
                Text     = "Регистрация"
            };
            RegBtn.Click += RegBtn_Click;
            SaveBtn       = new Button
            {
                Location = new Point(width, 240),
                Size     = new Size(width, 25),
                Text     = "Сохранить"
            };
            SaveBtn.Click += SaveBtn_Click;
            SaveBtn.Hide();
            Controls.AddRange(new Control[]
                              { LoginText, PaswordText, datePicker, LoginBtn,
                                RegBtn, SaveBtn, LoginLabel, PaswordLabel, DateLabel });
            if (correctUser != null)
            {
                try
                {
                    LoginText.Text   = correctUser.Login;
                    PaswordText.Text = correctUser.Password;

                    var v = DateTime.Parse(correctUser.BDay);
                    Console.WriteLine(v.Date);
                    datePicker.Value = v.Date;
                    RegBtn_Click(null, null);
                }
                catch
                {
                    Console.WriteLine("Error Date");
                }
            }
        }
Exemple #14
0
        private void createUI()
        {
            GroupBox topGroup = new GroupBox()
            {
                Dock = DockStyle.Fill, Text = "Ausnahmen für Benutzer " + userElement.Name
            };

            this.Controls.Add(topGroup);
            Panel bottomPanel = new Panel()
            {
                Dock = DockStyle.Bottom, Height = 45
            };

            this.Controls.Add(bottomPanel);

            dataGrid = new DataGridView()
            {
                Dock = DockStyle.Fill
            };
            topGroup.Controls.Add(dataGrid);
            dataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            dataGrid.AllowUserToDeleteRows       = true;
            dataGrid.AllowUserToAddRows          = true;
            dataGrid.CellValidating += new DataGridViewCellValidatingEventHandler(OnCellValidating);
            dataGrid.CellBeginEdit  += new DataGridViewCellCancelEventHandler(OnCellBeginEdit);

            DataGridViewColumn dateColumn = new DataGridViewTextBoxColumn()
            {
                HeaderText = "Datum", Width = 120
            };

            dataGrid.Columns.Add(dateColumn);
            DataGridViewColumn limitColumn = new DataGridViewTextBoxColumn()
            {
                HeaderText = "Minuten", Width = 120
            };

            dataGrid.Columns.Add(limitColumn);

            Button cancelButton = new Button()
            {
                Text = "Abbrechen", Size = new Size(100, 28)
            };

            cancelButton.Location = new Point(this.Size.Width - cancelButton.Size.Width - 16, 8);
            bottomPanel.Controls.Add(cancelButton);
            this.CancelButton = cancelButton;

            Button okButton = new Button()
            {
                Text = "Fertig", Size = new Size(100, 28)
            };

            okButton.Location = new Point(cancelButton.Left - okButton.Size.Width - 16, 8);
            bottomPanel.Controls.Add(okButton);
            this.AcceptButton = okButton;
            okButton.Click   += (sender, e) => { saveData(); };

            datePicker = new DateTimePicker();
            topGroup.Controls.Add(datePicker);
            datePicker.Visible       = false;
            datePicker.ValueChanged += (sender, e) => { dataGrid.CurrentCell.Value = datePicker.Value.ToShortDateString(); };
            datePicker.Leave        += (sender, e) => { datePicker.Hide(); };
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            connector = new DBConnector("127.0.0.1", "kolegijoskonsultacijos", "root");

            Button loginBtn = new Button();

            loginBtn.BackColor = Color.White;
            loginBtn.Text      = "Prisijungti";
            loginBtn.Click    += Login_Click;
            loginBtn.Location  = new Point(350 - loginBtn.Width / 2, 325);

            userNameBox          = new TextBox();
            userNameBox.Location = new Point(350 - userNameBox.Width / 2, 200);
            userNameBox.Text     = "Slapyvardis";

            passwordBox          = new TextBox();
            passwordBox.Location = new Point(350 - passwordBox.Width / 2, 250);
            passwordBox.Text     = "********";

            loginPanel      = new Panel();
            loginPanel.Size = new Size(700, 512);
            loginPanel.Controls.Add(loginBtn);
            loginPanel.Controls.Add(userNameBox);
            loginPanel.Controls.Add(passwordBox);



            Button registerConsult = new Button();

            registerConsult.BackColor = Color.White;
            registerConsult.Size      = new Size(120, 50);
            registerConsult.Text      = "Registruotis į konsultaciją";
            registerConsult.Click    += RegisterConsult_Click;
            registerConsult.Location  = new Point(320 - loginBtn.Width / 2, 100);

            Button watchConsult = new Button();

            watchConsult.BackColor = Color.White;
            watchConsult.Size      = new Size(120, 50);
            watchConsult.Text      = "Peržiūrėti mano konsultacijas";
            watchConsult.Click    += WatchConsult_Click;
            watchConsult.Location  = new Point(320 - loginBtn.Width / 2, 200);

            studentPanel      = new Panel();
            studentPanel.Size = new Size(700, 512);

            studentPanel.Controls.Add(registerConsult);
            studentPanel.Controls.Add(watchConsult);
            studentPanel.Hide();


            //studentConsultRegistrationPanel.Controls.Clear();

            Label registerLabel = new Label();

            registerLabel.Text     = "Registracija";
            registerLabel.Font     = new Font("Arial", 24, FontStyle.Bold);
            registerLabel.Size     = new Size(225, 50);
            registerLabel.Location = new Point(320 - registerLabel.Width / 2, 25);


            Label lectLabel = new Label();

            lectLabel.Text     = "Destytojai";
            lectLabel.Location = new Point(320 - lectLabel.Width / 2, 75);

            lecturerDropDownList                       = new ComboBox();
            lecturerDropDownList.Location              = new Point(320 - lecturerDropDownList.Width / 2, 100);
            lecturerDropDownList.SelectedValueChanged += OnLecturerDropDownListChanged;



            calenderRegister          = new DateTimePicker();
            calenderRegister.Location = new Point(320 - calenderRegister.Width / 2, 150);
            calenderRegister.MinDate  = DateTime.Now;
            calenderRegister.MaxDate  = new DateTime(DateTime.Now.Year, 6, 10);
            calenderRegister.Hide();
            calenderRegister.ValueChanged += DateChangedRegister;


            DUKBtn          = new Button();
            DUKBtn.Size     = new Size(70, 25);
            DUKBtn.Location = new Point(450, 100);
            DUKBtn.Text     = "DUK";
            DUKBtn.Click   += DUKClick;
            DUKBtn.Hide();


            timeOfDayToRegister = new Panel();

            timeOfDayToRegister.Size      = new Size(650, 100);
            timeOfDayToRegister.Location  = new Point(20, 200);
            timeOfDayToRegister.BackColor = Color.White;
            timeOfDayToRegister.Show();



            Button goBack2 = new Button();

            goBack2.Text     = "Grįžti";
            goBack2.Location = new Point(450, 45);
            goBack2.Click   += BackFromRegister;



            studentConsultRegistrationPanel      = new Panel();
            studentConsultRegistrationPanel.Size = new Size(700, 512);
            studentConsultRegistrationPanel.Controls.Add(registerLabel);
            studentConsultRegistrationPanel.Controls.Add(lecturerDropDownList);
            studentConsultRegistrationPanel.Controls.Add(lectLabel);
            studentConsultRegistrationPanel.Controls.Add(calenderRegister);
            studentConsultRegistrationPanel.Controls.Add(timeOfDayToRegister);
            studentConsultRegistrationPanel.Controls.Add(DUKBtn);
            studentConsultRegistrationPanel.Controls.Add(goBack2);
            studentConsultRegistrationPanel.Hide();

            studentConsults      = new Panel();
            studentConsults.Size = new Size(700, 512);

            studentConsults.Hide();

            Button DukLecturer = new Button();

            DukLecturer.Size     = new Size(120, 50);
            DukLecturer.Text     = "Mano D.U.K.";
            DukLecturer.Click   += MyDUKLecturer_Click;
            DukLecturer.Location = new Point(320 - loginBtn.Width / 2, 100);

            Button consultLecturer = new Button();

            consultLecturer.Size     = new Size(120, 50);
            consultLecturer.Text     = "Mano konsultacijos";
            consultLecturer.Click   += MyConsultLecturer_Click;
            consultLecturer.Location = new Point(320 - loginBtn.Width / 2, 200);


            lecturerPanel      = new Panel();
            lecturerPanel.Size = new Size(700, 512);
            lecturerPanel.Controls.Add(DukLecturer);
            lecturerPanel.Controls.Add(consultLecturer);
            lecturerPanel.Hide();


            lecturerDUKPanel            = new Panel();
            lecturerDUKPanel.Size       = new Size(700, 450);
            lecturerDUKPanel.AutoScroll = true;

            lecturerDUKPanel.Hide();


            calenderLecturer               = new DateTimePicker();
            calenderLecturer.Location      = new Point(250, 100);
            calenderLecturer.MinDate       = DateTime.Now;
            calenderLecturer.MaxDate       = new DateTime(DateTime.Now.Year, 6, 10);
            calenderLecturer.ValueChanged += DateChangedLecturer;

            lecturerConsultsPanel = new Panel();

            lecturerConsultsPanel.Size = new Size(700, 450);

            lecturerConsultsPanel.Hide();
            lecturerConsultsPanel.Controls.Add(calenderLecturer);

            Button goBack = new Button();

            goBack.Text     = "Atsijungti";
            goBack.Location = new Point(50, 250);
            goBack.Click   += ToToMain;

            Button goBack23 = new Button();

            goBack23.Text     = "Atsijungti";
            goBack23.Location = new Point(50, 250);
            goBack23.Click   += ToToMain;

            lecturerPanel.Controls.Add(goBack);
            studentPanel.Controls.Add(goBack23);

            Controls.Add(studentConsultRegistrationPanel);
            Controls.Add(studentPanel);
            Controls.Add(loginPanel);

            Controls.Add(studentConsults);
            Controls.Add(lecturerPanel);
            Controls.Add(lecturerDUKPanel);
            Controls.Add(lecturerConsultsPanel);
        }
Exemple #16
0
        public Food(string name)
        {
            this.calendar.ValueChanged += new System.EventHandler(this.calendar_ValueChanged);
            this.delete.Click          += new System.EventHandler(this.delete_Click);
            username = name;
            InitializeComponent();
            Region            = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 25, 25));
            userName.Text     = name;
            pnlNav.Height     = btnDashboard.Height;
            pnlNav.Top        = btnDashboard.Top;
            pnlNav.Left       = btnDashboard.Left;
            calendar.Location = new Point(statusLabel.Left, 55);
            this.Controls.Add(calendar);
            calendar.Hide();
            btnDashboard.BackColor = Color.FromArgb(46, 51, 73);
            LogBase userData = new LogBase();
            string  query    = "SELECT * FROM USER WHERE USERNAME='******'";

            userData.OpenConnection();
            SQLiteCommand    getUser   = new SQLiteCommand(query, userData.myConnection);
            SQLiteDataReader result    = getUser.ExecuteReader();
            double           calFull   = 0;
            double           calBevitt = 0;

            if (result.HasRows)
            {
                while (result.Read())
                {
                    if (Convert.ToInt32(result["Sex"]) == 1)
                    {
                        calFull = 66.46 + (13.7 * Convert.ToInt32(result["Weight"])) + (5 * Convert.ToInt32(result["Height"])) - (6.8 * Convert.ToInt32(result["Age"]));
                    }
                    if (Convert.ToInt32(result["Sex"]) == 0)
                    {
                        calFull = 655.1 + (9.6 * Convert.ToInt32(result["Weight"])) + (1.8 * Convert.ToInt32(result["Height"])) - (4.7 * Convert.ToInt32(result["Age"]));
                    }
                    goal = Convert.ToInt32(result["Goal"]);
                }
            }

            query = "SELECT * FROM DATAS WHERE USERNAME='******'";
            SQLiteCommand getData = new SQLiteCommand(query, userData.myConnection);

            result = getData.ExecuteReader();
            double carbBevitt = 0;
            double protBevitt = 0;
            double fatBevitt  = 0;

            if (result.HasRows)
            {
                while (result.Read())
                {
                    if (DateTime.Now.ToString("yyyyMMdd") == result["Date"].ToString())
                    {
                        string[] temp = Convert.ToString(result["Cal"]).Split('/');
                        calBevitt  = Convert.ToDouble(temp[1]) + calBevitt;
                        carbBevitt = carbBevitt + Convert.ToDouble(result["Carb"]);
                        protBevitt = protBevitt + Convert.ToDouble(result["Prot"]);
                        fatBevitt  = fatBevitt + Convert.ToDouble(result["Fat"]);
                    }
                }
            }

            userData.CloseConnection();
            if (goal == 0)
            {
                calFull -= 200;
            }
            if (goal == 1)
            {
                calFull += 500;
            }

            double carbFull = (calFull * 0.45) / 4;
            double protFull = (calFull * 0.35) / 4;
            double fatFull  = (calFull * 0.20) / 8;


            double percent = Math.Round((calBevitt / calFull) * 100, MidpointRounding.AwayFromZero);

            if (percent < 100)
            {
                statPercent.Text  = percent.ToString() + "%";
                statPercent.Value = Convert.ToInt32(percent);
            }
            else
            {
                statPercent.Text  = percent.ToString() + "%";
                statPercent.Value = 100;
            }

            fatLabel.Text  = Math.Round(fatBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(fatFull, MidpointRounding.AwayFromZero) + " g";
            protLabel.Text = Math.Round(protBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(protFull, MidpointRounding.AwayFromZero) + " g";
            carbLabel.Text = Math.Round(carbBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(carbFull, MidpointRounding.AwayFromZero) + " g";
            cal.Text       = calBevitt + "/" + Math.Ceiling(calFull) + " kcal";
        }