public async Task ValidateIds <T>(IBaseDao <T> dao, IEnumerable <long> ids) where T : BaseEntity <T> { foreach (var id in ids) { await ValidateId(dao, id); } }
public void aTest() { IBaseDao <Com_Count> iBaseDao = DaoFactory.Get <IComCountDao>(); ComCountDao target = new ComCountDao(); // TODO: 初始化为适当的值 Assert.Inconclusive("无法验证不返回值的方法。"); }
public static IBaseDao GetDatabaseDAO() { IBaseDao databaseDAO = mDatabaseUtility_Main.GetDatabaseDAO(); databaseDAO.SetConnectionConfig("localhost", "postgres", "Thu123456!", "smartcontract", "5432"); return(databaseDAO); }
public override IBaseDao GenerateBusinessLayer(WindowTabInfo tabInfo) { IBaseDao dao = base.GenerateBusinessLayer(tabInfo); AddEvent(tabInfo, dao, WindowTabEventManagerType.BusinessLayer); return(dao); }
private void Initialize(WindowTabInfo windowTabInfo, IControlManager cmParent) { ISearchManager smMaster = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(windowTabInfo, cmParent == null ? null : cmParent.DisplayManager); IWindowControlManager cmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(windowTabInfo, smMaster) as IWindowControlManager; if (cmParent != null && cmParent.Dao is IRelationalDao) { ManagerFactory.GenerateBusinessLayer(cmParent.Dao as IRelationalDao, windowTabInfo); } else { IBaseDao daoMaster = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(windowTabInfo); cmMaster.Dao = daoMaster; } this.SetControlManager(cmMaster, windowTabInfo.GridName); //ArchiveSearchForm searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]); //this.SearchPanel = searchForm; //cmMaster.StateControls.Add(searchForm); // daoParent's subDao is inserted in detailForm if (this is IBoundGridWithDetailGridLoadOnDemand) { ArchiveFormFactory.GenerateDetailGrids(this as IBoundGridWithDetailGridLoadOnDemand, windowTabInfo); } }
public override IBaseDao GetDao(Dao dao) { IBaseDao baseDao = null; if (this.daoMap.TryGetValue(dao, out baseDao)) { return baseDao; } switch (dao) { case Dao.Restaurant: baseDao = new InMemoryRestaurantDao(); break; case Dao.Item: baseDao = new InMemoryItemDao(); break; case Dao.ItemCategory: baseDao = new InMemoryItemCategoryDao(); break; case Dao.Disount: baseDao = new InMemoryDiscountDao(); break; case Dao.DiscountType: baseDao = new InMemoryDiscountTypeDao(); break; default: return null; } daoMap.Add(dao, baseDao); return baseDao; }
internal void SetUow(string connectionStringOrName) { if (!String.IsNullOrEmpty(connectionStringOrName)) { connectionStringOrName = string.Format("{0}initial catalog={1};", connectionStringOrName, Uow.Context.Database.Connection.Database); _baseDao = new BaseDao <TContext, TEntity>(connectionStringOrName); } }
//private DatabaseImplementUtility _DatabaseUtility = null; //public bool CheckConnection(string host, string user, string password, string database, string port) //{ // try // { // this.GetDatabaseDAO().SetConnectionConfig(host, user, password, database, port); // if (GetDatabaseType() == DATABASE_TYPE.POSTGRESQL) // { // StringBuilder builder = new StringBuilder(); // builder.Append(" SELECT NOW() AS TIME_NOW "); // return (this.GetDatabaseDAO().DoGetDataRow(builder.ToString()) != null); // } // return ((GetDatabaseType() == DATABASE_TYPE.SQLITE) && File.Exists(@"Database\" + database + ".db")); // } // catch (Exception exception) // { // SanitaLog.e("DatabaseUtility", "Check connection error !", exception); // return false; // } //} //public static string Escape(bool s) //{ // if (s) // { // return "'1'"; // } // return "'0'"; //} //public static string Escape(IList<int> s) => // ("(" + string.Join(",", (from p in s select p.ToString()).ToArray<string>()) + ")"); //public static string Escape(byte[] s) //{ // if ((GetDatabaseType() == DATABASE_TYPE.POSTGRESQL) || (GetDatabaseType() == DATABASE_TYPE.SQLITE)) // { // return SanitaUtility.ConvertBinary2HexString_POSTGRES(s); // } // return SanitaUtility.ConvertBinary2HexString_MYSQL(s); //} //public static string Escape(DateTime s) => // $"'{s:yyyy-MM-dd HH:mm:ss}'"; //public static string Escape(double s) => // ("'" + s.ToString(CultureInfo.InvariantCulture) + "'"); //public static string Escape(int s) => // ("'" + s.ToString() + "'"); //public static string Escape(long s) => // ("'" + s.ToString() + "'"); //public static string Escape(string s) //{ // if (string.IsNullOrEmpty(s)) // { // if ((GetDatabaseType() == DATABASE_TYPE.POSTGRESQL) || (GetDatabaseType() == DATABASE_TYPE.SQLITE)) // { // return "''"; // } // return "NULL"; // } // return ("'" + s.Replace("'", "''") + "'"); //} //public static string Escape(ulong s) //{ // if (s == 0L) // { // return "NULL"; // } // DateTime time = DateTime.FromBinary((long) s); // return $"'{time:yyyy-MM-dd HH:mm:ss}'"; //} //public DateTime GetCurrentTime() //{ // StringBuilder builder = new StringBuilder(); // if (GetDatabaseType() == DATABASE_TYPE.POSTGRESQL) // { // builder.Append(" SELECT NOW()::TIMESTAMP WITHOUT TIME ZONE AS TIME_NOW "); // } // else if (GetDatabaseType() == DATABASE_TYPE.MYSQL) // { // builder.Append(" SELECT NOW() AS TIME_NOW "); // } // else // { // return DateTime.Now; // } // DataRow row = this.GetDatabaseDAO().DoGetDataRow(builder.ToString()); // DateTime result = new DateTime(); // if (row != null) // { // if (row["TIME_NOW"] != DBNull.Value) // { // DateTime.TryParse(row["TIME_NOW"].ToString(), out result); // } // else // { // SanitaLogEx.e("X100", "GetCurrentTime.row.TIME = null"); // } // } // else // { // SanitaLogEx.e("X100", "GetCurrentTime.row = null"); // } // if (result.Year > 0x7d1) // { // UtilityDate.SetLocalTime(result); // } // return result; //} public IBaseDao GetDatabaseDAO() { if (this._baseDAO == null) { this._baseDAO = new NpgsqlBaseDao(); } return(this._baseDAO); }
public async Task ValidateNotDeletedById <T>(IBaseDao <T> dao, long id) where T : BaseEntity <T> { if (!await dao.ExistAndNotDeletedByIdAsync(id)) { var invalidEntityIdException = new InvalidEntityIdException(id, "Entity with this id does not exist!"); Logger.Error(invalidEntityIdException, "{type} with {id} does not exist!", typeof(T), id); throw invalidEntityIdException; } }
public async Task ValidateUniqueId <T>(IBaseDao <T> dao, long id) where T : BaseEntity <T> { if (await dao.ExistByIdAsync(id)) { var duplicateEntryException = new DuplicateEntryException(id, "Entity already exists!"); Logger.Error(duplicateEntryException, "{type} with {id} already exists!", typeof(T), id); throw duplicateEntryException; } }
/// <summary> /// Maps the base fields. /// </summary> /// <param name="source">The source.</param> public void MapBaseFields(IBaseDao source) { Id = source.Id; CreatedAt = source.CreatedAt; CreatedBy = source.CreatedBy; ChangedAt = source.ChangedAt; ChangedBy = source.ChangedBy; State = source.State; }
public void InitDatabase(IBaseDao _baseDAO, IList <ClassTable> _listFixTable) { myBaseDao = _baseDAO; listFixTable = _listFixTable; IsHaveLogTable = listFixTable.Any(p => p.Table.ToLower() == "tb_mediboxlogsql"); IsHaveLogTable = false; myBaseDao.SetDatabaseImplementUtility(this); }
public IBaseDao GetDatabaseDAO() { if (_baseDAO == null) { if (GetDatabaseType() == DATABASE_TYPE.POSTGRESQL) { _baseDAO = new NpgsqlBaseDao(); } } return(_baseDAO); }
protected override void OnEntityChanged(EntityChangedEventArgs e) { if (this.Dao == null) { if (s_defaultDao == null) { s_defaultDao = new Feng.NH.NHibernateDao <IEntity>(null); } this.Dao = s_defaultDao; } base.OnEntityChanged(e); }
//public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo) //{ // return GenerateArchiveDetailForm(windowInfo, null); //} public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo) { ArchiveDetailForm ret = null; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos.Count == 0) { throw new ArgumentException("there should be winTab infos in window of " + windowInfo.Name); } ISearchManager sm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IWindowControlManager cmParent = null; if (string.IsNullOrEmpty(tabInfos[0].ControlManagerClassName)) { IDisplayManager dmParent = ServiceProvider.GetService <IManagerFactory>().GenerateDisplayManager(tabInfos[0], sm); ret = GenerateArchiveDetailForm(windowInfo, dmParent); } else { cmParent = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(tabInfos[0], sm) as IWindowControlManager; IBaseDao daoParent = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(tabInfos[0]); cmParent.Dao = daoParent; ret = GenerateArchiveDetailForm(windowInfo, cmParent, daoParent as IRelationalDao); } ret.Text = windowInfo.Text; ret.Name = windowInfo.Name; ArchiveSearchForm searchForm = null; ret.SetSearchPanel(() => { if (searchForm == null) { searchForm = new ArchiveSearchForm(ret, sm, tabInfos[0]); if (cmParent != null) { cmParent.StateControls.Add(searchForm); } } return(searchForm); }); return(ret); }
public static IArchiveGrid AssociateArchiveDetailGrid(Control container, string windowTabName, IControlManager cmParent, IRelationalDao daoParent) { WindowTabInfo windowTabInfo = ADInfoBll.Instance.GetWindowTabInfo(windowTabName); if (windowTabName == null) { return(null); } GeneratedArchiveUnboundGrid grid = new GeneratedArchiveUnboundGrid(windowTabInfo, cmParent); IWindowControlManager subCm = grid.ControlManager as IWindowControlManager; //ISearchManager subSm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(windowTabInfo, cmParent.DisplayManager); //IWindowControlManager subCm = ServiceProvider.GetService<IManagerFactory>().GenerateControlManager(windowTabInfo, subSm) as IWindowControlManager; //subCm.Name = windowTabInfo.Name; //grid.SetControlManager(subCm, windowTabInfo.GridName); //ManagerFactory.GenerateBusinessLayer(daoParent, windowTabInfo); int i = 0; IBaseDao subDao = daoParent.GetRelationalDao(i); if (subDao is IMemoriedRelationalDao) { IMemoryDao subMemoryDao = ((IMemoriedRelationalDao)daoParent.GetRelationalDao(i)).DetailMemoryDao; subCm.Dao = subMemoryDao; //subMemoryDao.AddSubDao(new MasterDetailMemoryDao<>(cmParent)); ((IMemoriedRelationalDao)daoParent.GetRelationalDao(i)).AddRelationToMemoryDao(cmParent.DisplayManager); } else { subCm.Dao = subDao; } AddControl(container, grid); grid.LoadLayout(); grid.IsInDetailMode = true; cmParent.StateControls.Add(grid); cmParent.CheckControls.Add(grid); return(grid); }
public GeneratedArchiveExcelForm(WindowInfo windowInfo) { this.Name = windowInfo.Name; this.Text = windowInfo.Text; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos == null) { throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name); } if (tabInfos.Count == 0) { throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } if (tabInfos.Count > 1) { throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } ISearchManager sm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IBaseDao daoParent = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(tabInfos[0]); IWindowControlManager cmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(tabInfos[0], sm) as IWindowControlManager; cmMaster.Dao = daoParent; base.ControlManager = cmMaster; this.MasterGrid.GridName = tabInfos[0].GridName; this.ExcelGrid.BeginInitialize(); CreateGridColumns(this.MasterGrid); this.ExcelGrid.EndInitialize(); this.ExcelGrid.SetColumnManagerRowHorizontalAlignment(); // 不需要。和ArchiveOperationForm同一个WindowInfo,会出错 //GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this); }
public BaseBusiness(IBaseDao <TEntity> baseDao) { _baseDao = baseDao; }
//private static void AddManualDetailForm(System.Windows.Forms.Form form, IArchiveDetailFormAuto detailFormAuto) //{ // form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; // form.TopLevel = false; // detailFormAuto.ReplaceFlowLayoutPanel(form); //} public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo, IWindowControlManager cmParent, IBaseDao daoParent, IDisplayManager dmParent, IArchiveDetailForm originalDetailForm = null) { ArchiveDetailForm detailForm = originalDetailForm as ArchiveDetailForm; IList<WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); IList<WindowTabInfo> detailFormTabInfos = new List<WindowTabInfo>(); IList<WindowTabInfo> detailFormTabInfos2 = new List<WindowTabInfo>(); foreach (WindowTabInfo subTabInfo in tabInfos[0].ChildTabs) { if (subTabInfo.IsInDetailForm) { detailFormTabInfos.Add(subTabInfo); } else { detailFormTabInfos2.Add(subTabInfo); } } //if (detailStyleForm == null && windowInfo.DetailForm != null) //{ // FormInfo formInfo = ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name); // if (formInfo == null) // { // throw new ArgumentException("There is no FormInfo with Name of " + windowInfo.DetailForm.Name); // } // detailStyleForm = CreateForm(formInfo); //} //if (detailStyleForm != null) //{ // ret = detailStyleForm as ArchiveDetailForm; //} // 当第二层的任何一个ControlManager为空时,DetailForm作为不可编辑的。 bool isControlManagerEnable = cmParent != null; if (isControlManagerEnable) { for (int i = 0; i < detailFormTabInfos.Count; ++i) { if (string.IsNullOrEmpty(detailFormTabInfos[i].ControlManagerClassName)) { dmParent = cmParent.DisplayManager; isControlManagerEnable = false; break; } } } if (detailForm == null) { if (detailFormTabInfos.Count == 0) { if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAuto(cmParent, tabInfos[0].GridName); } else { detailForm = new ArchiveDetailFormAuto(dmParent, tabInfos[0].GridName); } } else if (detailFormTabInfos.Count == 1) { if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAutoWithDetailGrid(cmParent, tabInfos[0].GridName); } else { detailForm = new ArchiveDetailFormAutoWithDetailGrid(dmParent, tabInfos[0].GridName); } } else { string[] texts = new string[detailFormTabInfos.Count]; for (int i = 0; i < detailFormTabInfos.Count; ++i) { texts[i] = detailFormTabInfos[i].Text; } if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(cmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts); } else { detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(dmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts); } } //IArchiveDetailFormAuto detailFormAuto = ret as IArchiveDetailFormAuto; //if (detailStyleForm != null && detailFormAuto != null) //{ // AddManualDetailForm(detailStyleForm, detailFormAuto); //} } else { // Dao 在cmParent处已经设置了 if (isControlManagerEnable) { detailForm.SetControlMananger(cmParent, tabInfos[0].GridName); } else { detailForm.SetDisplayManager(dmParent, tabInfos[0].GridName); } } detailForm.Name = windowInfo.Name; detailForm.Text = windowInfo.Text; // 只有2层可编辑。主层(控件)-第二层(grid)。再下去就是第二层grid的DetailGrid,不可编辑。 IArchiveDetailFormWithDetailGrids detailFormWithGrids = detailForm as IArchiveDetailFormWithDetailGrids; if (detailFormWithGrids != null) { for (int i = 0; i < detailFormTabInfos.Count; ++i) { if (i >= detailFormWithGrids.DetailGrids.Count) break; // 主是ControlManager,并不一定子也是ControlManager。 // 主可以在grid编辑,不能通过DetailForm编辑。此时DetailForm是另外显示的东西。 if (isControlManagerEnable) { var daoRelational = daoParent as IRelationalDao; if (daoRelational == null) { throw new ArgumentException("IArchiveDetailFormWithDetailGrids must has IRelationalDao."); } ISearchManager subSm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], cmParent.DisplayManager); IWindowControlManager subCm = ServiceProvider.GetService<IManagerFactory>().GenerateControlManager(detailFormTabInfos[i], subSm) as IWindowControlManager; subCm.Name = detailFormTabInfos[i].Name; ((IArchiveGrid)detailFormWithGrids.DetailGrids[i]).SetControlManager(subCm, detailFormTabInfos[i].GridName); ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos[i]); IBaseDao subDao = daoRelational.GetRelationalDao(i); if (subDao is IMemoriedRelationalDao) { IMemoryDao subMemoryDao = ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).DetailMemoryDao; subCm.Dao = subMemoryDao; //subMemoryDao.AddSubDao(new MasterDetailMemoryDao<>(cmParent)); ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).AddRelationToMemoryDao(cmParent.DisplayManager); } else { subCm.Dao = subDao; } } else { ISearchManager subSm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], dmParent); IDisplayManager subDm = ServiceProvider.GetService<IManagerFactory>().GenerateDisplayManager(detailFormTabInfos[i], subSm); subDm.Name = detailFormTabInfos[i].Name; detailFormWithGrids.DetailGrids[i].SetDisplayManager(subDm, detailFormTabInfos[i].GridName); } GenerateDetailGrids(detailFormWithGrids.DetailGrids[i], detailFormTabInfos[i]); } } if (isControlManagerEnable) { // Generate Other Daos for (int i = 0; i < detailFormTabInfos2.Count; ++i) { if (!string.IsNullOrEmpty(detailFormTabInfos2[i].BusinessLayerClassName)) { ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos2[i]); } } } // if Master Tab's IsInDetailForm=false, Invisible it if (!tabInfos[0].IsInDetailForm) { if (detailForm is IArchiveDetailFormAuto) { (detailForm as IArchiveDetailFormAuto).RemoveControls(); } } return detailForm; }
public RightService(IBaseDao connection) { _connection = connection; }
public void SetUp() { _kernel = new StandardKernel(new DataModule()); _dao = _kernel.Get<IBaseDao>(); Assert.IsNotNull(_dao); }
protected override void OnEntityChanged(EntityChangedEventArgs e) { if (this.Dao == null) { if (s_defaultDao == null) { s_defaultDao = new Feng.NH.NHibernateDao<IEntity>(null); } this.Dao = s_defaultDao; } base.OnEntityChanged(e); }
public CurrencyTypeController(IBaseDao dao) { Dao = dao; }
public CustomBaseController(ILogger <C> logger, IBaseDao <E> baseDao) { _logger = logger; _baseDao = baseDao; }
public BaseService(IBaseDao <T> dao) => this.dao = dao;
//private static void AddManualDetailForm(System.Windows.Forms.Form form, IArchiveDetailFormAuto detailFormAuto) //{ // form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; // form.TopLevel = false; // detailFormAuto.ReplaceFlowLayoutPanel(form); //} public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo, IWindowControlManager cmParent, IBaseDao daoParent, IDisplayManager dmParent, IArchiveDetailForm originalDetailForm = null) { ArchiveDetailForm detailForm = originalDetailForm as ArchiveDetailForm; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); IList <WindowTabInfo> detailFormTabInfos = new List <WindowTabInfo>(); IList <WindowTabInfo> detailFormTabInfos2 = new List <WindowTabInfo>(); foreach (WindowTabInfo subTabInfo in tabInfos[0].ChildTabs) { if (subTabInfo.IsInDetailForm) { detailFormTabInfos.Add(subTabInfo); } else { detailFormTabInfos2.Add(subTabInfo); } } //if (detailStyleForm == null && windowInfo.DetailForm != null) //{ // FormInfo formInfo = ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name); // if (formInfo == null) // { // throw new ArgumentException("There is no FormInfo with Name of " + windowInfo.DetailForm.Name); // } // detailStyleForm = CreateForm(formInfo); //} //if (detailStyleForm != null) //{ // ret = detailStyleForm as ArchiveDetailForm; //} // 当第二层的任何一个ControlManager为空时,DetailForm作为不可编辑的。 bool isControlManagerEnable = cmParent != null; if (isControlManagerEnable) { for (int i = 0; i < detailFormTabInfos.Count; ++i) { if (string.IsNullOrEmpty(detailFormTabInfos[i].ControlManagerClassName)) { dmParent = cmParent.DisplayManager; isControlManagerEnable = false; break; } } } if (detailForm == null) { if (detailFormTabInfos.Count == 0) { if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAuto(cmParent, tabInfos[0].GridName); } else { detailForm = new ArchiveDetailFormAuto(dmParent, tabInfos[0].GridName); } } else if (detailFormTabInfos.Count == 1) { if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAutoWithDetailGrid(cmParent, tabInfos[0].GridName); } else { detailForm = new ArchiveDetailFormAutoWithDetailGrid(dmParent, tabInfos[0].GridName); } } else { string[] texts = new string[detailFormTabInfos.Count]; for (int i = 0; i < detailFormTabInfos.Count; ++i) { texts[i] = detailFormTabInfos[i].Text; } if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(cmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts); } else { detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(dmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts); } } //IArchiveDetailFormAuto detailFormAuto = ret as IArchiveDetailFormAuto; //if (detailStyleForm != null && detailFormAuto != null) //{ // AddManualDetailForm(detailStyleForm, detailFormAuto); //} } else { // Dao 在cmParent处已经设置了 if (isControlManagerEnable) { detailForm.SetControlMananger(cmParent, tabInfos[0].GridName); } else { detailForm.SetDisplayManager(dmParent, tabInfos[0].GridName); } } detailForm.Name = windowInfo.Name; detailForm.Text = windowInfo.Text; // 只有2层可编辑。主层(控件)-第二层(grid)。再下去就是第二层grid的DetailGrid,不可编辑。 IArchiveDetailFormWithDetailGrids detailFormWithGrids = detailForm as IArchiveDetailFormWithDetailGrids; if (detailFormWithGrids != null) { for (int i = 0; i < detailFormTabInfos.Count; ++i) { if (i >= detailFormWithGrids.DetailGrids.Count) { break; } // 主是ControlManager,并不一定子也是ControlManager。 // 主可以在grid编辑,不能通过DetailForm编辑。此时DetailForm是另外显示的东西。 if (isControlManagerEnable) { var daoRelational = daoParent as IRelationalDao; if (daoRelational == null) { throw new ArgumentException("IArchiveDetailFormWithDetailGrids must has IRelationalDao."); } ISearchManager subSm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], cmParent.DisplayManager); IWindowControlManager subCm = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(detailFormTabInfos[i], subSm) as IWindowControlManager; subCm.Name = detailFormTabInfos[i].Name; ((IArchiveGrid)detailFormWithGrids.DetailGrids[i]).SetControlManager(subCm, detailFormTabInfos[i].GridName); ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos[i]); IBaseDao subDao = daoRelational.GetRelationalDao(i); if (subDao is IMemoriedRelationalDao) { IMemoryDao subMemoryDao = ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).DetailMemoryDao; subCm.Dao = subMemoryDao; //subMemoryDao.AddSubDao(new MasterDetailMemoryDao<>(cmParent)); ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).AddRelationToMemoryDao(cmParent.DisplayManager); } else { subCm.Dao = subDao; } } else { ISearchManager subSm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], dmParent); IDisplayManager subDm = ServiceProvider.GetService <IManagerFactory>().GenerateDisplayManager(detailFormTabInfos[i], subSm); subDm.Name = detailFormTabInfos[i].Name; detailFormWithGrids.DetailGrids[i].SetDisplayManager(subDm, detailFormTabInfos[i].GridName); } GenerateDetailGrids(detailFormWithGrids.DetailGrids[i], detailFormTabInfos[i]); } } if (isControlManagerEnable) { // Generate Other Daos for (int i = 0; i < detailFormTabInfos2.Count; ++i) { if (!string.IsNullOrEmpty(detailFormTabInfos2[i].BusinessLayerClassName)) { ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos2[i]); } } } // if Master Tab's IsInDetailForm=false, Invisible it if (!tabInfos[0].IsInDetailForm) { if (detailForm is IArchiveDetailFormAuto) { (detailForm as IArchiveDetailFormAuto).RemoveControls(); } } return(detailForm); }
public ProductsService(IBaseDao dal) { _dal = dal; }
private void Initialize(WindowInfo windowInfo) { this.Name = windowInfo.Name; this.Text = windowInfo.Text; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos == null) { throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name); } if (tabInfos.Count == 0) { throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } if (tabInfos.Count > 1) { throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } ISearchManager smMaster = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IWindowControlManager cmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(tabInfos[0], smMaster) as IWindowControlManager; IBaseDao daoParent = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(tabInfos[0]); cmMaster.Dao = daoParent; ((IArchiveGrid)base.MasterGrid).SetControlManager(cmMaster, tabInfos[0].GridName); // daoParent's subDao is inserted in detailForm if (base.MasterGrid is IBoundGridWithDetailGridLoadOnDemand) { ArchiveFormFactory.GenerateDetailGrids(base.MasterGrid as IBoundGridWithDetailGridLoadOnDemand, tabInfos[0]); } // Load Additional Menus IList <WindowMenuInfo> windowMenuInfos = ADInfoBll.Instance.GetWindowMenuInfo(windowInfo.Name); IList <WindowMenuInfo> masterWindowMenuInfos; IList <WindowMenuInfo> detailWindowMenuInfos; GeneratedArchiveSeeForm.SplitWindowMenu(windowMenuInfos, out masterWindowMenuInfos, out detailWindowMenuInfos); if (masterWindowMenuInfos.Count > 0) { this.GenerateWindowMenu(masterWindowMenuInfos); } if (windowInfo.GenerateDetailForm) { if (windowInfo.DetailForm != null) { m_detailForm = ArchiveFormFactory.CreateForm(ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name)) as IArchiveDetailForm; if (windowInfo.DetailWindow == null) { ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, cmMaster, daoParent, null, m_detailForm); } } // 和主窗体不关联 else if (windowInfo.DetailWindow != null) { WindowInfo detailWindowInfo = ADInfoBll.Instance.GetWindowInfo(windowInfo.DetailWindow.Name); m_detailForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(detailWindowInfo) as IArchiveDetailForm; var searchWindow = m_detailForm.GetCustomProperty(MyChildForm.SearchPanelName) as ArchiveSearchForm; if (searchWindow != null) { searchWindow.EnableProgressForm = false; } } else { m_detailForm = ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, cmMaster, daoParent as IRelationalDao); } if (m_detailForm != null) { //m_detailWindow.ParentArchiveForm = this; // Generate DetailForm's Menu if (detailWindowMenuInfos.Count > 0) { m_detailForm.GenerateWindowMenu(detailWindowMenuInfos); m_detailForm.VisibleChanged += new EventHandler(m_detailForm_VisibleChanged); } } } ArchiveSearchForm searchForm = null; this.SetSearchPanel(() => { if (searchForm == null) { searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]); if (cmMaster != null) { cmMaster.StateControls.Add(searchForm); } } return(searchForm); }); m_attachmentForm = GeneratedArchiveSeeForm.CreateAttachmentWindow(this, windowInfo); GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this); m_windowInfo = windowInfo; }
public FruitsService(IBaseDao dal) { _dal = dal; }
public InventoryService(IBaseDao dal) { _dal = dal; }
public Sys_InfoService(IBaseDao <Sys_Info> dao) : base(dao) { }
public MyDateSetter(string pathToSolution, IBaseDao dao) { _pathToSolution = pathToSolution; Dao = dao; }
public JsonService(IBaseDao connection) { _connection = connection; }
public Sys_UserService(IBaseDao <Sys_User> dao) : base(dao) { }