public void UnmapViewComponents(View view) { View readView = ViewDao.FindById(view.Id); // Remove all maps for the ViewNodes connected to the View IList <ViewNode> viewNodeList = ViewNodeDao.FindAllByViewId(readView.Id); foreach (ViewNode viewNode in viewNodeList) { // Delete the ViewMap if (viewNode.ViewMap != null) { PropertyMapDao.Delete(viewNode.ViewMap); } // Remove ViewMap from the ViewNode viewNode.ViewMap = null; // Save ViewNode ViewNodeDao.SaveOrUpdate(viewNode); } // Remove the connections from ViewComponents to MappedProperty WalkViewComponentsAndUnmap(readView.VisualTree); }
public View GetViewById(Guid viewId) { View view = ViewDao.FindById(viewId); InitializeView(view); return(view); }
public DataSource CreateDataSourceMaps(DataSource dataSource, View view, Guid serviceMethodId) { ServiceMethod serviceMethod = ServiceMethodDao.FindById(serviceMethodId); if (serviceMethod != null) { MetaManagerUtil.InitializePropertyMap(serviceMethod.RequestMap); MetaManagerUtil.InitializePropertyMap(serviceMethod.ResponseMap); View readView = ViewDao.FindById(view.Id); dataSource.ServiceMethod = serviceMethod; dataSource.RequestMap = new PropertyMap(); dataSource.RequestMap.IsCollection = serviceMethod.RequestMap.IsCollection; dataSource.ResponseMap = new PropertyMap(); dataSource.ResponseMap.IsCollection = serviceMethod.ResponseMap.IsCollection; foreach (MappedProperty sourceProperty in dataSource.ServiceMethod.RequestMap.MappedProperties) { MappedProperty mappedProperty = new MappedProperty(); mappedProperty.Source = sourceProperty; mappedProperty.Target = null; mappedProperty.Name = sourceProperty.Name; mappedProperty.Sequence = sourceProperty.Sequence; mappedProperty.PropertyMap = dataSource.RequestMap; dataSource.RequestMap.MappedProperties.Add(mappedProperty); } foreach (MappedProperty sourceProperty in readView.ResponseMap.MappedProperties) { MappedProperty mappedProperty = new MappedProperty(); mappedProperty.Source = sourceProperty; mappedProperty.Target = null; mappedProperty.IsEnabled = false; mappedProperty.Name = sourceProperty.Name; mappedProperty.Sequence = sourceProperty.Sequence; mappedProperty.PropertyMap = dataSource.ResponseMap; dataSource.ResponseMap.MappedProperties.Add(mappedProperty); } } return(dataSource); }
public void GetDataSourceToViewRequestMap(DataSource dataSource, View view, out PropertyMap dataSourceToViewRequestMap, out IList <IMappableProperty> sourceProperties, out IList <IMappableProperty> targetProperties) { DataSource readDataSource = DataSourceDao.FindById(dataSource.Id); View readView = ViewDao.FindById(view.Id); if (readDataSource != null && readDataSource.ServiceMethod != null && readDataSource.ServiceMethod.RequestMap != null) { sourceProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readDataSource.ServiceMethod.RequestMap).MappedProperties.Cast <IMappableProperty>()); } else { sourceProperties = new List <IMappableProperty>(); } if (readView.ResponseMap != null) { targetProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readView.ResponseMap).MappedProperties.Cast <IMappableProperty>()); } else { targetProperties = new List <IMappableProperty>(); } IList <UXSessionProperty> sessionProperties = ApplicationService.GetUXSessionProperties(readView.Application); targetProperties = new List <IMappableProperty>(targetProperties.Concat <IMappableProperty>(sessionProperties.Cast <IMappableProperty>())); if (readDataSource != null) { dataSourceToViewRequestMap = readDataSource.RequestMap; MetaManagerUtil.InitializePropertyMap(dataSourceToViewRequestMap); } else { dataSourceToViewRequestMap = null; } }
public ViewNode ConnectViewToViewNode(View view, ViewNode parentViewNode) { if (view != null && parentViewNode != null) { // First update/create the view View readView = ViewDao.FindById(view.Id); parentViewNode = ViewNodeDao.FindById(parentViewNode.Id); // Create viewnode to connect the view to ViewNode viewNode = new ViewNode(); viewNode.Dialog = parentViewNode.Dialog; viewNode.Parent = parentViewNode; viewNode.Sequence = viewNode.Dialog.ViewNodes.Max(node => node.Sequence) + 1; viewNode.Title = null; viewNode.View = readView; // Save the new ViewNode viewNode = ViewNodeDao.SaveOrUpdate(viewNode); if (NHibernateUtil.IsInitialized(parentViewNode.Dialog) && NHibernateUtil.IsInitialized(parentViewNode.Dialog.ViewNodes)) { // Connect the ViewNode to the Dialogs ViewNodes parentViewNode.Dialog.ViewNodes.Add(viewNode); } if (NHibernateUtil.IsInitialized(parentViewNode.Children)) { // Connect the ViewNode as a child to the Parent ViewNode parentViewNode.Children.Add(viewNode); } return(viewNode); } return(null); }
public Dialog CreateOrUpdateSearchPanelView(Dialog dialog) { dialog = this.GetDialogWithViewTree(dialog.Id); if (dialog != null) { View interfaceView = dialog.InterfaceView; View view = dialog.SearchPanelView; if (view != null) { view = this.GetViewById(view.Id); if (!view.IsLocked || view.LockedBy != Environment.UserName) { return(dialog); } } else { if (!dialog.IsLocked || dialog.LockedBy != Environment.UserName) { return(dialog); } view = new Cdc.MetaManager.DataAccess.Domain.View(); view.Application = interfaceView.Application; view.BusinessEntity = interfaceView.BusinessEntity; view.RequestMap = interfaceView.RequestMap; view.ResponseMap = interfaceView.RequestMap; view.Type = ViewType.Standard; view.Name = string.Format("{0}SearchPanel", dialog.Name); view.Title = view.Name; MetaManagerServices.GetModelService().SaveDomainObject(view); MetaManagerServices.GetConfigurationManagementService().CheckOutDomainObject(view.Id, typeof(View)); dialog.SearchPanelView = view; DialogDao.SaveOrUpdate(dialog); } if (view.VisualTree == null) { view.VisualTree = new UXSearchPanel("SearchPanel"); } view.Name = string.Format("{0}SearchPanel", dialog.Name); view.Title = view.Name; ViewDao.SaveOrUpdate(view); foreach (MappedProperty property in interfaceView.RequestMap.MappedProperties) { if ((property.IsSearchable) && (FindComponentInSearchPanel(view.VisualTree, property) == null)) { UXSearchPanelItem item = new UXSearchPanelItem(); item.Caption = property.Name; UXTextBox textBox = new UXTextBox(property.Name); textBox.MappedProperty = property; textBox.Width = -1; textBox.Height = 21; item.Children.Add(textBox); item.IsDefaultVisible = true; view.VisualTree.Children.Add(item); } else if (!property.IsSearchable) { UXComponent component = FindComponentInSearchPanel(view.VisualTree, property); if (component != null) { Helpers.ViewHelper.ReplaceComponentInVisualTree(component.Parent, null); } } } SaveView(view); } return(dialog); }
public IList <string> FindAllUniqueCustomDLLNames(Guid applicationId) { return(ViewDao.FindAllUniqueCustomDLLNames(applicationId)); }
private View SaveView(View view) { ViewDao.SaveOrUpdate(view); return(view); }
public IList <View> GetViewsByNameAndApplicationId(string viewName, Guid applicationId) { return(ViewDao.FindByNameAndApplicationId(viewName, applicationId)); }
public IList <View> GetViews(string entityName, string viewName, string title, FindViewTypes findViewTypes, Guid applicationId) { return(ViewDao.FindViews(entityName, viewName, title, findViewTypes, applicationId)); }
// GET: GetChartAdmin public ActionResult GetChartAdmin() { List <Product> listProduct = new ProductDao().getAll(); List <Category> listCategory = new CategoryDao().getAll(); List <SubCategory> listSubCategory = new SubCategoryDao().getAll(); List <StatusProduct> listStatusProduct = new StatusProductDao().getAll(); List <StatusCategory> listStatusCategory = new StatusCategoryDao().getAll(); List <StatusSubCategory> listStatusSubCategory = new StatusSubCategoryDao().getAll(); // List<Order> listOrderWatting = new OrderDao().getOrderNotSuccesYetByCustomer(account.getUserName(), 4); int numOfOrder = new OrderDao().countOrderWatting(); int count = new ViewDao().getView(); int count2 = new ProductDao().countProduct(); int count3 = new AccountDao().countAccount(); int count4 = new SubCategoryDao().countSubCategory(); string label = ""; string soluong = ""; List <int> soluongProduct = new ProductDao().countProductGroupByCategoryId(); foreach (Category C in listCategory) { label += "" + C.category + ","; } label.Remove(label.Length - 1); label.Substring(0, label.Length - 1); foreach (int integer in soluongProduct) { soluong += (double)Math.Round((((double)integer / count2) * 100) * 100) / 100 + ","; } soluong.Substring(0, soluong.Length - 1); List <double> listRevenue = new List <double>(); double a = new OrderDao().calRevenueInMonth(4); listRevenue.Add(a); string revenue = ""; foreach (Double double1 in listRevenue) { revenue += (double)Math.Round(double1 * 100) / 100 + ","; } revenue.Substring(0, revenue.Length - 1); string thu = ""; string data = ""; List <ThongkeOrder> listThongKe = new ThongKeOrderDao().getAll(); foreach (ThongkeOrder T in listThongKe) { thu += T.thu + ","; data += T.numOfOrder + ","; } thu = thu.Remove(thu.Length - 1); ViewData["thu"] = thu; ViewData["data"] = data; ViewData["label"] = label; ViewData["soluong"] = soluong; ViewData["revenue"] = revenue; ViewData["view"] = count; ViewData["numSubCategory"] = count4; ViewData["numAccount"] = count3; ViewData["numProduct"] = count2; ViewData["numOfOrder"] = numOfOrder; ViewData["listProduct"] = listProduct; ViewData["listCategory"] = listCategory; ViewData["listSubCategory"] = listSubCategory; ViewData["listSubCategory"] = listSubCategory; ViewData["listStatusCategory"] = listStatusCategory; ViewData["listStatusSubCategory"] = listStatusSubCategory; return(View()); }
// GET: Manager public ActionResult ManagerAdmin() { Account account = (Account)Session["account"]; if (account != null) { List <Account> listAccounts = new AccountDao().getAll(); int check = 0; foreach (Account A in listAccounts) { if (A.userName.Equals(account.userName) && A.password.Equals(account.password) && account.roleId == 1) { check = 1; List <Product> listProduct = new ProductDao().getAll(); List <Category> listCategory = new CategoryDao().getAll(); List <SubCategory> listSubCategory = new SubCategoryDao().getAll(); List <StatusProduct> listStatusProduct = new StatusProductDao().getAll(); List <StatusCategory> listStatusCategory = new StatusCategoryDao().getAll(); List <StatusSubCategory> listStatusSubCategory = new StatusSubCategoryDao().getAll(); List <Order> listOrderWatting = new OrderDao().getOrderNotSuccesYetByCustomer(account.userName, 4); List <StatusAccount> listStatusAccount = new StatusAccountDao().getAll(); List <RoleAccount> listRoleAccount = new RoleAccountDao().getAll(); int numOfOrder = new OrderDao().countOrderWatting(); int count = new ViewDao().getView(); int count2 = new ProductDao().countProduct(); int count3 = new AccountDao().countAccount(); int count4 = new SubCategoryDao().countSubCategory(); string thu = ""; string data = ""; List <ThongkeOrder> listThongKe = new ThongKeOrderDao().getAll(); foreach (ThongkeOrder T in listThongKe) { thu += T.thu + ","; data += T.numOfOrder + ","; } thu = thu.Remove(thu.Length - 1); ViewData["thu"] = thu; ViewData["data"] = data; ViewData["view"] = count; ViewData["numSubCategory"] = count4; ViewData["numAccount"] = count3; ViewData["numProduct"] = count2; ViewData["numOfOrder"] = numOfOrder; ViewData["listOrderWatting"] = listOrderWatting; ViewData["listProduct"] = listProduct; ViewData["listCategory"] = listCategory; ViewData["listSubCategory"] = listSubCategory; ViewData["listStatusProduct"] = listStatusProduct; ViewData["listStatusCategory"] = listStatusCategory; ViewData["listStatusSubCategory"] = listStatusSubCategory; ViewData["listStatusAccount"] = listStatusAccount; ViewData["listRoleAccount"] = listRoleAccount; } } if (check == 0) { //response.sendRedirect("client/error.jsp"); } } else { //response.sendRedirect("login"); Response.Redirect("~/Login/Login"); } return(View()); }