Exemplo n.º 1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(Object sender, EventArgs e)
        {
            //HtmlDocument _xml = new HtmlDocument();
            //_xml.LoadHtml(Content.Text);
            //HtmlNode form = _xml.DocumentNode.SelectSingleNode("//form");
            //if (form == null)
            //{
            //    Alert(Label1, "没有发现表单!", "line1px_2");
            //    return;
            //}
            //HtmlAttributeCollection att = form.Attributes;
            //if (att["name"] == null || String.IsNullOrEmpty(att["name"].Value))
            //{
            //    Alert(Label1, "表单名字未设置!", "line1px_2");
            //    return;
            //}
            //String name = att["name"].Value;

            if (IsEdit)
            {
                CurrentForm = CurrentForms.Find(a => { return(a.ID == EditID); });
            }
            else
            {
                CurrentForm = new TableFormItem {
                    ID = Guid.NewGuid()
                };
                CurrentForms.Add(CurrentForm);
            }
            this.GetFormValue <TableFormItem>(CurrentForm);
            TableForm.SaveForms();
            Alert(Label1, "保存成功!", "line1px_3");
        }
Exemplo n.º 2
0
        /*
         *      @return TableData
         */
        public static TableData Get(TableForm form)
        {
            TableData tableData = new TableData();

            tableData.Descriptor        = new TableDescriptor(form.Text);
            tableData.ColumnDescriptors = form.Model.ColumnDescriptors;

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

            /*if (form.DGView_Table.Rows.Count > 0)
             * {
             *      form.DGView_Table.Rows.RemoveAt(form.DGView_Table.Rows.Count - 1); // игнорирование пустой строки в конце
             * }*/

            DataGridView table = form.DGView_Table;

            //foreach (DataGridViewRow row in form.DGView_Table.Rows)
            for (int i = 0; i < table.Rows.Count - 1; i++)            // "table.Rows.Count - 1" - игнорирование пустой строки в конце
            {
                List <string> cells = new List <string>();

                DataGridViewRow row = table.Rows[i];

                foreach (DataGridViewCell cell in row.Cells)
                {
                    cells.Add(cell.Value as string);
                }

                rows.Add(cells);
            }

            tableData.Rows = rows;

            return(tableData);            // TODO
        }
Exemplo n.º 3
0
        public void AddNewTable()
        {
            var dialog      = new AddTableDialog();
            int tablesCount = TableDatas.Count;

            dialog.Init(this, _view, GetRandomTableName());

            dialog.ShowDialog();
            var result = dialog.Result;

            if (result.Success)
            {
                var tableForm = new TableForm();
                tableForm.Init(
                    result.Value,
                    _form.TableForm_FormClosed,
                    _form.TableForm_ModelChanged);
                tableForm.MdiParent = _form;

                TableDatas.Add(TableData.Get(tableForm));

                _view.AddTableButton(result.Value.Name);

                _form.IsFileSaved = false;

                tableForm.Show();
            }
        }
Exemplo n.º 4
0
        private void btnTable_Click(object sender, EventArgs e)
        {
            this.Hide();
            TableForm table = new TableForm();

            table.Location      = this.Location;
            table.StartPosition = this.StartPosition;
            table.FormClosing  += delegate { this.Show(); };
            table.ShowDialog();
        }
Exemplo n.º 5
0
        private void button6_Click(object sender, EventArgs e)
        {
            TableForm form = TableForm.Instance;

            form.TopLevel = false;
            this.contentPanel.Controls.Clear();
            this.contentPanel.Controls.Add(form);
            form.Dock = DockStyle.Fill;
            form.Show();
        }
Exemplo n.º 6
0
        /*
         *      Создание и открытие окна таблицы, TableData которой уже есть в MainModel
         */
        public void AddExistingTable(TableData tableData)
        {
            TableForm tableForm = new TableForm();

            tableForm.Init(
                tableData,
                _form.TableForm_FormClosed,
                _form.TableForm_ModelChanged);
            tableForm.MdiParent = _form;

            tableForm.Show();
        }
