コード例 #1
0
        private void Parttime_Click(object sender, EventArgs e)
        {
            GridPart.Show();
            GridShow.Hide();
            GridFull.Hide();
            string          sql = "SELECT *,EMP_TIMEWORK * EMP_CHG_HOUR AS TOTAL FROM EMPLOYEE WHERE EMP_TYPE = 'P'";
            MySqlConnection con = new MySqlConnection("host = angsila.informatics.buu.ac.th; user = cs57160477; password = cs57160477; database = cs57160477");
            MySqlCommand    cmd = new MySqlCommand(sql, con);

            con.Open();
            GridPart.Rows.Clear();
            MySqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                string code  = reader.GetString("EMP_CODE");
                string fname = reader.GetString("EMP_FNAME");
                string lname = reader.GetString("EMP_LNAME");
                string hour  = reader.GetString("EMP_TIMEWORK");
                string chg   = reader.GetString("EMP_CHG_HOUR");
                string total = reader.GetString("TOTAL");
                GridPart.Rows.Add(code, fname, lname, hour, chg, total);
            }
            con.Close();
        }
コード例 #2
0
        internal static string CreateSearchField(Grid grid)
        {
            StringBuilder javascript = new StringBuilder(string.Empty);

            StringBuilder onblur = new StringBuilder(" onblur=\"");

            if (grid.InputHighLight != Color.Empty)
            {
                javascript.AppendFormat(
                    " onfocus=\"this.accessKey = this.style.backgroundColor;this.style.backgroundColor='{0}';\"",
                    Grid.ColorToHtml(grid.InputHighLight));
                onblur.Append("this.style.backgroundColor=this.accessKey;");
            }
            if (grid.ColumnChangedColour != Color.Empty)
            {
                onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(grid.ColumnChangedColour));
            }
            onblur.Append("\"");
            javascript.Append(onblur);

            string s =
                string.Format(
                    "<input {0}  type=\"text\" onkeypress=\"return submitenter(this,event)\" class=\"wgeditfield wgsearchfield\" name=\"{1}_gridsearch\" value=\"{2}\"/>&nbsp;",
                    javascript, grid.ClientID, grid.Search);

            GridPart customSearchField = GridPart.GetControl(grid, Enums.GridPart.SearchField);

            //			editorSystem.Web.HttpContext.Current.Server.ClientScript.RegisterClientScriptBlock(page.GetType(),"WGSearchBox", @"

            if (customSearchField != null)
            {
                StringBuilder builder         = new StringBuilder();
                StringWriter  theStringWriter = new StringWriter(builder);
                System.Web.UI.HtmlTextWriter theHtmlWriter = new System.Web.UI.HtmlTextWriter(theStringWriter);
                if (customSearchField.Html != null)
                {
                    Buttons.TextButtonControl(grid, customSearchField.Html, "SearchClick", new string[] {},
                                              grid.GetSystemMessageClass("Search", "wgsearch"));
                    customSearchField.m_InternalHtml = s + builder;
                }
                else
                {
                    theHtmlWriter.Write(Buttons.TextButtonControl(grid, grid.GetSystemMessage("Search"), "SearchClick", new string[] { },
                                                                  grid.GetSystemMessageClass("Search", "wgsearch")));
                    customSearchField.m_InternalHtml = s + builder;
                }
            }
            else
            {
                return
                    (String.Format(
                         "<table cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"middle\"><td>{0}</td><td>{1}</td></tr></table>",
                         s,

                         Buttons.TextButtonControl(grid, grid.GetSystemMessage("Search"), "SearchClick", new string[] {},
                                                   grid.GetSystemMessageClass("Search", "wgsearch"))));
            }
            return(string.Empty);
        }
コード例 #3
0
        public void IsComplete_OutOfRangeValue_ReturnsTrue()
        {
            thePart = new GridPart(valuesWith7);
            bool expected = true;

            bool actual = thePart.IsComplete();

            Assert.That(actual, Is.EqualTo(expected));
        }
コード例 #4
0
        public void IsComplete_CorrectValues_ReturnsTrue()
        {
            thePart = new GridPart(valuesCorrect);
            bool expected = true;

            bool actual = thePart.IsComplete();

            Assert.That(actual, Is.EqualTo(expected));
        }
コード例 #5
0
        public void IsComplete_Contains0_ReturnsFalse()
        {
            thePart = new GridPart(valuesWith0);
            bool expected = false;

            bool actual = thePart.IsComplete();

            Assert.That(actual, Is.EqualTo(expected));
        }
コード例 #6
0
        public void IsValid_OutOfRangeValue_ReturnsFalse()
        {
            thePart = new GridPart(valuesWith7);
            bool expected = false;

            bool actual = thePart.IsValid();

            Assert.That(actual, Is.EqualTo(expected));
        }
コード例 #7
0
        public void IsValid_Contains0_ReturnsTrue()
        {
            thePart = new GridPart(valuesWith0);
            bool expected = true;

            bool actual = thePart.IsValid();

            Assert.That(actual, Is.EqualTo(expected));
        }
