コード例 #1
0
        public void CreateFromField(IFieldTable table, DataGridViewRow row, WorkingStateEnum workingState, bool uploadFile)
        {
            var file = Directory.GetFiles("RDLC").Where(f => this.TemplateName.Equals(Path.GetFileNameWithoutExtension(f))).FirstOrDefault();

            if (workingState == WorkingStateEnum.View && file != null)
            {
                ViewDataForm ndf = new ViewDataForm(file);
                if (ndf.CreateFromFieldTable(table, WorkingStateEnum.View, false))
                {
                    ndf.TableName = table.TableName;
                    if (ndf.ShowDialog() == DialogResult.OK)
                    {
                        DataSource = DBHelper.GetDBHelper().GetDataFromTable(0, 0, TemplateName, "");
                    }
                }
            }

            else if (row != null && RegulationTables.Contains(this.TableName))
            {
                string fileName = "";
                foreach (DataGridViewColumn col in row.DataGridView.Columns)
                {
                    if (col.HeaderText.Contains("名称"))
                    {
                        fileName = row.Cells[col.Name].Value.ToString();
                    }
                }
                if (fileName == "")
                {
                    fileName = this.TableName + row.Cells["ID"].Value.ToString();
                }

                Byte[]         bytes  = DBHelper.GetDBHelper().GetDocFromTableRecordBytes(this.TableName, row.Cells["ID"].Value.ToString(), fileName);
                MemoryStream   stream = new MemoryStream(bytes);
                RegulationFrom rf     = new RegulationFrom()
                {
                    Text = this.TableName, TableName = this.TableName, EditEnable = false, RegulationFileStream = stream, CurrentFieldTable = table
                };
                rf.ShowDialog();
            }
            else
            {
                NewDataForm ndf = new NewDataForm()
                {
                    TableName = this.TableName, TableModeName = this.TableModeName
                };
                if (ndf.CreateFromFieldTable(table, workingState, uploadFile))
                {
                    ndf.TableName = table.TableName;
                    if (ndf.ShowDialog() == DialogResult.OK)
                    {
                        DataSource = DBHelper.GetDBHelper().GetDataFromTable(0, 0, TableName, "");
                    }
                }
            }
        }
コード例 #2
0
        public bool CreateFromField(DataTable table, DataGridViewRow row, WorkingStateEnum workingState, bool uploadFile)
        {
            var file = Directory.GetFiles("RDLC").Where(f => this.TemplateName.Equals(Path.GetFileNameWithoutExtension(f))).FirstOrDefault();

            if (workingState == WorkingStateEnum.View && file != null)
            {
                ViewDataForm ndf = new ViewDataForm(file);
                if (ndf.CreateFromFieldTable(table, WorkingStateEnum.View, false))
                {
                    ndf.TableName = table.TableName;
                    if (ndf.ShowDialog() == DialogResult.OK)
                    {
                        DataSource = DBHelper.GetDBHelper().GetDataFromTable(0, 0, TemplateName, "");
                    }
                }
                return(true);
            }
            return(false);
        }