Exemplo n.º 7
0
        public void getStationTableTest()
        {
            //arrange
            TableForm mainFormTest  = new TableForm();
            Transport transportTest = new Transport();
            //act
            var result         = mainFormTest.GetStationBoard("Sursee");
            var expectedResult = transportTest.GetStationBoard("Sursee", "8502007");

            //assert
            Assert.AreNotEqual(result, expectedResult);
        }
Exemplo n.º 8
0
 private void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (_gameManager.formsOnTable == 0)
         {
             TableForm tableForm = form.GetComponent <TableForm>();
             tableForm.isUsed = false;
             form.SetActive(true);
             _gameManager.formsOnTable++;
         }
     }
 }
Exemplo n.º 9
0
 protected override void OnInit(EventArgs e)
 {
     CurrentTable = TableForm.TableForms.Find(a => { return(a.TableID == TableID); });
     if (CurrentTable == null)
     {
         CurrentTable = new TableForm {
             TableID = TableID, FromCollections = new List <TableFormItem>(), TableName = TableName
         };
         TableForm.TableForms.Add(CurrentTable);
     }
     CurrentForms = CurrentTable.FromCollections;
     base.OnInit(e);
 }
Exemplo n.º 10
0
 /// <summary>
 /// 列表事件
 /// </summary>
 /// <param name="source"></param>
 /// <param name="e"></param>
 protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         Guid          id  = Guid.Parse(((HtmlInputCheckBox)e.Item.FindControl("id")).Value);
         TableFormItem frm = CurrentForms.Find(a => { return(a.ID == id); });
         if (id != null)
         {
             CurrentForms.Remove(frm);
             TableForm.SaveForms();
         }
         this.BindData();
     }
 }
Exemplo n.º 11
0
 public static TableInformation Show(string PageShow)
 {
     if (instance == null)
         instance = new TableForm();
     if (PageShow != null)
         instance.TablePanel.Caption = PageShow;
     instance.BtnOk.Visible = false;
     instance.mode = MODE_SINGLE;
     instance.tableSelect = null;
     instance.LoadTableInformation();
     instance.AddTableButton();
     instance.ShowDialog();
     return instance.tableSelect;
 }
Exemplo n.º 12
0
 public static int[] ShowMulti(string PageShow, TableInformation mainTable, int[] mergeTable)
 {
     if (instance == null)
         instance = new TableForm();
     if (PageShow != null)
         instance.TablePanel.Caption = PageShow;
     instance.BtnOk.Visible = true;
     instance.mode = MODE_MULTI;
     instance.tableSelect = mainTable;
     instance.multiTemp.Clear();
     instance.LoadTableInformation();
     instance.CreateMultiTemp(mergeTable);
     instance.AddTableButton();
     instance.ShowDialog();
     return instance.multiSelectID;
 }
Exemplo n.º 13
0
        /// <summary>
        /// 加载窗体
        /// </summary>
        private void InitForm()
        {
            string dbserver = string.Empty;

            if (dao_table.GetDBcon().dbType == Sephiroth.Infrastructure.DataPersistence.Dapper.DBcon.dbtype.Oracle)
            {
                dbserver = ConfigurationManager.AppSettings["dbserver"].ToString();
            }
            var tablename = dao_table.GetThisAllTable(dbserver);
            var items     = tablename.OrderBy(x => x.TABLE_NAME)
                            .Select(x =>
            {
                var nbi = new NavBarItemLink(new NavBarItem
                {
                    Name    = x.TABLE_NAME,
                    Caption = x.TABLE_NAME,
                });
                nbi.Item.LinkClicked += (send, e) =>
                {
                    //判断当前页面是否已经打开
                    var pindex = this.xtraTabbedMdiManager1.Pages.FirstOrDefault(page => x.TABLE_NAME.Equals(page.Text));
                    //选中
                    if (pindex != null)
                    {
                        this.xtraTabbedMdiManager1.SelectedPage = pindex;
                        return;
                    }
                    //创建新页面
                    TableForm doc = new TableForm(x);

                    doc.Text        = x.TABLE_NAME;
                    doc.WindowState = FormWindowState.Maximized;
                    doc.MdiParent   = this;
                    doc.Show();
                };
                return(nbi);
            }).ToArray();

            this.nbg_table.ItemLinks.AddRange(items);
        }
