Beispiel #1
0
        /// <summary>
        /// 选择数据源循环生成文件Entity
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.gridView1.GetSelectedRows().Count() < 0)
                return;
            CreateSetting cs = new CreateSetting();
            cs.ShowDialog();
            if (cs.rfpatch == null)
                return;

            DB_DAO_Facade dbfacade = new DB_DAO_Facade(Login.dao);
            foreach (int rindex in this.gridView1.GetSelectedRows())
            {
                string tablename = this.gridView1.GetRowCellValue(rindex,this.col_表名).ToString();
                var plist = this.dbfacade.IDB_DAO_GetTableObject(tablename);
                string filename = string.Format(cs.rfilename==""?tablename:string.Format(cs.rfilename,tablename));
                object rem = this.gridView1.GetRowCellValue(rindex, this.col_说明);
                CreateEntity ce = new CreateEntity(plist, cs.rfpatch.ToString(), filename,remark:rem==null?string.Empty: rem.ToString());
                ce.CreateEntityRUN();
            }
            MessageBox.Show("文件生成成功!");
        }
Beispiel #2
0
        /// <summary>
        /// 选择数据源循环生成DAO文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem6_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.gridView1.GetSelectedRows().Count() < 0)
                return;
            //DAO文件路径
            string daopatch = string.Empty;
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
            folderBrowserDialog.ShowNewFolderButton = false;
            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                daopatch = folderBrowserDialog.SelectedPath;
            }
            else
                return;

            DB_DAO_Facade dbfacade = new DB_DAO_Facade(Login.dao);
            foreach (int rindex in this.gridView1.GetSelectedRows())
            {
                string tablename = this.gridView1.GetRowCellValue(rindex, this.col_表名).ToString();
                var plist = this.dbfacade.IDB_DAO_GetTableObject(tablename);
                //string filename = string.Format(cs.rfilename == "" ? tablename : string.Format(cs.rfilename, tablename));
                string filename = tablename;
                object rem = this.gridView1.GetRowCellValue(rindex, this.col_说明);
                CreateDAO ce = new CreateDAO(plist, daopatch, filename, remark: rem == null ? string.Empty : rem.ToString());
                ce.CreateEntityRUN();
            }
            MessageBox.Show("DAO文件生成成功!");
        }