Esempio n. 1
0
        private void dgDocType_Delete(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int cid = int.Parse(e.CommandArgument.ToString());

            ContentType.Delete(cid);
            BindDataGrid();
        }
 public void CreateContentTypebyGuid()
 {
     if (!ContextSharePoint.VerifyServer(Site))
     {
         Assert.Inconclusive();
     }
     ContentType = new ContentType(Site.RootWeb, Logger, "Nuevo tipo Contenido", "TEst", "Elemento");
     Assert.IsTrue(ContentType.Create("0x0100B84152A0E015D14CA1300027B66FAD1F"));
     Assert.IsTrue(ContentType.Delete());
 }
 public void CreateContentType()
 {
     if (!ContextSharePoint.VerifyServer(Site))
     {
         Assert.Inconclusive();
     }
     ContentType = new ContentType(Site.RootWeb, Logger, "Nuevo Tipo Contenido1", "TEST", "Item");
     Assert.IsTrue(ContentType.Create(string.Empty));
     Assert.IsTrue(ContentType.Delete());
 }
Esempio n. 4
0
        protected void btnMultipleDelete_Click(object sender, EventArgs e)
        {
            string[] IDs = hdnFldSelectedValues.Value.Trim().Split('|');

            //Code for deleting items
            foreach (string Item in IDs)
            {
                int id = int.Parse(Item.ToString());
                int i  = content_types_obj.Delete(id);
            }
            FillDataInGrid();
        }
Esempio n. 5
0
        public string DelContentType(string id)
        {
            string errorMsg = string.Empty;

            try
            {
                if (!HttpContext.Current.User.IsInRole("Administrators"))
                {
                    return(MC.Role_InvalidError);
                }

                if (string.IsNullOrWhiteSpace(id))
                {
                    return(MC.Submit_InvalidRow);
                }
                Guid gId = Guid.Empty;
                Guid.TryParse(id, out gId);
                if (gId.Equals(Guid.Empty))
                {
                    return(MC.GetString(MC.Submit_Params_GetInvalidRegex, "对应标识值"));
                }

                ContentType bll   = new ContentType();
                var         model = bll.GetModel(gId);
                if (model.TypeCode == TygaSoft.SysHelper.EnumData.MenuRoot.ShareMenu.ToString())
                {
                    return("该节点为系统预设值,不能删除!");
                }

                using (TransactionScope scope = new TransactionScope())
                {
                    bll.Delete(gId);

                    if (model != null)
                    {
                        bll.UpdateHasChild(model.ParentId);
                    }

                    scope.Complete();
                }
                return("1");
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
            }

            return(MC.GetString(MC.Submit_Ex_Error, errorMsg));
        }
Esempio n. 6
0
        public string DelContentType(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(MessageContent.Submit_InvalidRow);
            }
            Guid gId = Guid.Empty;

            Guid.TryParse(id, out gId);
            if (gId.Equals(Guid.Empty))
            {
                return(MessageContent.GetString(MessageContent.Submit_Params_GetInvalidRegex, "对应标识值"));
            }
            ContentType bll = new ContentType();

            bll.Delete(gId);
            return("1");
        }
Esempio n. 7
0
        public string DelContentType(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return("操作失败,原因:请选择要删除的数据");
            }
            Guid gId = Guid.Empty;

            Guid.TryParse(id, out gId);
            if (gId.Equals(Guid.Empty))
            {
                return("操作失败,原因:获取对应标识值不正确,请检查");
            }
            ContentType bll = new ContentType();

            bll.Delete(gId);
            return("1");
        }
        public static void RemoveContentTypes()
        {
            //-- T1 torli a tobbit is
            var nodeTypeName = "T1";
            var nodeType     = ActiveSchema.NodeTypes[nodeTypeName];

            if (nodeType != null)
            {
                NodeQuery query = new NodeQuery();
                query.Add(new TypeExpression(nodeType));
                foreach (var nodeId in query.Execute().Identifiers)
                {
                    Node.ForceDelete(nodeId);
                }
            }
            ContentType ct = ContentType.GetByName(nodeType.Name);

            if (ct != null)
            {
                ct.Delete();
            }
        }
Esempio n. 9
0
        public ResResultModel DeleteContentType(string appCode, Guid Id)
        {
            try
            {
                if (Id.Equals(Guid.Empty))
                {
                    return(ResResult.Response(false, MC.Request_Params_InvalidError, null));
                }

                var bll = new ContentType();
                if (bll.IsExistChild(Id))
                {
                    return(ResResult.Response(false, MC.M_DeleteTreeNodeError, null));
                }

                MenusDataProxy.ValidateAccess((int)EnumData.OperationAccess.除, true);
                return(ResResult.Response(bll.Delete(appCode, Id) > 0, "", null));
            }
            catch (Exception ex)
            {
                return(ResResult.Response(false, "操作异常:" + ex.Message + "", null));
            }
        }
Esempio n. 10
0
 public static void RemoveContentType(ContentType contentType)
 {
     contentType.Delete();
     // The ContentTypeManager distributes its reset, no custom DistributedAction call needed
     ContentTypeManager.Reset();
 }