Ejemplo n.º 1
0
        protected void grdResource_NodeUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            AppComponent re = session.GetObjectByKey <AppComponent>(Guid.Parse(grdResource.FocusedNode[grdResource.KeyFieldName].ToString()));

            //AppComponent re = session.GetObjectByKey<AppComponent>(Guid.Parse(e.OldValues["AppComponentId"].ToString()));

            re.Code        = e.NewValues["Code"].ToString();
            re.Name        = e.NewValues["Name"].ToString();
            re.Description = e.NewValues["Description"] as string;

            if (e.NewValues["RowStatus"].ToString().Equals("Sử dụng") || e.NewValues["RowStatus"].ToString().Equals("1"))
            {
                re.RowStatus = Constant.ROWSTATUS_ACTIVE;
            }
            else
            {
                re.RowStatus = Constant.ROWSTATUS_INACTIVE;
            }

            re.Save();

            e.Cancel = true;
            grdResource.CancelEdit();

            grdResource.JSProperties.Add("cpRefresh", "true");
        }
Ejemplo n.º 2
0
        protected void grdResource_NodeInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            AppComponent re = new AppComponent(session);

            re.Code                 = e.NewValues["Code"].ToString();
            re.Name                 = e.NewValues["Name"].ToString();
            re.Description          = e.NewValues["Description"] as string;
            re.RowCreationTimeStamp = DateTime.Now;
            re.RowStatus            = Constant.ROWSTATUS_ACTIVE;

            App aa = session.GetObjectByKey <App>(Guid.Parse(hdId.Get("id").ToString()));

            if (aa == null)
            {
                throw new Exception("Ứng dụng đã bị xóa hoặc không tồn tại !");
            }
            re.AppId = aa;

            if (e.NewValues[grdResource.ParentFieldName] != null)
            {
                re.ParentAppComponentId = session.GetObjectByKey <AppComponent>(Guid.Parse(e.NewValues[grdResource.ParentFieldName].ToString()));
            }

            re.Save();

            e.Cancel = true;
            grdResource.CancelEdit();
        }
