Esempio n. 1
0
        /// <summary>
        /// Changes in the columns, items or subitems
        /// </summary>
        /// <param name="ctType"></param>
        /// <param name="column"></param>
        /// <param name="item"></param>
        /// <param name="subItem"></param>
        public ChangedEventArgs(ChangedTypes ctType, GLColumn column, GLItem item, GLSubItem subItem)
        {
            m_Column  = column;
            m_Item    = item;
            m_SubItem = subItem;

            m_ctType = ctType;
        }
Esempio n. 2
0
        /// <summary>
        /// remove an item from the list
        /// </summary>
        /// <param name="item"></param>
        public void Remove(GLItem item)
        {
            List.Remove(item);

            if (ChangedEvent != null)
            {
                ChangedEvent(this, new ChangedEventArgs(ChangedTypes.ItemCollectionChanged, null, null, null));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// insert an item into the list at specified index
        /// </summary>
        /// <param name="nIndex"></param>
        /// <param name="strItemText"></param>
        /// <returns></returns>
        public GLItem Insert(int nIndex, string strItemText)
        {
            GLItem item = new GLItem(Parent);                                   //GLItem item = new GLItem(Parent);

            item.SubItems[0].Text = strItemText;

            nIndex = Insert(nIndex, item);

            return(item);
        }
Esempio n. 4
0
 /// <summary>
 /// Clears all selection bits in the item structure
 ///
 /// this overload is an optimization to stop a redraw on a re-selection
 /// </summary>
 public void ClearSelection(GLItem itemIgnore)
 {
     for (int index = 0; index < List.Count; index++)
     {
         GLItem citem = this[index];
         if (citem != itemIgnore)
         {
             citem.Selected = false;                                                                                                             // changed will generate an invalidation by themselves
         }
     }
 }
        private static void AddToGlacialList1(GlacialList xListView, string xSql)
        {
            xListView.BeginUpdate();
            //xListView.Items.Clear();

            if (Program.DBConn.State.ToString().ToUpper() == "CLOSED")
            {
                Program.DBConn.Open();
            }
            SqlDataReader xRtn = Program.SqlReader(xSql);
            if (xRtn == null)
            {
                xRtn.Dispose();
                xListView.Update();
                xListView.EndUpdate();
                return;
            }
            if (xRtn.HasRows == false)
            {
                xRtn.Close();
                xRtn.Dispose();
                xListView.Update();
                xListView.EndUpdate();
                return;
            }
            int xFieldCount;
            xFieldCount = xRtn.FieldCount;
            GLItem lvi;
            xListView.Update();
            //xListView.BeginUpdate();
            while (xRtn.Read())
            {

                lvi = new GLItem();
                for (int col = 0; col < xFieldCount; col++)
                {
                    if (col == 0)
                    {
                        lvi = xListView.Items.Add(xRtn.GetValue(col).ToString().Trim());

                    }
                    else
                    {
                        lvi.SubItems[col].Text = xRtn.GetValue(col).ToString().Trim();

                    }
                }

            }
            xListView.EndUpdate();
            xRtn.Close();
            xRtn.Dispose();
            return;
        }
Esempio n. 6
0
        /// <summary>
        /// Find the index of a specified item
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public int FindItemIndex(GLItem item)                   // use -1 to have it start from the beginning of the list
        {
            for (int nIndex = 0; nIndex < Count; nIndex++)
            {
                if (item == this[nIndex])
                {
                    return(nIndex);
                }
            }

            return(-1);                                 // couldn't find it
        }
Esempio n. 7
0
        /// <summary>
        /// Conversion to string
        /// </summary>
        /// <param name="context"></param>
        /// <param name="culture"></param>
        /// <param name="value"></param>
        /// <param name="destinationType"></param>
        /// <returns></returns>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(InstanceDescriptor) && value is GLItem)
            {
                GLItem column = (GLItem)value;

                ConstructorInfo ci = typeof(GLItem).GetConstructor(new Type[] {});
                if (ci != null)
                {
                    return(new InstanceDescriptor(ci, null, false));
                }
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
Esempio n. 8
0
        public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl)
        {
            m_item    = item;
            m_subItem = subItem;
            m_Parent  = listctrl;

            this.Text = subItem.Text;

            this.Items.Add("i1");
            this.Items.Add("i2");
            this.Items.Add("i3");

            return(true);
        }
Esempio n. 9
0
        private bool CompareItems(GLItem item1, GLItem item2, CompareDirection direction)
        {
            // add a numeric compare here also
            bool dir = false;

            if (direction == CompareDirection.GreaterThan)
            {
                dir = true;
            }

            if (this.SortDirection == SortDirections.SortAscending)
            {
                dir = !dir;                             // flip it
            }
            if (!this.NumericCompare)
            {
                if (dir)
                {
                    return(item1.SubItems[SortColumn].Text.CompareTo(item2.SubItems[SortColumn].Text) < 0);
                }
                else
                {
                    return(item1.SubItems[SortColumn].Text.CompareTo(item2.SubItems[SortColumn].Text) > 0);
                }
            }
            else
            {
                try
                {
                    double n1 = Double.Parse(item1.SubItems[SortColumn].Text);
                    double n2 = Double.Parse(item2.SubItems[SortColumn].Text);

                    if (dir)
                    {                           // compare the numeric values inside the columns
                        return(n1 < n2);
                    }
                    else
                    {
                        return(n1 > n2);
                    }
                }
                catch (Exception ex)
                {
                    // no numeric value (bad bad)
                    Debug.WriteLine(ex.ToString());
                    return(false);
                }
            }
        }
Esempio n. 10
0
        public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl)                                        // populate this control however you wish with item
        {
            // set the styles you want for this
            this.BorderStyle = BorderStyle.None;
            this.AutoSize    = false;


            m_item    = item;
            m_subItem = subItem;
            m_Parent  = listctrl;

            this.Text = subItem.Text;

            return(true);                                               // we don't do any heavy processing in this ctrl so we just return true
        }
Esempio n. 11
0
        public void sort(GLItemCollection items, int low_0, int high_0)
        {
            int lo = low_0;
            int hi = high_0;

            if (lo >= hi)
            {
                return;
            }

            int mid = (lo + hi) / 2;


            sort(items, lo, mid);
            sort(items, mid + 1, hi);


            int end_lo   = mid;
            int start_hi = mid + 1;

            while ((lo <= end_lo) && (start_hi <= hi))
            {
                if (StopRequested)
                {
                    return;
                }

                if (CompareItems(items[lo], items[start_hi], CompareDirection.LessThan))
                {
                    lo++;
                }
                else
                {
                    GLItem T = items[start_hi];
                    for (int k = start_hi - 1; k >= lo; k--)
                    {
                        items[k + 1] = items[k];
                    }

                    items[lo] = T;
                    lo++;
                    end_lo++;
                    start_hi++;
                }
            }
        }
Esempio n. 12
0
        private void btnAddGroup_Click(object sender, EventArgs e)
        {
            GLItem i = new GLItem();
            GLSubItem si_addr = new GLSubItem();
            si_addr.Text = "0/0/0";
            si_addr.ChangedEvent += new ChangedEventHandler(subItemAddr_ChangedEvent);

            GLSubItem si_len = new GLSubItem();
            si_len.Text = "1";
            si_len.ChangedEvent += new ChangedEventHandler(subItemLen_ChangedEvent);

            i.SubItems.Add(si_addr);
            i.SubItems.Add(si_len);
            KnownGroup kg = new KnownGroup();
            kg.Address = "0/0/0";
            kg.NumBytes = 1;
            i.Tag = kg;
            this.lvGroups.Items.Add(i);
        }
Esempio n. 13
0
 public void LoadData()
 {
     if (Groups == null)
     {
         return;
     }
     foreach (var item in Groups.List)
     {
         GLItem i = new GLItem();
         GLSubItem si_addr = new GLSubItem();
         si_addr.Text = item.Address;
         si_addr.ChangedEvent += new ChangedEventHandler(subItemAddr_ChangedEvent);
         GLSubItem si_len = new GLSubItem();
         si_len.ChangedEvent += new ChangedEventHandler(subItemLen_ChangedEvent);
         si_len.Text = item.NumBytes.ToString();
         i.SubItems.Add(si_addr);
         i.SubItems.Add(si_len);
         i.Tag = item;
         this.lvGroups.Items.Add(i);
     }
 }
Esempio n. 14
0
        /// <summary>
        /// lowest level of add/insert.  All add and insert routines eventually call this
        ///
        /// in the future always have routines call this one as well to keep one point of entry
        /// </summary>
        /// <param name="nIndex"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        public int Insert(int nIndex, GLItem item)
        {
            item.Parent = this.Parent;

            item.ChangedEvent += new ChangedEventHandler(Item_Changed);

            if (nIndex < 0)
            {
                nIndex = List.Add(item);                                        // add the item itself
            }
            else
            {
                List.Insert(nIndex, item);
            }

            if (ChangedEvent != null)
            {
                ChangedEvent(this, new ChangedEventArgs(ChangedTypes.ItemCollectionChanged, null, null, null));
            }

            return(nIndex);
        }
Esempio n. 15
0
        public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl)
        {
            this.Format = DateTimePickerFormat.Long;
            try
            {
                m_item    = item;
                m_subItem = subItem;
                m_Parent  = listctrl;

                this.Text = subItem.Text;

                //this.Value = subItem.Text;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());

                this.Text = DateTime.Now.ToString();
            }

            return(true);
        }
		/// <summary>
		/// remove an item from the list
		/// </summary>
		/// <param name="item"></param>
		public void Remove( GLItem item )
		{
			List.Remove( item );

			if ( ChangedEvent != null )
				ChangedEvent( this, new ChangedEventArgs( ChangedTypes.ItemCollectionChanged, null, null, null ) );
		}
