コード例 #1
0
ファイル: frmMain.cs プロジェクト: etechuk/hcfcpc
 private void sheet_SelectionRangeChanged(object sender, unvell.ReoGrid.Events.RangeEventArgs e)
 {
     Worksheet sheet = rgBookings.CurrentWorksheet;
     ReoGridRange r = sheet.SelectionRange;
     SharedData.dtSelectedStart = Convert.ToDateTime(sheet[1, r.StartPos.Col].ToString());
     SharedData.dtSelectedFinish = Convert.ToDateTime(sheet[1, r.EndPos.Col].ToString());
     string sRooms = "";
     for (int i = r.StartPos.Row; i <= r.EndPos.Row; i++)
     {
         sRooms += (sRooms.Length > 0 ? "|" : "") + sheet.Cells[i, 0].Tag.ToString();
     }
     SharedData.sBookingRooms = sRooms;
 }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: etechuk/hcfcpc
        private void sheet_CellMouseEnter(object sender, unvell.ReoGrid.Events.CellMouseEventArgs e)
        {
            Worksheet sheet = e.Worksheet;
            ReoGridPos p = sheet.HoverPos;
            if (sheet.Cells[p].Tag != null && sheet.Cells[p].Tag.ToString().Length > 0)
            {
                DataSet d = Program.DB.SelectAll("SELECT BName,BCompany,BDates,BTimes,BComments FROM Jobs WHERE ID=" + sheet.Cells[p].Tag.ToString() + ";");
                if (d.Tables.Count > 0 && d.Tables[0].Rows.Count > 0)
                {
                    string sDate = "", sStart = "", sFinish = "";
                    DataRow row = d.Tables[0].Rows[0];

                    if (ab == null)
                    {
                        ShowTooltip();
                    }

                    string[] sDates = new string[] { };
                    if (row["BDates"] != DBNull.Value)
                    {
                        sDates = row["BDates"].ToString().Split('|');
                        if (sDates.Length == 2)
                        {
                            sDates[0] = sDates[0].Replace(" 00:00:00", "");
                            sDates[1] = sDates[1].Replace(" 00:00:00", "");
                            sDate = sDates[0] + " - " + sDates[1];
                        }
                    }

                    if (row["BTimes"] != DBNull.Value)
                    {
                        string[] sTimes = row["BTimes"].ToString().Split('|');
                        if (sTimes.Length == 2 && sDates.Length == 2)
                        {
                            sDates[0] += " " + sTimes[0] + ":00";
                            sDates[1] += " " + sTimes[1] + ":00";
                            sStart = sTimes[0];
                            sFinish = sTimes[1];

                            DateTime now = DateTime.Now;
                            int iYear = now.Year, iMonth = now.Month, iDay = now.Day;

                            string[] d1 = sDates[0].Split('/');
                            string[] t1 = sTimes[0].Split(':');
                            iYear = Convert.ToInt32(d1[2].Substring(0, d1[2].IndexOf(' ')));
                            iMonth = Convert.ToInt32(d1[1]);
                            iDay = Convert.ToInt32(d1[0]);
                            sStart = new DateTime(iYear, iMonth, iDay, Convert.ToInt32(t1[0]), Convert.ToInt32(t1[1]), 0).ToString("hh:mm");

                            string[] d2 = sDates[1].Split('/');
                            string[] t2 = sTimes[1].Split(':');
                            iYear = Convert.ToInt32(d2[2].Substring(0, d2[2].IndexOf(' ')));
                            iMonth = Convert.ToInt32(d2[1]);
                            iDay = Convert.ToInt32(d2[0]);
                            sFinish = new DateTime(iYear, iMonth, iDay, Convert.ToInt32(t2[0]), Convert.ToInt32(t2[1]), 0).ToString("hh:mm");
                        }
                    }

                    string sCompany = "";
                    if (d.Tables[0].Rows[0]["BCompany"].ToString().Length > 0)
                    {
                        DataSet ds = Program.DB.SelectAll("SELECT Name FROM Companies WHERE ID=" + d.Tables[0].Rows[0]["BCompany"].ToString() + ";");
                        if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                        {
                            sCompany = ds.Tables[0].Rows[0]["Name"].ToString();
                        }
                    }

                    b.Text = "";
                    b.CaptionText = d.Tables[0].Rows[0]["BName"].ToString();
                    if (sCompany.Length > 0 && !sCompany.Any(char.IsDigit))
                    {
                        b.Text = sCompany;
                    }
                    if (sDate.Length > 0)
                    {
                        b.Text += b.Text.Length > 0 ? Environment.NewLine : "";
                        b.Text += sDate;
                    }
                    if (sStart.Length > 0 && sFinish.Length > 0)
                    {
                        b.Text += b.Text.Length > 0 ? Environment.NewLine : "";
                        b.Text += sStart + " - " + sFinish;
                    }
                    b.AutoResize();
                    b.Show(rgBookings, false);
                }
            }
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: etechuk/hcfcpc
        private void sheet_CellMouseLeave(object sender, unvell.ReoGrid.Events.CellMouseEventArgs e)
        {
            Worksheet sheet = e.Worksheet;
            ReoGridPos p = sheet.HoverPos;
            if (sheet.Cells[p].Tag != null)
            {
                return;
            }

            if (b != null && b.Visible)
            {
                b.Hide();
            }
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: etechuk/hcfcpc
 private void sheet_CellMouseDown(object sender, unvell.ReoGrid.Events.CellMouseEventArgs e)
 {
     if (e.Cell != null && e.Cell.Tag != null)
     {
         iSSItemSelected = Convert.ToInt32(e.Cell.Tag);
     }
 }