コード例 #8
0
        public void IsCorrect_DuplicateValues_ReturnsFalse()
        {
            thePart = new GridPart(valuesWithDuplicate);
            bool expected = false;

            bool actual = thePart.IsCorrect();

            Assert.That(actual, Is.EqualTo(expected));
        }
コード例 #9
0
        public void GetInvalidValues_ReturnsExpectedValues()
        {
            thePart = new GridPart(valuesSparse);
            List <int> expected = new List <int>()
            {
                1, 4, 6
            };

            List <int> actual = thePart.GetInvalidValues();

            Assert.That(actual, Is.EquivalentTo(expected));
        }
コード例 #10
0
        internal static string CreateNewPostButton(Grid grid)
        {
            if (grid.AllowNew)
            {
                foreach (Column column in grid.MasterTable.Columns)
                {
                    if (column.ColumnType == ColumnType.SystemColumn &&
                        ((SystemColumn)column).SystemColumnType == Enums.SystemColumn.NewRecordLink)
                    {
                        if (column.Visibility == Visibility.None)
                        {
                            return(string.Empty);
                        }
                        if (((SystemColumn)column).Html != null)
                        {
                            return
                                (Buttons.TextButtonControl(grid, ((SystemColumn)column).Html, "NewRecordClick",
                                                           new string[] {},
                                                           grid.GetSystemMessageClass("NewRecord", "wgnewrecord")));
                        }
                        break;
                    }
                }

                GridPart customNewRecord = GridPart.GetControl(grid, Enums.GridPart.NewRecord);
                if (customNewRecord != null)
                {
                    StringBuilder builder         = new StringBuilder();
                    StringWriter  theStringWriter = new StringWriter(builder);
                    System.Web.UI.HtmlTextWriter theHtmlWriter = new System.Web.UI.HtmlTextWriter(theStringWriter);
                    string html = customNewRecord.Html ?? grid.GetSystemMessage("NewRecord");
                    theHtmlWriter.Write(Buttons.TextButtonControl(grid, html, "NewRecordClick", new string[] {},
                                                                  grid.GetSystemMessageClass("NewRecord", "wgnewrecord")));
                    customNewRecord.m_InternalHtml = builder.ToString();
                }
                else
                {
                    return(Buttons.TextButtonControl(grid, grid.GetSystemMessage("NewRecord"), "NewRecordClick",
                                                     new string[] {},
                                                     grid.GetSystemMessageClass("NewRecord", "wgnewrecord")));
                }
            }
            return(string.Empty);
        }
コード例 #11
0
        internal static string CreateUpdateRowsButton(Grid grid)
        {
            foreach (Column column in grid.MasterTable.Columns)
            {
                if (column.Visibility != Visibility.Grid)
                {
                    continue;
                }
                if (column.ColumnType != ColumnType.SystemColumn ||
                    ((SystemColumn)column).SystemColumnType != Enums.SystemColumn.UpdateRecordsLink)
                {
                    continue;
                }
                string html = ((SystemColumn)column).Html;

                if (string.IsNullOrEmpty(html))
                {
                    continue;
                }
                return(Buttons.TextButtonControl(grid, html, "UpdateRowsClick", new string[] {},
                                                 grid.GetSystemMessageClass("NewRecord", "wgnewrecord")));
            }

            GridPart customUpdateRecords = GridPart.GetControl(grid, Enums.GridPart.UpdateRecords);

            if (customUpdateRecords != null)
            {
                StringBuilder builder         = new StringBuilder();
                StringWriter  theStringWriter = new StringWriter(builder);
                System.Web.UI.HtmlTextWriter theHtmlWriter = new System.Web.UI.HtmlTextWriter(theStringWriter);
                string html = customUpdateRecords.Html ?? grid.GetSystemMessage("UpdateRows");
                theHtmlWriter.Write(Buttons.TextButtonControl(grid, html, "UpdateRowsClick", new string[] { },
                                                              grid.GetSystemMessageClass("UpdateRows", "wgupdaterecords"), null, string.Format("{0}_wgupdaterecords", grid.ID))
                                    );

                customUpdateRecords.m_InternalHtml = builder.ToString();
                return(null);
            }
            return(Buttons.TextButtonControl(grid, grid.GetSystemMessage("UpdateRows"), "UpdateRowsClick",
                                             new string[] {},
                                             grid.GetSystemMessageClass("UpdateRows", "wgupdaterecords"), null, string.Format("{0}_wgupdaterecords", grid.ID)));
        }
コード例 #12
0
        internal static string CreatePager(Grid grid)
        {
            Pager pager = grid.PagerSettings;

            if (pager.PagerType == PagerType.None)
            {
                return(string.Empty);
            }
            pager.ImagePath   = grid.ImagePath;
            pager.m_PagerGrid = grid;

            GridPart customPager = GridPart.GetControl(grid, Enums.GridPart.Pager);

            if (customPager != null)
            {
                customPager.m_InternalHtml = pager.GetPager;
                return(null);
            }
            return(pager.GetPager);
        }
コード例 #13
0
 private void Form7_Load(object sender, EventArgs e)
 {
     GridFull.Hide();
     GridPart.Hide();
 }