Exemplo n.º 1
0
        private void AddButton(int i, int j)
        {
            if (i < this.DataDG.Items.Count)
            {
                DataRowView            drv       = DataDG.Items[i] as DataRowView;
                DataGridRow            row       = GetRow(DataDG, i);
                DataGridCellsPresenter presenter = GetVisualChild <DataGridCellsPresenter>(row);
                DataGridCell           cell      = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(j);

                DGObjectDef     objectDef = standard.GetDGObjectDefByName(dataTable.TableName);
                DataFileService dfs       = new DataFileService(objectDef.Code, IDindex[i]);

                StackPanel _stackpanel = new StackPanel();
                _stackpanel.Orientation = Orientation.Horizontal;

                MyButton _button1 = new MyButton();
                _button1.Content = "下载附件";
                _button1._dfs    = dfs;
                _button1.Click  += _button1._dfs.Downloadfile;

                MyButton _button2 = new MyButton();
                _button2.Content = "上传附件";
                _button2._dfs    = dfs;
                _button2.Click  += _button2._dfs.Uploadfile;

                _stackpanel.Children.Add(_button2);
                _stackpanel.Children.Add(_button1);
                cell.Content = _stackpanel;
            }
        }
Exemplo n.º 2
0
        public DataGrid RefreshStyle()
        {
            Models.DGObjectDef dGObject = standard.GetDGObjectDefByName(dataTable.TableName);
            int rowNum = 0;

            foreach (DataRow row in dataTable.Rows)
            {
                try
                {
                    if (rowNum == 0)
                    {
                        rowNum = 1; continue;
                    }
                    int columnNum = 0;
                    foreach (Models.PropertyMeta meta in dGObject.PropertyContainer)
                    {
                        if (meta.RegularExp != null)
                        {
                            var  data   = row[meta.LangStr].ToString();
                            bool reult1 = (data != "" & data != null);
                            bool result = Regex.IsMatch(row[meta.LangStr].ToString(), meta.RegularExp);
                            if (reult1 & !result)
                            {
                                Check(rowNum, columnNum);
                            }
                            if ((meta.IsKey == true | meta.Nullable == false) & (row[meta.LangStr].ToString() == null | row[meta.LangStr].ToString() == ""))
                            {
                                CheckIfEmpty(rowNum, columnNum);
                            }
                        }
                        else if ((meta.IsKey == true | meta.Nullable == false) & (row[meta.LangStr].ToString() == null | row[meta.LangStr].ToString() == ""))
                        {
                            CheckIfEmpty(rowNum, columnNum);
                        }
                        columnNum++;
                    }
                }
                catch (Exception ex)
                {
                    rowNum++;
                    continue;
                }
                rowNum++;
            }
            return(DataDG);
        }