Esempio n. 17
0
        private void btnItm_Sav_Click(object sender, EventArgs e)
        {
            string xSqlStr1 = "", xSqlStr2 = "";

            string xGoodsSys = "";
            string xSysNo = treeView1.SelectedNode.Name.ToString().Substring(10, 10);  //截取出来
            string xAdrStr = lProc.GetFullKeys(treeView1);
            string xSql1, xSql2;
            if (TxtID.Text == "")
            {
                MessageBox.Show("礼品编号不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (TxtName.Text == "")
            {
                MessageBox.Show("礼品名称不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (lProc.CheckPunctuation(TxtName.Text) == false)
            {
                MessageBox.Show("礼品名称中不能包含单引号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            switch(UsrMod)
            {
                case 1:  //添加礼品保存
                    if (lProc.SeekFunc("SELECT * FROM Gift WHERE Gift_NO='" + TxtID.Text + "'") == true)
                    {
                        MessageBox.Show("礼品编号不能重复");
                        return;
                    }

                    if (xSysNo == Program.RootCode)
                    {
                        xSysNo = lProc.GetGoodsSysCode("SysGift");
                    }
                    xGoodsSys = lProc.GetGoodsSysCode("SysGift");
                    //TxtID.Text = xGoodsSys;

                    xSql1 = "INSERT INTO Gift(SysNo,Gift_SYS,Gift_NO,Gift_NAME,Gift_UNIT,Integral,NOTE,AdrsStr) VALUES ('"
                        + xSysNo + "','" + xGoodsSys + "','"+TxtID .Text .Trim ()+"','" + TxtName.Text.Trim() + "','"+TxtUnit .Text .Trim ()+"','" + TxtIntegral.Text.Trim() + "','"
                        + TxtNote.Text.Trim() + "','" + xAdrStr + "')";
                    xSqlStr1 = Program.SqlCmd(xSql1);
                    if (xSqlStr1 != null)
                    {
                        MessageBox.Show(xSqlStr1, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    xSql2 = "UPDATE GiftType SET SysNo='" + xSysNo + "' WHERE Code='" + treeView1.SelectedNode.Name.ToString().Substring(0, 10) + "'";
                    xSqlStr2 = Program.SqlCmd(xSql2);
                    if (xSqlStr2 != null)
                    {
                        MessageBox.Show(xSqlStr2, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (treeView1.SelectedNode.SelectedImageIndex != 0)
                    {
                        treeView1.SelectedNode.Name = treeView1.SelectedNode.Name.ToString().Substring(0, 10) + xSysNo;
                        treeView1.SelectedNode.SelectedImageIndex = 1;
                        treeView1.SelectedNode.ImageIndex = 1;
                    }

                    GLItem xItems = new GLItem(glacialList1);
                    xItems.SubItems[0].Text = TxtID.Text.Trim ();
                    xItems.SubItems[1].Text = TxtName.Text.Trim();
                    xItems.SubItems[2].Text = TxtUnit.Text.Trim();
                    xItems.SubItems[3].Text = TxtIntegral.Text.Trim();
                    xItems.SubItems[4].Text = TxtNote.Text.Trim();
                    xItems.SubItems[5].Text = xGoodsSys.ToString();
                    glacialList1.BeginUpdate();
                    glacialList1.Items.Add(xItems);
                    glacialList1.EndUpdate();
                    xItems.Selected = true;
                    MessageBox.Show("添加成功");

                   break;
                case 2: //修改礼品保存
                   if (lProc.SeekFunc("SELECT Gift_NAME FROM Gift WHERE Gift_NO='" + TxtID.Text + "'") == false)
                   {
                       MessageBox.Show("请将添加礼品保存后再进行修改");
                       return;
                   }
                    foreach(GLItem xItem in glacialList1.SelectedItems)  //修改礼品信息
                    {/////////////////////////////////
                        xGoodsSys=xItem.SubItems[5].Text;

                        xSql1 = "UPDATE Gift SET Gift_NAME='" + TxtName.Text
                            + "', Gift_NO='" + TxtID.Text
                            + "', Integral='" + TxtIntegral.Text.Trim()
                            + "', Gift_UNIT='" + TxtUnit .Text .Trim ()
                            + "', NOTE='" + TxtNote .Text .Trim ()
                            + "' WHERE Gift_SYS='" + xItem.SubItems[5].Text + "' ";
                        xSqlStr1 = Program.SqlCmd(xSql1); //更新礼品表信息
                        if (xSqlStr1 != null)
                        {
                            MessageBox.Show(xSqlStr1, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    foreach (GLItem xItem in glacialList1.SelectedItems)  //绘制礼品表
                    {
                        xItem.SubItems[0].Text = TxtID.Text.Trim ();
                        xItem.SubItems[1].Text = TxtName.Text.Trim ();
                        xItem.SubItems[3].Text = TxtIntegral .Text .Trim ();
                        xItem.SubItems[2].Text = TxtUnit.Text.Trim();
                        xItem.SubItems[4].Text = TxtNote.Text.Trim();

                    }////////////////////////

                    MessageBox.Show("修改成功");
                    break;
            }

            frm1();
        }
Esempio n. 18
0
 private void RemoveActivity(GLItem item)
 {
     item.ForeColor = Color.Gray;
     ((ActivityPresentation)item.Tag).Modified = ModificationStatus.Deleted;
     applyChangesButton.Enabled = true;
 }
Esempio n. 19
0
        /// <summary>
        /// Ściąga pliki z serwera
        /// </summary>
        /// <param name="nazwyPlikow">Lista plików do ściagnięcia</param>
        /// <param name="uzytkownik">Użytkownik od którego mają być ściągane pliki</param>
        /// <param name="gli">Zmienna reprezentuje pasek postępu</param>
        /// <param name="path">Zmienna reprezentuje folder do zapisu pliku</param>
        /// <returns>Odpowiedź od serwera lub 1 w przypadku gdy wszystko poszło dobrze</returns>
        public int downloadFiles(string[] nazwyPlikow, string uzytkownik, GLItem gli, string path)
        {
            if (uzytkownik.Length == 0) uzytkownik = ".";
            try
            {
                downloadPliku download = new downloadPliku(sessionID, (int)operacje.pobieranie, uzytkownik, nazwyPlikow);
                XmlSerializer xml = new XmlSerializer(typeof(downloadPliku));
                StringWriter stringWriter = new StringWriter();
                xml.Serialize(stringWriter, download, names);
                string str = stringWriter.ToString() + endl;
                wyslij(ASCIIEncoding.ASCII.GetBytes(str), str.Length);
            }
            catch (Exception)
            {
                throw new Wyjatki.BladWysylania("Blad podczas wysylania danych na serwer. Sprawdz polaczenie z internetem, oraz ewentualnie ustaw proxy -- zapytanie o sciagniecie plikow");
            }
            foreach (string s in nazwyPlikow)
            {
                serwerPliki plikiNaSerwerze = new serwerPliki();
                string[] tab = s.Split("/".ToCharArray());
                string tmp = (folder[folder.Length-1]=='/'?folder:folder+"/");
                for (int i = 0; i < tab.Length - 1; i++)
                {
                    tmp += tab[i] + "/";
                    if (!Directory.Exists(tmp))
                        Directory.CreateDirectory(tmp);
                }
                try
                {
                    XmlSerializer xml = new XmlSerializer(typeof(serwerPliki));
                    string str = pobierz();

                    StringReader stringReader = new StringReader(str);
                    plikiNaSerwerze = (serwerPliki)xml.Deserialize(stringReader);
                }
                catch (Wyjatki.BladOdbierania bo)
                {
                    bo.add("-- odpowiedz sciaganie plikow");
                    throw bo;
                }
                catch (Exception)
                {
                    throw new Wyjatki.BladParsowania("Dostano bledne dane od serwera lub nastapil blad programu -- odpowiedz sciaganie plikow");
                }
                if (plikiNaSerwerze.operacja != (int)operacje.pobieranie) return -3;
                if (plikiNaSerwerze.odp == (int)odpowiedzi.wszystko_ok)
                {
                    if (plikiNaSerwerze.plik.Count != 1)
                    {
                        StringWriter stringWriter = new StringWriter();
                        klientOdpDownload kod = new klientOdpDownload(sessionID, (int)operacje.pobieranie, "ok");
                        XmlSerializer xml = new XmlSerializer(typeof(klientOdpDownload));
                        xml.Serialize(stringWriter, kod, names);
                        string str = stringWriter.ToString() + endl;
                        wyslij(ASCIIEncoding.ASCII.GetBytes(str), str.Length);
                        StringReader stringReader = new StringReader("");
                        str = pobierz();
                        XmlSerializer xmlO = new XmlSerializer(typeof(serwerBase));
                        serwerBase odpSerwera = (serwerBase)xmlO.Deserialize(new StringReader(str));
                        continue;
                    }
                    plikInfo p = plikiNaSerwerze.plik[0];
                    if (p.rozmiar >= 0)
                    {
                        FileStream streamWriter = null;
                        if (path == null)
                            streamWriter = new FileStream(folder + "/" + p.nazwa, FileMode.OpenOrCreate, FileAccess.Write);
                        else
                        {
                            if (p.rozmiar == 0)
                                ((ProgressBar)gli.SubItems[1].Control).PerformStep();
                            streamWriter = new FileStream(path + "/" + p.nazwa, FileMode.OpenOrCreate, FileAccess.Write);
                        }
                        try
                        {
                            StringWriter stringWriter = new StringWriter();
                            klientOdpDownload kod = new klientOdpDownload(sessionID, (int)operacje.pobieranie, "ok");
                            XmlSerializer xml = new XmlSerializer(typeof(klientOdpDownload));
                            xml.Serialize(stringWriter, kod, names);
                            string str = stringWriter.ToString() + endl;
                            wyslij(ASCIIEncoding.ASCII.GetBytes(str), str.Length);
                            int rozmiar = p.rozmiar;
                            int tempRozmiar = rozmiar;
                            while (tempRozmiar > 0)
                            {

                                int readSize = 102400;
                                if (tempRozmiar < readSize)
                                {
                                    readSize = tempRozmiar;
                                }
                                byte[] bytes;
                                int odebrane = pobierz(readSize, out bytes);
                                tempRozmiar -= odebrane;
                                streamWriter.Write(bytes, 0, odebrane);
                                if (gli != null)
                                {
                                    ProgressBar pb = (ProgressBar)gli.SubItems[1].Control;
                                    object[] obj = new object[] { pb, odebrane };
                                    postep(pb, odebrane);
                                }
                            }
                            streamWriter.Close();
                        }
                        catch (Exception ex)
                        {
                            throw new Wyjatki.BladOdbierania("Wystapil Blad podczas odbierania pliku z serwera -- odbieranie pliku i zapisywanie");
                        }
                        finally
                        {
                            streamWriter.Close();
                        }
                    }
                }
            }
            return 1;
        }
Esempio n. 20
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            GlacialComponents.Controls.GLColumn  glColumn1   = new GlacialComponents.Controls.GLColumn();
            GlacialComponents.Controls.GLColumn  glColumn2   = new GlacialComponents.Controls.GLColumn();
            GlacialComponents.Controls.GLColumn  glColumn3   = new GlacialComponents.Controls.GLColumn();
            GlacialComponents.Controls.GLColumn  glColumn4   = new GlacialComponents.Controls.GLColumn();
            GlacialComponents.Controls.GLItem    glItem1     = new GlacialComponents.Controls.GLItem();
            GlacialComponents.Controls.GLSubItem glSubItem1  = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem2  = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem3  = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem4  = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLItem    glItem2     = new GlacialComponents.Controls.GLItem();
            GlacialComponents.Controls.GLSubItem glSubItem5  = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem6  = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem7  = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem8  = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLItem    glItem3     = new GlacialComponents.Controls.GLItem();
            GlacialComponents.Controls.GLSubItem glSubItem9  = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem10 = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem11 = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem12 = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLItem    glItem4     = new GlacialComponents.Controls.GLItem();
            GlacialComponents.Controls.GLSubItem glSubItem13 = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem14 = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem15 = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem16 = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLItem    glItem5     = new GlacialComponents.Controls.GLItem();
            GlacialComponents.Controls.GLSubItem glSubItem17 = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem18 = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem19 = new GlacialComponents.Controls.GLSubItem();
            GlacialComponents.Controls.GLSubItem glSubItem20 = new GlacialComponents.Controls.GLSubItem();
            System.Resources.ResourceManager     resources   = new System.Resources.ResourceManager(typeof(Form1));
            this.glacialList1 = new GlacialComponents.Controls.GlacialList();
            this.imageList1   = new System.Windows.Forms.ImageList(this.components);
            this.mainMenu1    = new System.Windows.Forms.MainMenu();
            this.menuItem1    = new System.Windows.Forms.MenuItem();
            this.menuItem2    = new System.Windows.Forms.MenuItem();
            this.SuspendLayout();
            //
            // glacialList1
            //
            this.glacialList1.AllowColumnResize      = true;
            this.glacialList1.AllowMultiselect       = false;
            this.glacialList1.AlternateBackground    = System.Drawing.Color.ForestGreen;
            this.glacialList1.AlternatingColors      = true;
            this.glacialList1.AutoHeight             = true;
            this.glacialList1.BackColor              = System.Drawing.SystemColors.ControlLightLight;
            this.glacialList1.BackgroundStretchToFit = true;
            glColumn1.ActivatedEmbeddedType          = GlacialComponents.Controls.GLActivatedEmbeddedTypes.TextBox;
            glColumn1.CheckBoxes            = true;
            glColumn1.ImageIndex            = -1;
            glColumn1.Name                  = "Column1";
            glColumn1.NumericSort           = false;
            glColumn1.Text                  = "Name";
            glColumn1.TextAlignment         = System.Drawing.ContentAlignment.MiddleLeft;
            glColumn1.Width                 = 130;
            glColumn2.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.DateTimePicker;
            glColumn2.CheckBoxes            = false;
            glColumn2.ImageIndex            = -1;
            glColumn2.Name                  = "Column2";
            glColumn2.NumericSort           = false;
            glColumn2.Text                  = "Released";
            glColumn2.TextAlignment         = System.Drawing.ContentAlignment.MiddleLeft;
            glColumn2.Width                 = 140;
            glColumn3.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
            glColumn3.CheckBoxes            = false;
            glColumn3.ImageIndex            = -1;
            glColumn3.Name                  = "Column3";
            glColumn3.NumericSort           = false;
            glColumn3.Text                  = "Download";
            glColumn3.TextAlignment         = System.Drawing.ContentAlignment.MiddleLeft;
            glColumn3.Width                 = 100;
            glColumn4.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
            glColumn4.CheckBoxes            = false;
            glColumn4.ImageIndex            = -1;
            glColumn4.Name                  = "Column4";
            glColumn4.NumericSort           = false;
            glColumn4.Text                  = "Rating";
            glColumn4.TextAlignment         = System.Drawing.ContentAlignment.MiddleLeft;
            glColumn4.Width                 = 100;
            this.glacialList1.Columns.AddRange(new GlacialComponents.Controls.GLColumn[] {
                glColumn1,
                glColumn2,
                glColumn3,
                glColumn4
            });
            this.glacialList1.ControlStyle      = GlacialComponents.Controls.GLControlStyles.XP;
            this.glacialList1.Dock              = System.Windows.Forms.DockStyle.Fill;
            this.glacialList1.FullRowSelect     = true;
            this.glacialList1.GridColor         = System.Drawing.Color.LightGray;
            this.glacialList1.GridLines         = GlacialComponents.Controls.GLGridLines.gridBoth;
            this.glacialList1.GridLineStyle     = GlacialComponents.Controls.GLGridLineStyles.gridSolid;
            this.glacialList1.GridTypes         = GlacialComponents.Controls.GLGridTypes.gridOnExists;
            this.glacialList1.HeaderHeight      = 22;
            this.glacialList1.HeaderVisible     = true;
            this.glacialList1.HeaderWordWrap    = false;
            this.glacialList1.HotColumnTracking = true;
            this.glacialList1.HotItemTracking   = true;
            this.glacialList1.HotTrackingColor  = System.Drawing.Color.LightGray;
            this.glacialList1.HoverEvents       = false;
            this.glacialList1.HoverTime         = 1;
            this.glacialList1.ImageList         = this.imageList1;
            this.glacialList1.ItemHeight        = 20;
            glItem1.BackColor         = System.Drawing.Color.White;
            glItem1.ForeColor         = System.Drawing.Color.Black;
            glItem1.RowBorderColor    = System.Drawing.Color.Black;
            glItem1.RowBorderSize     = 0;
            glSubItem1.BackColor      = System.Drawing.Color.Empty;
            glSubItem1.Checked        = false;
            glSubItem1.ForceText      = false;
            glSubItem1.ForeColor      = System.Drawing.Color.Black;
            glSubItem1.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem1.ImageIndex     = -1;
            glSubItem1.Text           = "Glacial List 1.3";
            glSubItem2.BackColor      = System.Drawing.Color.Empty;
            glSubItem2.Checked        = false;
            glSubItem2.ForceText      = false;
            glSubItem2.ForeColor      = System.Drawing.Color.Black;
            glSubItem2.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem2.ImageIndex     = -1;
            glSubItem2.Text           = "1/7/2004";
            glSubItem3.BackColor      = System.Drawing.Color.Empty;
            glSubItem3.Checked        = false;
            glSubItem3.ForceText      = false;
            glSubItem3.ForeColor      = System.Drawing.Color.Black;
            glSubItem3.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem3.ImageIndex     = -1;
            glSubItem3.Text           = "40";
            glSubItem4.BackColor      = System.Drawing.Color.Empty;
            glSubItem4.Checked        = false;
            glSubItem4.ForceText      = false;
            glSubItem4.ForeColor      = System.Drawing.Color.Black;
            glSubItem4.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem4.ImageIndex     = 2;
            glSubItem4.Text           = "";
            glItem1.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] {
                glSubItem1,
                glSubItem2,
                glSubItem3,
                glSubItem4
            });
            glItem1.Text              = "Glacial List 1.3";
            glItem2.BackColor         = System.Drawing.Color.White;
            glItem2.ForeColor         = System.Drawing.Color.Black;
            glItem2.RowBorderColor    = System.Drawing.Color.Black;
            glItem2.RowBorderSize     = 0;
            glSubItem5.BackColor      = System.Drawing.Color.Empty;
            glSubItem5.Checked        = false;
            glSubItem5.ForceText      = false;
            glSubItem5.ForeColor      = System.Drawing.Color.Black;
            glSubItem5.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem5.ImageIndex     = -1;
            glSubItem5.Text           = "Glacial List 1.28";
            glSubItem6.BackColor      = System.Drawing.Color.Empty;
            glSubItem6.Checked        = false;
            glSubItem6.ForceText      = false;
            glSubItem6.ForeColor      = System.Drawing.Color.Black;
            glSubItem6.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem6.ImageIndex     = -1;
            glSubItem6.Text           = "12/30/2003";
            glSubItem7.BackColor      = System.Drawing.Color.Empty;
            glSubItem7.Checked        = false;
            glSubItem7.ForceText      = false;
            glSubItem7.ForeColor      = System.Drawing.Color.Black;
            glSubItem7.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem7.ImageIndex     = -1;
            glSubItem7.Text           = "90";
            glSubItem8.BackColor      = System.Drawing.Color.Empty;
            glSubItem8.Checked        = false;
            glSubItem8.ForceText      = false;
            glSubItem8.ForeColor      = System.Drawing.Color.Black;
            glSubItem8.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem8.ImageIndex     = 2;
            glSubItem8.Text           = "";
            glItem2.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] {
                glSubItem5,
                glSubItem6,
                glSubItem7,
                glSubItem8
            });
            glItem2.Text               = "Glacial List 1.28";
            glItem3.BackColor          = System.Drawing.Color.White;
            glItem3.ForeColor          = System.Drawing.Color.Black;
            glItem3.RowBorderColor     = System.Drawing.Color.Black;
            glItem3.RowBorderSize      = 0;
            glSubItem9.BackColor       = System.Drawing.Color.Empty;
            glSubItem9.Checked         = false;
            glSubItem9.ForceText       = false;
            glSubItem9.ForeColor       = System.Drawing.Color.Black;
            glSubItem9.ImageAlignment  = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem9.ImageIndex      = -1;
            glSubItem9.Text            = "Glacial List 1.26";
            glSubItem10.BackColor      = System.Drawing.Color.Empty;
            glSubItem10.Checked        = false;
            glSubItem10.ForceText      = false;
            glSubItem10.ForeColor      = System.Drawing.Color.Black;
            glSubItem10.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem10.ImageIndex     = -1;
            glSubItem10.Text           = "12/22/2003";
            glSubItem11.BackColor      = System.Drawing.Color.Empty;
            glSubItem11.Checked        = false;
            glSubItem11.ForceText      = false;
            glSubItem11.ForeColor      = System.Drawing.Color.Black;
            glSubItem11.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem11.ImageIndex     = -1;
            glSubItem11.Text           = "80";
            glSubItem12.BackColor      = System.Drawing.Color.Empty;
            glSubItem12.Checked        = false;
            glSubItem12.ForceText      = false;
            glSubItem12.ForeColor      = System.Drawing.Color.Black;
            glSubItem12.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem12.ImageIndex     = 1;
            glSubItem12.Text           = "";
            glItem3.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] {
                glSubItem9,
                glSubItem10,
                glSubItem11,
                glSubItem12
            });
            glItem3.Text               = "Glacial List 1.26";
            glItem4.BackColor          = System.Drawing.Color.White;
            glItem4.ForeColor          = System.Drawing.Color.Black;
            glItem4.RowBorderColor     = System.Drawing.Color.Black;
            glItem4.RowBorderSize      = 0;
            glSubItem13.BackColor      = System.Drawing.Color.Empty;
            glSubItem13.Checked        = false;
            glSubItem13.ForceText      = false;
            glSubItem13.ForeColor      = System.Drawing.Color.Black;
            glSubItem13.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem13.ImageIndex     = -1;
            glSubItem13.Text           = "Glacial List 1.1";
            glSubItem14.BackColor      = System.Drawing.Color.Empty;
            glSubItem14.Checked        = false;
            glSubItem14.ForceText      = false;
            glSubItem14.ForeColor      = System.Drawing.Color.Black;
            glSubItem14.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem14.ImageIndex     = -1;
            glSubItem14.Text           = "7/9/2003";
            glSubItem15.BackColor      = System.Drawing.Color.Empty;
            glSubItem15.Checked        = false;
            glSubItem15.ForceText      = false;
            glSubItem15.ForeColor      = System.Drawing.Color.Black;
            glSubItem15.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem15.ImageIndex     = -1;
            glSubItem15.Text           = "Done";
            glSubItem16.BackColor      = System.Drawing.Color.Empty;
            glSubItem16.Checked        = false;
            glSubItem16.ForceText      = false;
            glSubItem16.ForeColor      = System.Drawing.Color.Black;
            glSubItem16.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem16.ImageIndex     = 1;
            glSubItem16.Text           = "";
            glItem4.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] {
                glSubItem13,
                glSubItem14,
                glSubItem15,
                glSubItem16
            });
            glItem4.Text               = "Glacial List 1.1";
            glItem5.BackColor          = System.Drawing.Color.White;
            glItem5.ForeColor          = System.Drawing.Color.Black;
            glItem5.RowBorderColor     = System.Drawing.Color.Black;
            glItem5.RowBorderSize      = 0;
            glSubItem17.BackColor      = System.Drawing.Color.Empty;
            glSubItem17.Checked        = false;
            glSubItem17.ForceText      = false;
            glSubItem17.ForeColor      = System.Drawing.Color.Black;
            glSubItem17.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem17.ImageIndex     = -1;
            glSubItem17.Text           = "Glacial List 1.0";
            glSubItem18.BackColor      = System.Drawing.Color.Empty;
            glSubItem18.Checked        = false;
            glSubItem18.ForceText      = false;
            glSubItem18.ForeColor      = System.Drawing.Color.Black;
            glSubItem18.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem18.ImageIndex     = -1;
            glSubItem18.Text           = "6/13/2003";
            glSubItem19.BackColor      = System.Drawing.Color.Empty;
            glSubItem19.Checked        = false;
            glSubItem19.ForceText      = false;
            glSubItem19.ForeColor      = System.Drawing.Color.Black;
            glSubItem19.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem19.ImageIndex     = -1;
            glSubItem19.Text           = "23";
            glSubItem20.BackColor      = System.Drawing.Color.Empty;
            glSubItem20.Checked        = false;
            glSubItem20.ForceText      = false;
            glSubItem20.ForeColor      = System.Drawing.Color.Black;
            glSubItem20.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
            glSubItem20.ImageIndex     = 0;
            glSubItem20.Text           = "";
            glItem5.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] {
                glSubItem17,
                glSubItem18,
                glSubItem19,
                glSubItem20
            });
            glItem5.Text = "Glacial List 1.0";
            this.glacialList1.Items.AddRange(new GlacialComponents.Controls.GLItem[] {
                glItem1,
                glItem2,
                glItem3,
                glItem4,
                glItem5
            });
            this.glacialList1.ItemWordWrap         = false;
            this.glacialList1.Location             = new System.Drawing.Point(0, 0);
            this.glacialList1.Name                 = "glacialList1";
            this.glacialList1.Selectable           = true;
            this.glacialList1.SelectedTextColor    = System.Drawing.Color.White;
            this.glacialList1.SelectionColor       = System.Drawing.Color.DarkBlue;
            this.glacialList1.ShowBorder           = true;
            this.glacialList1.ShowFocusRect        = false;
            this.glacialList1.Size                 = new System.Drawing.Size(496, 174);
            this.glacialList1.SortType             = GlacialComponents.Controls.SortTypes.MergeSort;
            this.glacialList1.SuperFlatHeaderColor = System.Drawing.Color.White;
            this.glacialList1.TabIndex             = 0;
            this.glacialList1.Text                 = "glacialList1";
            //
            // imageList1
            //
            this.imageList1.ImageSize        = new System.Drawing.Size(80, 16);
            this.imageList1.ImageStream      = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
            //
            // mainMenu1
            //
            this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                this.menuItem1
            });
            //
            // menuItem1
            //
            this.menuItem1.Index = 0;
            this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                this.menuItem2
            });
            this.menuItem1.Text = "test";
            //
            // menuItem2
            //
            this.menuItem2.Index = 0;
            this.menuItem2.Text  = "test2";

            //
            // Form1
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize        = new System.Drawing.Size(496, 174);
            this.Controls.Add(this.glacialList1);
            this.Menu  = this.mainMenu1;
            this.Name  = "Form1";
            this.Text  = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
        }
        private void BtnPlus_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < glacialList1.Items.Count; i++)//不能重复添加
            {
                if (glacialList1.Items[i].SubItems[0].Text == TxtItemNo.Text.Trim())
                {
                    MessageBox.Show("此单下已添加该商品!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            GLItem xItems = new GLItem(glacialList1);
            xItems.SubItems[0].Text = TxtItemNo.Text.Trim();
            xItems.SubItems[1].Text = TxtName.Text.Trim();
            xItems.SubItems[2].Text = TxtUnit.Text.Trim();
            xItems.SubItems[3].Text = TxtPrice.Text.Trim();
            xItems.SubItems[4].Text = TxtItemNum.Text.Trim();
            xItems.SubItems[5].Text = (decimal.Parse(TxtPrice.Text.Trim()) * decimal.Parse(TxtItemNum.Text.Trim())).ToString ();//总价
            xItems.SubItems[6].Text = TxtType.Text.Trim();
            xItems.SubItems[7].Text = TxtIntegralFlag.Text.Trim();
            xItems.SubItems[8].Text = TxtIntegral.Text .Trim ();
            xItems.SubItems[9].Text = (int.Parse(TxtItemNum.Text.Trim()) * int.Parse(TxtIntegral.Text.Trim ())).ToString ();//总积分
            xItems.SubItems[10].Text = LBLItemSys.Text;
            glacialList1.BeginUpdate();
            glacialList1.Items.Add(xItems);
            glacialList1.EndUpdate();
            xItems.Selected = true;

            TxtMoney.Text = "0";
            TxtRealMoney.Text = "0";
            TxtIntegralSum.Text = "0";
            for (int i = 0; i < glacialList1.Items.Count;i++ )
            {
                TxtMoney.Text = (decimal.Parse(TxtMoney.Text) + decimal.Parse(glacialList1.Items[i].SubItems[5].Text)).ToString ();//总价,折扣前
                TxtIntegralSum.Text = (decimal.Parse(TxtIntegralSum.Text) + decimal.Parse(glacialList1.Items[i].SubItems[9].Text)).ToString();//总积分

            }
            if (TxtDisCount.Text=="")
            {
                TxtDisCount.Text = "100";
            }
            TxtRealMoney.Text = (decimal.Parse(TxtMoney.Text.Trim()) * decimal.Parse(TxtDisCount.Text .Trim ())/100).ToString ();//实际总价,折扣后
        }
Esempio n. 22
0
        private void GetData()
        {
            logGlacialList.Items.Clear();
            try
            {
                _claimData = _service.GetActivitiesForClaim(_settings["AdminID"], _clientVersion, _startDay);
                foreach (ClaimStruct claimItem in _claimData)
                {
                    GLItem glItem = new GLItem(logGlacialList);
                    glItem.Tag = new ActivityPresentation(claimItem);
                    GLSubItem glSubItem;

                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.Activity.StartTime.Date.ToShortDateString();
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.Activity.Customer;
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.Activity.Activity;
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.Activity.StartTime.TimeOfDay.ToString();
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.Activity.WorkDuration.ToString();
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.Activity.TicketNumber;
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.StandardClaim.ToString();
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.PlannedOvertime.ToString();
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.ClaimCode.Account;
                    if (claimItem.StandardClaim)
                        glSubItem.ForeColor = Color.Gray;
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.ClaimCode.WorkItem;
                    if (claimItem.StandardClaim)
                        glSubItem.ForeColor = Color.Gray;
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = claimItem.Activity.Comment;
                    glItem.SubItems.Add(glSubItem);

                    logGlacialList.Items.Add(glItem);
                }
            }
            catch (System.Web.Services.Protocols.SoapException exception)
            {
                if (exception.Message == "No activity entries")
                    this._claimData = new ClaimStruct[0];
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "Getting claim data error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            logGlacialList.Refresh();
        }
Esempio n. 23
0
        private void UrunlerTusu_Load(object sender, EventArgs e)
        {
            XmlLoad<KategorilerineGoreUrunler> loadInfoUrun = new XmlLoad<KategorilerineGoreUrunler>();
            KategorilerineGoreUrunler[] infoUrun = loadInfoUrun.LoadRestoran("urunler.xml");

            SqlCommand cmd = SQLBaglantisi.getCommand("SELECT YaziciAdi FROM Yazici");
            SqlDataReader dr = cmd.ExecuteReader();

            List<string> yazicilar = new List<string>();

            while (dr.Read())
            {
                yazicilar.Add(dr.GetString(0));
            }

            urunListesi.AddRange(infoUrun);

            for (int i = 0; i < urunListesi.Count; i++)
            {
                for (int j = 0; j < urunListesi[i].urunAdi.Count; j++)
                {
                    ComboBox comboBoxPorsiyon = new ComboBox();
                    comboBoxPorsiyon.Items.Add("Bir Porsiyon");
                    comboBoxPorsiyon.Items.Add("Yarım Porsiyon");
                    comboBoxPorsiyon.Items.Add("Çeyrek Porsiyon");

                    comboBoxPorsiyon.Tag = urunListesi[i].urunAdi[j] + "p";

                    if (urunListesi[i].urunPorsiyonSinifi[j] == 0) // 1 porsiyon
                        comboBoxPorsiyon.Text = "Bir Porsiyon";
                    else if (urunListesi[i].urunPorsiyonSinifi[j] == 1) // Yarım porsiyon
                        comboBoxPorsiyon.Text = "Yarım Porsiyon";
                    else // Çeyrek porsiyon
                        comboBoxPorsiyon.Text = "Çeyrek Porsiyon";

                    comboBoxPorsiyon.ContextMenuStrip = contextMenuStrip1;
                    comboBoxPorsiyon.KeyPress += comboBox_KeyPress;
                    comboBoxPorsiyon.Click += showMenu;

                    ComboBox comboBoxYaziciBilgilendirme = new ComboBox();
                    comboBoxYaziciBilgilendirme.Items.Add("Yazıcı Bilgilendirilsin");
                    comboBoxYaziciBilgilendirme.Items.Add("Bildirim Yok");

                    comboBoxYaziciBilgilendirme.Tag = urunListesi[i].urunAdi[j] + "m";

                    if (urunListesi[i].urunYaziciyaBildirilmeliMi[j])
                        comboBoxYaziciBilgilendirme.Text = "Yazıcı Bilgilendirilsin";
                    else
                        comboBoxYaziciBilgilendirme.Text = "Bildirim Yok";

                    comboBoxYaziciBilgilendirme.ContextMenuStrip = contextMenuStrip1;
                    comboBoxYaziciBilgilendirme.KeyPress += comboBox_KeyPress;
                    comboBoxYaziciBilgilendirme.Click += showMenu;

                    ComboBox comboBoxYazici = new ComboBox();

                    foreach(string yazici in yazicilar)
                    {
                        comboBoxYazici.Items.Add(yazici);
                    }

                    comboBoxYazici.Tag = urunListesi[i].urunAdi[j] + "y";

                    comboBoxYazici.Text = urunListesi[i].urunYazicisi[j];

                    comboBoxYazici.ContextMenuStrip = contextMenuStrip1;
                    comboBoxYazici.KeyPress += comboBox_KeyPress;
                    comboBoxYazici.Click += showMenu;

                    GLItem urun = new GLItem();
                    urun.ForeColor = SystemColors.ActiveCaption;
                    urun.Text = "    " + urunListesi[i].urunAdi[j];

                    glacialListUrunler.Items.Add(urun);
                    glacialListUrunler.Items[glacialListUrunler.Items.Count - 1].SubItems[1].Control = comboBoxPorsiyon;
                    glacialListUrunler.Items[glacialListUrunler.Items.Count - 1].SubItems[2].Control = comboBoxYaziciBilgilendirme;
                    glacialListUrunler.Items[glacialListUrunler.Items.Count - 1].SubItems[3].Control = comboBoxYazici;
                    glacialListUrunler.Items[glacialListUrunler.Items.Count - 1].SubItems[0].ForeColor = SystemColors.ActiveCaption;
                    glacialListUrunler.Items[glacialListUrunler.Items.Count - 1].SubItems[1].Control.ForeColor = SystemColors.ActiveCaption;
                    glacialListUrunler.Items[glacialListUrunler.Items.Count - 1].SubItems[2].Control.ForeColor = SystemColors.ActiveCaption;
                    glacialListUrunler.Items[glacialListUrunler.Items.Count - 1].SubItems[3].Control.ForeColor = SystemColors.ActiveCaption;

                }
            }
        }
		/// <summary>
		/// Find the index of a specified item
		/// </summary>
		/// <param name="item"></param>
		/// <returns></returns>
		public int FindItemIndex( GLItem item )		// use -1 to have it start from the beginning of the list
		{
			for ( int nIndex = 0; nIndex < Count; nIndex++ )
				if ( item == this[nIndex] )
					return nIndex;

			return -1;			// couldn't find it
		}
		/// <summary>
		/// Clears all selection bits in the item structure
		/// 
		/// this overload is an optimization to stop a redraw on a re-selection
		/// </summary>
		public void ClearSelection( GLItem itemIgnore )
		{
			for ( int index = 0; index<List.Count; index++ )
			{
				GLItem citem = this[index];
				if ( citem != itemIgnore )
					citem.Selected = false;												// changed will generate an invalidation by themselves
			}
		}
Esempio n. 26
0
 /// <summary>
 /// add an itemto the items collection
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public int Add(GLItem item)
 {
     return(Insert(-1, item));
 }
		/// <summary>
		/// add an itemto the items collection
		/// </summary>
		/// <param name="item"></param>
		/// <returns></returns>
		public int Add( GLItem item )
		{
			return Insert( -1, item );
		}
Esempio n. 28
0
 /// <summary>
 /// Usuwa zadanie z listy
 /// </summary>
 /// <param name="g">Zadanie do usuniecia</param>
 public void usunZadanie(GLItem g)
 {
     glPliki.Items.Remove(g);
 }
		/// <summary>
		/// Use the built in sorting mechanism to sort the list
		/// </summary>
//		public void Sort()
//		{
//			this.InnerList.Sort();
//		}
#endif

		/// <summary>
		/// Compatability with collection editor
		/// </summary>
		/// <param name="items"></param>
		public void AddRange( GLItem[] items)
		{
			lock(List.SyncRoot)
			{
				for (int i=0; i<items.Length; i++)
					Add( items[i] );
			}
		}
 private static void ClearGlacialList(GlacialList xGlacialList, GLItem xItem)
 {
     xGlacialList.BeginUpdate();
     xGlacialList.Items.Remove(xItem);
     xGlacialList.EndUpdate();
 }
		public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl)
		{
			this.Format = DateTimePickerFormat.Long;
			try
			{
				m_item = item;
				m_subItem = subItem;
				m_Parent = listctrl;

				this.Text = subItem.Text;

				//this.Value = subItem.Text;
			}
			catch ( Exception ex )
			{
				Debug.WriteLine( ex.ToString() );

				this.Text = DateTime.Now.ToString();
			}

			return true;
		}
		/// <summary>
		/// insert an item into the list at specified index
		/// </summary>
		/// <param name="nIndex"></param>
		/// <param name="strItemText"></param>
		/// <returns></returns>
		public GLItem Insert( int nIndex, string strItemText )
		{
			GLItem item = new GLItem( Parent );			//GLItem item = new GLItem(Parent);
			item.SubItems[0].Text = strItemText;

			nIndex = Insert( nIndex, item );

			return item;
		}
        private void BtnPlus_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < glacialList1.Items.Count; i++)//不能重复添加
            {
                if (glacialList1.Items[i].SubItems[0].Text == TxtItemNo.Text.Trim())
                {
                    MessageBox.Show("此单下已添加该商品!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            GLItem xItems = new GLItem(glacialList1);
            xItems.SubItems[0].Text = TxtItemNo.Text.Trim();
            xItems.SubItems[1].Text = TxtName.Text.Trim();
            xItems.SubItems[2].Text = TxtUnit.Text.Trim();
            xItems.SubItems[3].Text = TxtItemNum.Text.Trim();
            xItems.SubItems[4].Text = TxtIntegral.Text .Trim ();
            xItems.SubItems[5].Text = (int.Parse(TxtItemNum.Text.Trim()) * int.Parse(TxtIntegral.Text.Trim ())).ToString ();//总积分
            xItems.SubItems[6].Text = LBLItemSys.Text;
            glacialList1.BeginUpdate();
            glacialList1.Items.Add(xItems);
            glacialList1.EndUpdate();
            xItems.Selected = true;

            //TxtTolIntegral.Text = "0";
            //TxtLeveIntegra.Text = "0";
            TxtIntegralSum.Text = "0";
            for (int i = 0; i < glacialList1.Items.Count;i++ )
            {

                TxtIntegralSum.Text = (decimal.Parse(TxtIntegralSum.Text) + decimal.Parse(glacialList1.Items[i].SubItems[5].Text)).ToString();//总积分

            }
        }
		/// <summary>
		/// This is an OPTIMIZED routine to see if an item is visible.
		/// 
		/// The other method of just checking against the item index was slow becuase it had to walk the entire list, which would massively
		/// slow down the control when large numbers of items were added.
		/// </summary>
		/// <param name="item"></param>
		/// <returns></returns>
		public bool IsItemVisible( GLItem item )
		{
			// TODO: change this to only walk to visible items list
			int nItemIndex = Items.FindItemIndex( item );
			if ( ( nItemIndex >= this.vPanelScrollBar.Value ) && ( nItemIndex <  this.vPanelScrollBar.Value+this.VisibleRowsCount ) )
				return true;

			return false;
		}
Esempio n. 35
0
        private void RefreshActivitiesList()
        {
            logGlacialList.Items.Clear();
            try
            {
                foreach (ActivityPresentation t in _activities)
                {
                    if (t.Entry.StartTime.Date < firstDateTimePicker.Value.Date)
                        break;
                    if (t.Entry.StartTime.Date > lastDateTimePicker.Value.Date)
                        continue;
                    if ((customersComboBox.SelectedIndex != 0) && (customersComboBox.Text != t.Entry.Customer))
                        continue;
                    if (workTimeComboBox.SelectedIndex != 0)
                    {
                        if ((workTimeComboBox.SelectedIndex == 1) &&
                            ((t.Entry.StartTime.Hour < 7) || (t.Entry.StartTime.Hour >= 19) ||
                            (t.Entry.StartTime.DayOfWeek == DayOfWeek.Saturday) || (t.Entry.StartTime.DayOfWeek == DayOfWeek.Sunday)))
                            continue;
                        else if ((workTimeComboBox.SelectedIndex == 2) &&
                            ((t.Entry.StartTime.Hour >= 7) && (t.Entry.StartTime.Hour < 19) &&
                            (t.Entry.StartTime.DayOfWeek != DayOfWeek.Saturday) && (t.Entry.StartTime.DayOfWeek != DayOfWeek.Sunday)))
                            continue;
                    }

                    GLItem glItem = new GLItem(logGlacialList);
                    GLSubItem glSubItem;

                    glSubItem = new GLSubItem();
                    glSubItem.Text = t.Entry.StartTime.Date.ToShortDateString();
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = t.Entry.Customer;
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = t.Entry.Activity;
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = t.Entry.StartTime.TimeOfDay.ToString();
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = t.Entry.StartTime.AddMinutes(t.Entry.WorkDuration).TimeOfDay.ToString();
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = t.Entry.WorkDuration.ToString();
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = t.Entry.TicketNumber;
                    glItem.SubItems.Add(glSubItem);
                    glSubItem = new GLSubItem();
                    glSubItem.Text = t.Entry.Comment;
                    glItem.SubItems.Add(glSubItem);

                    glItem.Tag = t;
                    logGlacialList.Items.Add(glItem);
                }
                logGlacialList.Refresh();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
		/// <summary>
		/// Draw row at specified coordinates
		/// </summary>
		/// <param name="graphicsRow"></param>
		/// <param name="rectRow"></param>
		/// <param name="item"></param>
		/// <param name="nItemIndex"></param>
		virtual public void DrawRow( Graphics graphicsRow, Rectangle rectRow, GLItem item, int nItemIndex )
		{
			DW("DrawRow");


			// row background, if its selected, that trumps all, if not then see if we are using alternating colors, if not draw normal
			// note, this can all be overridden by the sub item background property
			// make sure anything can even be selected before drawing selection rects
			if ( item.Selected && this.Selectable )
			{
				SolidBrush brushBK;
				brushBK = new SolidBrush( Color.FromArgb( 255, SelectionColor.R, SelectionColor.G, SelectionColor.B ) );

				// need to check for full row select here
				if ( !FullRowSelect )
				{	// calculate how far into the control it goes
					int nWidthFR = -this.hPanelScrollBar.Value + Columns.Width;
					graphicsRow.FillRectangle( brushBK, this.RowsInnerClientRect.X, rectRow.Y, nWidthFR, rectRow.Height );
				}
				else
					graphicsRow.FillRectangle( brushBK, this.RowsInnerClientRect.X, rectRow.Y, this.RowsInnerClientRect.Width, rectRow.Height );

				brushBK.Dispose();
			}
			else
			{

				// if the back color of the list doesn't match the back color of the item (AND) the back color isn't white, then override it
				if ( ( item.BackColor.ToArgb() != this.BackColor.ToArgb() ) && (item.BackColor != Color.White ) )
				{
					SolidBrush brushBK = new SolidBrush( item.BackColor );
					graphicsRow.FillRectangle( brushBK, this.RowsInnerClientRect.X, rectRow.Y, this.RowsInnerClientRect.Width, rectRow.Height );
					brushBK.Dispose();
				}	// check for full row alternate color
				else if ( this.AlternatingColors )
				{	// alternating colors are only shown if the row isn't selected
					int nACItemIndex = Items.FindItemIndex( item );
					if ( ( nACItemIndex % 2 ) > 0 )
					{
						SolidBrush brushBK = new SolidBrush( this.AlternateBackground );

						if ( !FullRowSelect )
						{	// calculate how far into the control it goes
							int nWidthFR = -this.hPanelScrollBar.Value + Columns.Width;
							graphicsRow.FillRectangle( brushBK, this.RowsInnerClientRect.X, rectRow.Y, nWidthFR, rectRow.Height );
						}
						else
							graphicsRow.FillRectangle( brushBK, this.RowsInnerClientRect.X, rectRow.Y, this.RowsInnerClientRect.Width, rectRow.Height );

						brushBK.Dispose();
					}
				}
			}


			// draw the row of sub items
			int nXCursor = -this.hPanelScrollBar.Value + this.BorderPadding;
			for ( int nSubItem = 0; nSubItem < Columns.Count; nSubItem++ )
			{
				Rectangle rectSubItem = new Rectangle( nXCursor, rectRow.Y, Columns[nSubItem].Width, rectRow.Height );

				// avoid drawing items that are not in the visible region
				if ( ( rectSubItem.Right < 0 ) || ( rectSubItem.Left > this.RowsInnerClientRect.Right ) )
					Debug.Write( "" );
				else
					DrawSubItem( graphicsRow, rectSubItem, item, item.SubItems[nSubItem], nSubItem );

				nXCursor += Columns[nSubItem].Width;
			}


			// post draw for focus rect and hot tracking
			if ( ( nItemIndex == this.HotItemIndex ) && HotItemTracking )									// handle hot tracking of items
			{
				Color transparentColor = Color.FromArgb( 75, this.HotTrackingColor.R, this.HotTrackingColor.G, this.HotTrackingColor.B );		// 182, 189, 210 );
				Brush hotBrush = new SolidBrush(transparentColor);

				graphicsRow.FillRectangle( hotBrush, this.RowsInnerClientRect.X, rectRow.Y, this.RowsInnerClientRect.Width, rectRow.Height );

				hotBrush.Dispose();
			}


			// draw row borders
			if ( item.RowBorderSize > 0 )
			{
				Pen penBorder = new Pen( item.RowBorderColor, item.RowBorderSize );
				penBorder.Alignment = PenAlignment.Inset;
				graphicsRow.DrawRectangle( penBorder, rectRow );
				penBorder.Dispose();
			}


			// make sure anything can even be selected before drawing selection rects
			if ( this.Selectable )
				if ( this.ShowFocusRect && (FocusedItem == item) )												// deal with focus rect
					ControlPaint.DrawFocusRectangle( graphicsRow, new Rectangle( this.RowsInnerClientRect.X+1, rectRow.Y, this.RowsInnerClientRect.Width-1, rectRow.Height ) );
		}
		private bool CompareItems( GLItem item1, GLItem item2, CompareDirection direction )
		{
			// add a numeric compare here also
			bool dir = false;

			if ( direction == CompareDirection.GreaterThan )
				dir=true;

			if ( this.SortDirection == SortDirections.SortAscending )
				dir = !dir;		// flip it

			if ( !this.NumericCompare )
			{
				if ( dir )
				{
					return ( item1.SubItems[SortColumn].Text.CompareTo( item2.SubItems[SortColumn].Text ) < 0 );
				}
				else
				{
					return ( item1.SubItems[SortColumn].Text.CompareTo( item2.SubItems[SortColumn].Text ) > 0 );
				}
			}
			else
			{
				try
				{
					double n1 = Double.Parse( item1.SubItems[SortColumn].Text );
					double n2 = Double.Parse( item2.SubItems[SortColumn].Text );

					if ( dir )
					{	// compare the numeric values inside the columns
						return ( n1 < n2 );
					}
					else
					{
						return ( n1 > n2 );
					}
				}
				catch( Exception ex )
				{
					// no numeric value (bad bad)
					Debug.WriteLine( ex.ToString() );
					return false;
				}
			}
		}
		/// <summary>
		/// Draw Sub Item (Cell) at location specified
		/// </summary>
		/// <param name="graphicsSubItem"></param>
		/// <param name="rectSubItem"></param>
		/// <param name="item"></param>
		/// <param name="subItem"></param>
		/// <param name="nColumn"></param>
		virtual public void DrawSubItem( Graphics graphicsSubItem, Rectangle rectSubItem, GLItem item, GLSubItem subItem, int nColumn )
		{
			DW("DrawSubItem");

			// precheck to make sure this is big enough for the things we want to do inside it
			Rectangle subControlRect = new Rectangle( rectSubItem.X, rectSubItem.Y, rectSubItem.Width, rectSubItem.Height );


			if ( ( subItem.Control != null ) && (!subItem.ForceText ) )
			{	// custom embedded control here

				Control control = subItem.Control;

				if ( control.Parent != this )		// *** CRUCIAL *** this makes sure the parent is the list control
					control.Parent = this;

				//				Rectangle subrc = new Rectangle( 
				//					subControlRect.X+this.CellPaddingSize, 
				//					subControlRect.Y+this.CellPaddingSize, 
				//					subControlRect.Width-this.CellPaddingSize*2,
				//					subControlRect.Height-this.CellPaddingSize*2 );


				Rectangle subrc = new Rectangle( 
					subControlRect.X, 
					subControlRect.Y+1, 
					subControlRect.Width,
					subControlRect.Height-1 );


				Type tp = control.GetType();
				PropertyInfo pi = control.GetType().GetProperty( "PreferredHeight" );
				if ( pi != null )
				{
					int PreferredHeight = (int)pi.GetValue( control, null );

					if ( ( (PreferredHeight + this.CellPaddingSize*2)> this.ItemHeight ) && AutoHeight )
						this.ItemHeight = PreferredHeight + this.CellPaddingSize*2;

					subrc.Y = subControlRect.Y + ((subControlRect.Height - PreferredHeight)/2);
				}

				NewLiveControls.Add( control );						// put it in the new list, remove from old list
				if ( LiveControls.Contains( control ) )				// make sure its in the old list first
				{
					LiveControls.Remove( control );			// remove it from list so it doesn't get put down
				}


				if ( control.Bounds.ToString() != subrc.ToString() )
					control.Bounds = subrc;							// this will force an invalidation

				if ( control.Visible != true )
					control.Visible = true;
			}
			else	// not control based
			{
				// if the sub item color is not the same as the back color fo the control, AND the item is not selected, then color this sub item background
				
				if ( ( subItem.BackColor.ToArgb() != this.BackColor.ToArgb() ) && (!item.Selected) && ( subItem.BackColor != Color.White ) )
				{
					SolidBrush bbrush = new SolidBrush( subItem.BackColor );
					graphicsSubItem.FillRectangle( bbrush, rectSubItem );
					bbrush.Dispose();
				}

				// do we need checkboxes in this column or not?
				if ( this.Columns[ nColumn ].CheckBoxes )
					rectSubItem = DrawCheckBox( graphicsSubItem, rectSubItem, subItem.Checked );

				// if there is an image, this routine will RETURN with exactly the space left for everything else after the image is drawn (or not drawn due to lack of space)
				if ( (subItem.ImageIndex > -1) && (ImageList != null) && (subItem.ImageIndex < this.ImageList.Images.Count) )
					rectSubItem = DrawCellGraphic( graphicsSubItem, rectSubItem, this.ImageList.Images[ subItem.ImageIndex ], subItem.ImageAlignment );

				// deal with text color in a box on whether it is selected or not
				Color textColor;
				if ( item.Selected && this.Selectable )
					textColor = this.SelectedTextColor;
				else
				{
					textColor = this.ForeColor;
					if ( item.ForeColor.ToArgb() != this.ForeColor.ToArgb() )
						textColor = item.ForeColor;
					else if ( subItem.ForeColor.ToArgb() != this.ForeColor.ToArgb() )
						textColor = subItem.ForeColor;
				}

				DrawCellText( graphicsSubItem, rectSubItem, subItem.Text, Columns[nColumn].TextAlignment, textColor, item.Selected, ItemWordWrap );

				subItem.LastCellRect = rectSubItem;			// important to ONLY catch the area where the text is drawn
			}

		}
		public bool GLLoad( GLItem item, GLSubItem subItem, GlacialList listctrl )				// populate this control however you wish with item
		{
			// set the styles you want for this
			this.BorderStyle = BorderStyle.None;
			this.AutoSize = false;


			m_item = item;
			m_subItem = subItem;
			m_Parent = listctrl;

			this.Text = subItem.Text;

			return true;					// we don't do any heavy processing in this ctrl so we just return true
		}
		/// <summary>
		/// lowest level of add/insert.  All add and insert routines eventually call this
		/// 
		/// in the future always have routines call this one as well to keep one point of entry
		/// </summary>
		/// <param name="nIndex"></param>
		/// <param name="item"></param>
		/// <returns></returns>
		public int Insert( int nIndex, GLItem item )
		{
			item.Parent = this.Parent;

			item.ChangedEvent += new ChangedEventHandler( Item_Changed );

			if ( nIndex < 0 )
				nIndex = List.Add( item );			// add the item itself
			else
				List.Insert( nIndex, item );

			if ( ChangedEvent != null )
				ChangedEvent( this, new ChangedEventArgs( ChangedTypes.ItemCollectionChanged, null, null, null ) );

			return nIndex;
		}
		public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl)
		{
			m_item = item;
			m_subItem = subItem;
			m_Parent = listctrl;

			this.Text = subItem.Text;

			this.Items.Add( "i1" );
			this.Items.Add( "i2" );
			this.Items.Add( "i3" );

			return true;
		}
Esempio n. 42
0
 //public static bool CheckPunctuation(string xstr)
 //{
 //    //验证输入字符串是否包含单引号
 //    bool flag = true;
 //    if (xstr.Length == 0)
 //    {
 //        flag = false;
 //    }
 //    else
 //    {
 //        char[] x = xstr.ToCharArray();
 //        for (int i = 0; i < xstr.Length; i++)
 //        {
 //            if (x[i] == (char)39)
 //            {
 //                flag = false; break;
 //            }
 //        }
 //    }
 //    return flag;
 //}
 //public static void ReadTreeNode(TreeView xTree)     //传递的参数是treeview
 //{
 //    TreeNode tn = null;                 //节点赋为空值
 //    if (xTree.Nodes.Count == 0)             //节点总数为0
 //    {
 //        tn = new TreeNode("用户类别信息");
 //        tn.Name = Program.RootCode + Program.RootCode; //
 //        tn.ImageIndex = 0;
 //        xTree.Nodes.Add(tn);
 //        return;
 //    }
 //    if (xTree.SelectedNode.GetNodeCount(true) != 0)
 //    {
 //        //xTree.SelectedNode.Expand();
 //        return;
 //    }
 //    //在当前视图控件中选定的树节点的名称,以字符串的形式显示,截取从0开始的10个字符
 //    string xParentKey = xTree.SelectedNode.Name.ToString().Substring(0, 10);
 //    //SQL语句从AddressDict表中查询Parent_='xParentKey'的所有记录
 //    string xSql = "select * from MemberType where Parent_='" + xParentKey + "'";
 //    //读取数据
 //    SqlDataReader xRec = Program.SqlReader(xSql);
 //    if (xRec == null)
 //    {
 //        return;
 //    }
 //    if (xRec.HasRows == false)
 //    {
 //        xRec.Close();
 //        return;
 //    }
 //    while (xRec.Read())
 //    {
 //        tn = new TreeNode(xRec["Nam"].ToString());
 //        tn.Name = xRec["Code"].ToString() + xRec["SysNo"].ToString();  //两个字段值以字符串形式连接
 //        if (Int32.Parse(xRec["SysNo"].ToString()) == 0)
 //        {
 //            tn.ImageIndex = 0;
 //        }
 //        else
 //        {
 //            tn.ImageIndex = 1;
 //        }
 //        xTree.SelectedNode.Nodes.Add(tn);
 //    }
 //    xTree.SelectedNode.Expand();
 //    xRec.Close();
 //    return;
 //}
 public static void ReadGlacialList(GlacialList xGlacialList, SqlDataReader xRec)
 {
     int i, x;
     x = xRec.FieldCount;
     if (x > xGlacialList.Columns.Count)
     {
         return;
     }
     x = x - 1;
     xGlacialList.Items.Clear();
     xGlacialList.BeginUpdate();
     if (xRec == null)
     {
         xGlacialList.EndUpdate();
         return;
     }
     if (xRec.HasRows == false)
     {
         xGlacialList.EndUpdate();
         return;
     }
     while (xRec.Read())
     {
         GLItem xList = new GLItem();
         xList.SubItems.Clear();
         xList.SubItems[0].Text = xRec[0].ToString().Trim();
         for (i = 1; i <= x; i++)
         {
             xList.SubItems[i].Text = xRec[i].ToString().Trim();
         }
         xGlacialList.Items.Add(xList);
     }
     xGlacialList.EndUpdate();
     return;
 }
		/// <summary>
		/// Changes in the columns, items or subitems
		/// </summary>
		/// <param name="ctType"></param>
		/// <param name="column"></param>
		/// <param name="item"></param>
		/// <param name="subItem"></param>
		public ChangedEventArgs( ChangedTypes ctType, GLColumn column, GLItem item, GLSubItem subItem )
		{
			m_Column = column;
			m_Item = item;
			m_SubItem = subItem;

			m_ctType = ctType;
		}
		/// <summary>
		/// Instance the activated embeddec control for this item/column
		/// </summary>
		/// <param name="nColumn"></param>
		/// <param name="item"></param>
		/// <param name="subItem"></param>
		protected void ActivateEmbeddedControl( int nColumn, GLItem item, GLSubItem subItem )
		{
			if ( this.m_ActivatedEmbeddedControl != null )
			{
				this.m_ActivatedEmbeddedControl.Dispose();
				this.m_ActivatedEmbeddedControl = null;
			}


			/*
			using activator.createinstance
			typeof()/GetType
			Type t = obj.GetType()
			 */

			if ( Columns[nColumn].ActivatedEmbeddedControlTemplate == null )
				return;


			Type type = Columns[nColumn].ActivatedEmbeddedControlTemplate.GetType();
			Control control = (Control)Activator.CreateInstance( type );
			GLEmbeddedControl icontrol = (GLEmbeddedControl)control;

			if ( icontrol == null )
				throw new Exception( @"Control does not implement the GLEmbeddedControl interface, can't start" );

			icontrol.GLLoad( item, subItem, this );


			//control.LostFocus += new EventHandler( ActivatedEmbbed_LostFocus );
			control.KeyPress += new KeyPressEventHandler(tb_KeyPress);

			control.Parent = this;
			this.ActivatedEmbeddedControl = control;
			//subItem.Control = control;							// seed the control


			int nYOffset = (subItem.LastCellRect.Height - m_ActivatedEmbeddedControl.Bounds.Height) / 2;
			Rectangle controlBounds;

			if ( this.GridLineStyle == GLGridLineStyles.gridNone )
			{
				// add 1 to x to give border, add 2 to Y because to account for possible grid that you must cover up
				controlBounds = new Rectangle( subItem.LastCellRect.X+1, subItem.LastCellRect.Y+1, subItem.LastCellRect.Width-3, subItem.LastCellRect.Height-2 );
			}
			else
			{
				// add 1 to x to give border, add 2 to Y because to account for possible grid that you must cover up
				controlBounds = new Rectangle( subItem.LastCellRect.X+1, subItem.LastCellRect.Y+2, subItem.LastCellRect.Width-3, subItem.LastCellRect.Height-3 );
			}
			//control.Bounds = subItem.LastCellRect;	//new Rectangle( subItem.LastCellRect.X, subItem.LastCellRect.Y + nYOffset, subItem.LastCellRect.Width, subItem.LastCellRect.Height );
			control.Bounds = controlBounds;

			control.Show();
			control.Focus();
		}