Ejemplo n.º 3
0
        private void ResetNodes(TreeListNode node)
        {
            ASPxCheckBox chk1 = grdSitemap.FindDataCellTemplateControl(node.Key, null, "chkSelect") as ASPxCheckBox;

            chk1.Checked = false;

            UnitOfWork uow = XpoHelper.GetNewUnitOfWork();
            //CriteriaOperator filter = new OperandProperty("ResourceId") == new OperandValue(Guid.Parse(node.GetValue("ResourceId").ToString()));

            CriteriaOperator filter = CriteriaOperator.Parse("AppComponentId='" + node.GetValue("AppComponentId").ToString() + "' And AppId='" + hdId.Get("id").ToString() + "'");

            XPCollection <AppComponent> colDelete = new XPCollection <AppComponent>(uow, filter);

            if (colDelete.Count > 0)
            {
                AppComponent obj = uow.GetObjectByKey <AppComponent>(Guid.Parse(node.GetValue("AppComponentId").ToString()));
                chk1.Checked = false;
            }

            if (node.HasChildren)
            {
                if (node.Expanded)
                {
                    for (int i = 0; i < node.ChildNodes.Count; i++)
                    {
                        ResetNodes(node.ChildNodes[i]);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public AppButton(int x, int y, String name, AppComponent owner)
 {
     base.Location  = new Point(x, y);
     base.Text      = name;
     base.BackColor = Color.White;
     Show();
     owner.AddControl(this);
 }
Ejemplo n.º 5
0
        public void AddProjectComponent(string key, AppComponent appComp)
        {
            if (appComp is IProtectedComponent)
            {
                throw new InvalidOperationException("Cannot add Protected Components to the project!");
            }

            _components.Add(key, appComp);
        }
Ejemplo n.º 6
0
        private void AddProtectedComponent(string key, AppComponent appComp)
        {
            if (_components.ContainsKey(key))
            {
                throw new ArgumentException("Multiple Protected Components Exists! Only 1 Instance of the same Protected Component is allowed!");
            }

            _components.Add(key, appComp);
        }
Ejemplo n.º 7
0
        protected void grdResource_NodeDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            AppComponent re = session.GetObjectByKey <AppComponent>(Guid.Parse(grdResource.FocusedNode[grdResource.KeyFieldName].ToString()));

            re.RowStatus = Constant.ROWSTATUS_DELETED;
            re.Save();

            e.Cancel = true;
            grdResource.DataBind();
        }
        public AppsResult UpsertAppComponent([FromBody] AppComponent appComponent)
        {
            var result = new AppsResult();

            try
            {
                var objs = _db.GetCollection <AppComponent>("AppComponents");
                objs.Upsert(appComponent);

                result.Success = true;
            }
            catch (System.Exception ex)
            {
                new AppFlows.Plan.Apps.AppComponents.Exception(ex, ref result);
            }

            return(result);
        }
Ejemplo n.º 9
0
        protected void grdResource_NodeInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            AppComponent re = new AppComponent(session);

            re.Code                 = e.NewValues["Code"].ToString();
            re.Name                 = e.NewValues["Name"].ToString();
            re.Description          = e.NewValues["Description"].ToString();
            re.RowCreationTimeStamp = DateTime.Now;
            re.RowStatus            = Constant.ROWSTATUS_ACTIVE;

            if (e.NewValues[grdResource.ParentFieldName] != null)
            {
                re.ParentAppComponentId = session.GetObjectByKey <AppComponent>(Guid.Parse(e.NewValues[grdResource.ParentFieldName].ToString()));
            }

            re.Save();

            e.Cancel = true;
            grdResource.CancelEdit();
        }
Ejemplo n.º 10
0
 public void addOwner(AppComponent owner)
 {
     owner.AddControl(this);
 }
Ejemplo n.º 11
0
        internal static int Update(AppComponent info)
        {
            string sql = "update AppComponent set ComponentId=@ComponentId,ComponentServiceCompeleteName=@ComponentServiceCompeleteName,ComponentServiceName=@ComponentServiceName,ComponentAssemblyName=@ComponentAssemblyName,ComponentAssemblyFileName=@ComponentAssemblyFileName,ComponentAssemblyFileStorePath=@ComponentAssemblyFileStorePath,AssemblyVersion=@AssemblyVersion where AppComponentId=@AppComponentId";

            return(Update <AppComponent>(con, sql, info));
        }
Ejemplo n.º 12
0
        internal static int Add(AppComponent info)
        {
            string sql = "insert into AppComponent(ComponentId,ComponentServiceCompeleteName,ComponentServiceName,ComponentAssemblyName,ComponentAssemblyFileName,ComponentAssemblyFileStorePath,AssemblyVersion) values(@ComponentId,@ComponentServiceCompeleteName,@ComponentServiceName,@ComponentAssemblyName,@ComponentAssemblyFileName,@ComponentAssemblyFileStorePath,@AssemblyVersion);select @@IDENTITY;";

            return(InsertWithReturnID <AppComponent, int>(con, sql, info));
        }
Ejemplo n.º 13
0
    protected void setupActivityComponent(AppComponent appComponent) {

    }
Ejemplo n.º 14
0
        public override void OnCreate()
        {
            base.OnCreate();

            appComponent = new AppComponent(this);
        }
Ejemplo n.º 15
0
        protected void cpLine_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            String[] p = e.Parameter.Split('|');

            UnitOfWork uow = XpoHelper.GetNewUnitOfWork();

            switch (p[0])
            {
            case "checkchange":

                //AppComponent obj = session.GetObjectByKey<AppComponent>(Guid.Parse(p[1]));


                CriteriaOperator filter = CriteriaOperator.Parse("AppComponentId='" + Guid.Parse(p[1].ToString()) + "' And AppId='" + Guid.Parse(hdId.Get("id").ToString()) + "'");
                AppComponent     obj    = uow.FindObject <AppComponent>(filter);

                //obj.Permitted = Convert.ToBoolean(p[2]);

                if (Convert.ToBoolean(p[2]))
                {
                    lst.Add(obj);

                    TreeListNode node = grdSitemap.FindNodeByFieldValue("AppComponentId", obj.AppComponentId);

                    if (node.HasChildren)
                    {
                        for (int i = 0; i < node.ChildNodes.Count; i++)
                        {
                            ASPxCheckBox chk1 = grdSitemap.FindDataCellTemplateControl(node.ChildNodes[i].Key, null, "chkSelect") as ASPxCheckBox;

                            if (!chk1.Checked)
                            {
                                var itemd = lst.FirstOrDefault(x => x.AppComponentId == Guid.Parse(node.ChildNodes[i].GetValue("ResourceId").ToString()));
                                if (itemd == null)
                                {
                                    filter = CriteriaOperator.Parse("AppComponentId='" + p[0].ToString() + "' And AppId='" + hdId.Get("id").ToString() + "'");
                                    obj    = uow.FindObject <AppComponent>(filter);

                                    //obj = session.GetObjectByKey<ViewResourceApplication>(Guid.Parse(node.ChildNodes[i].GetValue("ResourceId").ToString()));

                                    lst.Add(obj);
                                }

                                chk1.Checked = true;
                            }
                        }
                    }
                }
                else
                {
                    var item = lst.First(x => x.AppComponentId == obj.AppComponentId);
                    lst.Remove(item);

                    TreeListNode node = grdSitemap.FindNodeByFieldValue("AppComponentId", obj.AppComponentId);

                    if (node.HasChildren)
                    {
                        for (int i = 0; i < node.ChildNodes.Count; i++)
                        {
                            ASPxCheckBox chk1 = grdSitemap.FindDataCellTemplateControl(node.ChildNodes[i].Key, null, "chkSelect") as ASPxCheckBox;

                            if (chk1.Checked)
                            {
                                var itemd = lst.First(x => x.AppComponentId == Guid.Parse(node.ChildNodes[i].GetValue("AppComponentId").ToString()));
                                lst.Remove(itemd);

                                chk1.Checked = false;
                            }
                        }
                    }
                }


                break;

            case "show":
                lst.Clear();

                session             = XpoHelper.GetNewSession();
                ResourceXDS.Session = session;

                //filter = new OperandProperty("AppId") == new OperandValue(Guid.Parse(hdId.Get("id").ToString()));
                //ResourceXDS.Criteria = filter.ToString();

                grdSitemap.DataBind();

                for (int i = 0; i < grdSitemap.Nodes.Count; i++)
                {
                    ResetNodes(grdSitemap.Nodes[i]);
                }

                for (int i = 0; i < grdSitemap.Nodes.Count; i++)
                {
                    ProcessNodes(grdSitemap.Nodes[i]);
                }


                break;

            default:
                break;
            }
        }
 protected static RenderFragment Create(AppComponent appComponent) => builder => builder.OpenComponent(0, appComponent.GetType());