Exemplo n.º 14
0
        public static void ShowTableStatic(Image<Gray, float> _data, string Title)
        {
            TableForm form = new TableForm();

            if (form.checkBox1.Checked)
                return;
            form.Text = "Table - " + Title;

            // Create the output table.
            DataTable d = new DataTable();

            // Loop through all process names.
            for (int i = 0; i < _data.Width; i++)
            {
                // Add the program name to our columns.
                d.Columns.Add(i.ToString());
            }

            for (int i = 0; i < _data.Height; i++)
            {
                d.Rows.Add();

                for (int j = 0; j < _data.Width; j++)
                {
                    // Add the program name to our columns.
                    d.Rows[i][j] = ((Gray)_data[i, j]).Intensity.ToString();
                }

            }

            form.dataGridView1.DataSource = d;

            for (int i = 0; i < _data.Width; i++)
            {
                form.dataGridView1.Columns[i].Width = 50;
            }

            form.ShowDialog();
        }
Exemplo n.º 15
0
        /*
         *      Обработка MouseUp по кнопку, ассоциируемой с таблицей (TableButton)
         */
        public void TableBtn_X_MouseUp(object sender, MouseEventArgs e)
        {
            var       button    = (Button)sender;
            TableForm tableForm = new TableForm();

            tableForm.Init(
                Model.TableDatas.Where(i => i.Descriptor.Name == button.Text).ElementAt(0),
                TableForm_FormClosed,
                TableForm_ModelChanged);

            switch (e.Button)
            {
            case MouseButtons.Left:
            {
                // если окно таблицы, с которой связяна эта кнопка, НЕ открыто
                if (!MdiChildren.Any(i => i.Text == button.Text))
                {
                    var tableData = TableData.Get(tableForm);
                    Model.AddExistingTable(tableData);
                }
                else
                {
                    Form mdiForm = MdiChildren.Where(i => i.Text == button.Text).ElementAt(0);
                    mdiForm.BringToFront();
                }

                break;
            }

            case MouseButtons.Right:
            {
                CtxMenuTableButtonName = button.Text;

                CtxMS_TableBtnX.Show(Cursor.Position);

                break;
            }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 批量删除 刷新表结构
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Int32 arguments = Convert.ToInt32(Request.Form["__EVENTARGUMENT"]);

            switch (arguments)
            {
            case 1:
                SiteTable.RefreshTable();
                this.BindData();
                break;

            case -1:
                List <SiteTable> list = new List <SiteTable>();
                foreach (RepeaterItem item in Repeater1.Items)
                {
                    HtmlInputCheckBox chk = item.FindControl("id") as HtmlInputCheckBox;
                    if (chk.Checked)
                    {
                        var tabid = Guid.Parse(chk.Value);
                        var tab   = CurrentTables.Find(a => { return(a.ID == tabid); });
                        if (tab != null)
                        {
                            String sql = "DROP TABLE " + tab.TableName;
                            db.ExecuteCommand(sql);
                            CurrentTables.Remove(tab);
                        }
                        var frm = TableForm.TableForms.Find(a => { return(a.TableID == tabid); });
                        if (frm != null)
                        {
                            TableForm.TableForms.Remove(frm);
                            TableForm.SaveForms();
                        }
                    }
                }
                SiteTable.SaveTables(CurrentTables);
                this.BindData();
                break;
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Int32 arguments = Convert.ToInt32(Request.Form["__EVENTARGUMENT"]);

            if (arguments == -1)
            {
                List <TableForm> list = new List <TableForm>();
                foreach (RepeaterItem item in Repeater1.Items)
                {
                    HtmlInputCheckBox chk = item.FindControl("id") as HtmlInputCheckBox;
                    if (chk.Checked)
                    {
                        var frm = CurrentForms.Find(a => { return(a.ID == Guid.Parse(chk.Value)); });
                        if (frm != null)
                        {
                            CurrentForms.Remove(frm);
                        }
                    }
                }
                TableForm.SaveForms();
                this.BindData();
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 列表事件
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            String id = ((HtmlInputCheckBox)e.Item.FindControl("ID")).Value;

            if (e.CommandName == "del")
            {
                Guid tabid = Guid.Parse(id);
                var  tab   = CurrentTables.Find(a => { return(a.ID == tabid); });
                if (tab != null)
                {
                    String sql = "DROP TABLE " + tab.TableName;
                    db.ExecuteCommand(sql);
                    CurrentTables.Remove(tab);
                    SiteTable.SaveTables(CurrentTables);
                }
                var frm = TableForm.TableForms.Find(a => { return(a.TableID == tabid); });
                if (frm != null)
                {
                    TableForm.TableForms.Remove(frm);
                    TableForm.SaveForms();
                }
                this.BindData();
            }
        }
Exemplo n.º 19
0
 public AddRateForm(TableForm parent)
 {
     InitializeComponent();
     this.parent = parent;
 }
Exemplo n.º 20
0
 private void openExcelFile_FileOk(object sender, CancelEventArgs e)
 {
     TableForm table = new TableForm(openExcelFile.FileName);
     table.Show();
 }
Exemplo n.º 21
0
        private void button1_Click(object sender, EventArgs e)
        {
            XmlDocument outF = new XmlDocument();
            XmlElement rootelem = outF.CreateElement("PerovskiySPEC");
            Dictionary<string, string> dict = new Dictionary<string, string>();
            List<string> ff = new List<string>();
            ff.AddRange(richTextBox1.Lines);
            //int strcount = (int)(ff.Length / 6); // Math.Round(ff.Length / 6);

            int i = 0;
            List<Tovar> SpecList = new List<Tovar>();
            while (ff.Count > 0)
            {
                List<string> temp = new List<string>();
                if ((ff.Count > 0) && (ff[0] == ""))
                    ff.RemoveAt(0);
                while ((ff.Count > 0) && (ff[0] != ""))
                {
                    temp.Add(ff[0]);
                    ff.RemoveAt(0);
                }
                //ff[i] = "_" + ff[i];
                //i++;

                Tovar t = new Tovar();
                //string _name = "";
                //string _artc = "";
                //string _code = "";
                //string _size = "";
                //string _pric = "";
                if (temp.Count > 0)
                {
                    t._name = temp[0];
                    t._artc = temp[1].Replace("Артикул:", "").Trim();
                    t._code = temp[2].Replace("Код товара для заказа:", "").Trim();
                    if (temp.Count == 4)
                    {
                        t.Calc( temp[3]);
                    }
                    else
                    {
                        t._size = temp[3];
                        t.Calc( temp[4]);
                    }
                    SpecList.Add(t);
                    //string _price = "";
                    //string _total = "";
                    //float _cnt = 0;
                    //if (!string.IsNullOrEmpty(_pric))
                    //{
                    //    _price = _pric.Substring(0, _pric.IndexOf("р.")).Replace(" ", "");
                    //    _total = _pric.Substring(_pric.IndexOf("Удалить") + 7);
                    //    _total = _total.Substring(0, _total.IndexOf("р")).Replace(" ", "");
                    //    _cnt = int.Parse(_total) / int.Parse(_price);
                    //}

                    XmlElement el = outF.CreateElement("position");
                    el.SetAttribute("Id", rootelem.ChildNodes.Count.ToString());

                    XmlElement code = outF.CreateElement("Code");
                    code.InnerText = t._code;
                    //code.SetAttribute("desc","Код товара для заказа")
                    XmlNode tmp = el.AppendChild(code);

                    XmlElement name = outF.CreateElement("Name");
                    name.InnerText = t._name;
                    //name.SetAttribute("desc","Наименование товара")
                    tmp = el.AppendChild(name);

                    XmlElement art = outF.CreateElement("Article");
                    art.InnerText = t._artc;
                    //art.SetAttribute("desc","Артикул")
                    tmp = el.AppendChild(art);

                    XmlElement sz = outF.CreateElement("Sizes");
                    sz.InnerText = t._size;
                    //sz.SetAttribute("desc","Габариты и вес")
                    tmp = el.AppendChild(sz);

                    XmlElement pr = outF.CreateElement("Price");
                    pr.InnerText = t._price.ToString();
                    //pr.SetAttribute("desc","Цена а шт.")
                    tmp = el.AppendChild(pr);

                    XmlElement ct = outF.CreateElement("Count");
                    ct.InnerText = t._cnt.ToString();
                    tmp = el.AppendChild(ct);
                    tmp = rootelem.AppendChild(el);
                }
            }

            outF.AppendChild(rootelem);
            richTextBox1.Text = outF.OuterXml;
            string savepath = "";
            if (FilePath != "")
            {
                string nf = Path.GetFileNameWithoutExtension(FilePath);
            //System.Environment.GetEnvironmentVariable("USERPROFILE") + @"\desktop\PerovskiSpec[nf].xml";
                savepath = Path.GetDirectoryName(FilePath) + "\\PerovskiSpec[" + nf + "].xml";
                outF.Save(savepath);
                FilePath = "";
            }
            TableForm tf = new TableForm(SpecList, savepath);
            tf.ShowDialog();
        }
Exemplo n.º 22
0
 public TableView(TableForm form)
 {
     _form = form;
 }
Exemplo n.º 23
0
        private void showTableButton_Click(object sender, EventArgs e)
        {
            TableForm tableForm = new TableForm(records);

            tableForm.Show();
        }
Exemplo n.º 24
0
 private void TableFormInit()
 {
     tableForm           = new TableForm();
     tableForm.MdiParent = this;
     tableForm.Show();
 }
Exemplo n.º 25
0
        /// <summary>
        /// Opens a TableForm based on the path to a Index or StringsFile.
        /// </summary>
        /// <param name="filePath">Path to the Index or StringsFile.</param>
        private void _OpenIndexFile(String filePath)
        {
            TableForm tableForm;
            PackFile packFile;
            if (filePath.EndsWith(IndexFile.Extension))
            {
                packFile = new IndexFile(filePath);
            }
            else
            {
                packFile = new HellgatePackFile(filePath);
            }

            // Check if the form is already open.
            // If true, then activate the form.
            bool isOpen = _openTableForms.Where(tf => tf.FilePath == filePath).Any();
            if (isOpen)
            {
                tableForm = _openTableForms.Where(tf => tf.FilePath == filePath).First();
                if (tableForm.Created)
                {
                    tableForm.Select();
                    return;
                }
            }

            // Try read the file.
            // If an exception is caught, log the error and inform the user.
            byte[] buffer;
            try
            {
                buffer = File.ReadAllBytes(filePath);
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex, false);
                return;
            }

            // parse file
            try
            {
                packFile.ParseFileBytes(buffer);
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex, false);
                return;
            }

            tableForm = new TableForm(packFile)
            {
                MdiParent = this,
                Text = Text + ": " + packFile.Path
            };
            if (!_openTableForms.Contains(tableForm)) _openTableForms.Add(tableForm);
            tableForm.Show();
        }
Exemplo n.º 26
0
        void TableFormOpen()
        {
            TableForm TB = new TableForm();

            TB.ShowDialog();
        }
Exemplo n.º 27
0
 public AddSubscriberForm(TableForm parent)
 {
     InitializeComponent();
     this.parent = parent;
 }
Exemplo n.º 28
0
        private void button9_Click(object sender, EventArgs e)
        {
            goodToForm.Clear();

            if (dateTimePicker2.Value.Ticks <= dateTimePicker3.Value.Ticks)
            {
                foreach (Good good in Goodsmanager.Goods)
                {
                    if ((good.DateStart.Ticks >= dateTimePicker2.Value.Ticks && good.DateStart.Ticks <= dateTimePicker3.Value.Ticks) || (good.DateFinish.Ticks >= dateTimePicker2.Value.Ticks && good.DateFinish.Ticks <= dateTimePicker3.Value.Ticks) || (good.DateFinish.Ticks >= dateTimePicker3.Value.Ticks && good.DateStart.Ticks <= dateTimePicker2.Value.Ticks))
                    {
                        goodToForm.Add(good);
                    }
                    else
                    {
                        if (good.DateFinish.Ticks < dateTimePicker2.Value.Ticks)
                        {
                            long elapsedSpan = dateTimePicker2.Value.Ticks - good.DateFinish.Ticks;
                            TimeSpan tS = new TimeSpan(elapsedSpan);
                            if (good.Fine >= (good.Width / 25) * (good.Height / 25) * 10 * tS.Days)
                                goodToForm.Add(good);
                        }
                    }
                }
                TableForm tableForm = new TableForm();
                tableForm.Show(this);
            }
        }