Exemplo n.º 1
0
 private void toolStripMenuItem_ClearLog_Click(object sender, EventArgs e)
 {
     if (DialogResult.Yes == MessageBox.Show("פעולה זאת אינה ניתנת לשיחזור!\nהאם אתה רוצה להמשיך?", "אזהרה", MessageBoxButtons.YesNo, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button2, MessageBoxOptions.RtlReading))
     {
         LogEntryArr logEntryArr = new LogEntryArr();
         logEntryArr.Fill();
         if (!logEntryArr.DeleteArr())
         {
             MessageBox.Show("קרתה תקלה בעת ביצוע המחיקה", "תקלה", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
         }
         else
         {
             UpdateListView_Log((int)comboBox_Nominee.SelectedValue, DateTime.MinValue, DateTime.MaxValue);
         }
     }
 }
Exemplo n.º 2
0
        private void SetLastChangedTextbox(int nomineeDBId)
        {
            if (nomineeDBId > 0)
            {
                LogEntryArr logEntryArr = new LogEntryArr();
                logEntryArr.Fill();
                logEntryArr = logEntryArr.Filter(nomineeDBId, DateTime.MinValue, "");

                LogEntry logEntry = logEntryArr.GetLogEntryWithMaxId();
                textBox_Last_Change.Text = logEntry.DateTime.ToString();
                toolTip_Last_Changed.SetToolTip(textBox_Last_Change, logEntry.Entry);
            }
            else
            {
                textBox_Last_Change.Text = "";
                toolTip_Last_Changed.SetToolTip(textBox_Last_Change, null);
            }
        }
Exemplo n.º 3
0
        private void UpdateListView_Log(int nomineeDBId, DateTime from, DateTime to)
        {
            listView_Log.Clear();


            listView_Log.Columns.Add("תאריך");
            listView_Log.Columns.Add("שעה");
            listView_Log.Columns.Add("שם מועמד");
            listView_Log.Columns.Add("פעולה");

            LogEntryArr logEntryArr = new LogEntryArr();

            logEntryArr.Fill();
            logEntryArr = logEntryArr.Filter((int)comboBox_Nominee.SelectedValue, from, to);

            ListViewItem listViewItem;
            LogEntry     logEntry;

            for (int i = 0; i < logEntryArr.Count; i++)
            {
                logEntry     = logEntryArr[i] as LogEntry;
                listViewItem = new ListViewItem(logEntry.DateTime.ToString("dd-MM-yyyy"));
                listViewItem.SubItems.Add(logEntry.DateTime.ToString("HH:mm:ss"));
                listViewItem.SubItems.Add(logEntry.Nominee.ToString());
                listViewItem.SubItems.Add(logEntry.Entry);
                listView_Log.Items.Add(listViewItem);
            }



            //stop drawing the listview to prevent flickering.
            listView_Log.BeginUpdate();

            int width;

            foreach (ColumnHeader item in listView_Log.Columns)
            {
                //set the width to match the headersize and save the width in the int
                item.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
                width = item.Width;

                //reset the width to match the columncontent size
                item.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);

                //if the header size is bigger then the column size the return to the headersize.
                if (width > item.Width)
                {
                    item.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
                }

                //make the width bigger in abit.
                item.Width = (int)Math.Ceiling(item.Width * 1.5);
            }

            //redraw the listview
            listView_Log.EndUpdate();


            Size size = new Size(SystemInformation.VerticalScrollBarWidth, SystemInformation.HorizontalScrollBarHeight * 2 /*somehow the same as the columnHeader hight- wifh is unavailable*/);

            for (int i = 0; i < listView_Log.Columns.Count; i++)
            {
                size.Width += listView_Log.Columns[i].Width + 1;
            }
            for (int i = 0; i < listView_Log.Items.Count; i++)
            {
                size.Height += listView_Log.Items[i].Bounds.Height + 1;
            }
            listView_Log.Size = size;
        }