Ejemplo n.º 1
0
 protected void treeList_NodeDeleting(object sender, ASPxDataDeletingEventArgs e)
 {
     if (ChecklistTemplateItems.CanDelete(decimal.Parse(e.Keys[0].ToString()), 0))
     {
         ChecklistTemplateItems.DeleteChecklistItemHard(decimal.Parse(e.Keys[0].ToString()));
         BindChecklistTree();
     }
     e.Cancel = true;
 }
Ejemplo n.º 2
0
        protected bool IsDeleteImageVisible(object obj)
        {
            TreeListDataCellTemplateContainer container = (TreeListDataCellTemplateContainer)obj;
            string nodekey = container.NodeKey.Replace("*", "");

            if (nodekey.Length > 0)
            {
                if (ChecklistTemplateItems.CanDelete(decimal.Parse(nodekey), 0))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        public bool CanDelete(string parm)
        {
            if (parm.StartsWith("*"))
            {
                parm = parm.Replace("*", "");
            }
            decimal ckey = 0;

            decimal.TryParse(parm, out ckey);
            if (ckey == 0)
            {
                return(false);
            }
            if (ChecklistTemplateItems.CanDelete(decimal.Parse(parm), 0))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        protected void treeList_CustomCallback(object sender, TreeListCustomCallbackEventArgs e)
        {
            string ckey = e.Argument;

            string[] arguments = e.Argument.Split('|');
            if (arguments[0] == "INSERT")
            {
                string vistext       = arguments[1];
                string type          = arguments[2];
                string required      = arguments[3];
                string notes         = arguments[4];
                string parent        = arguments[5];
                string condition     = arguments[6];
                string checklistckey = ddChecklists.SelectedValue;
                List <ChecklistTemplateVersion> versions = ChecklistTemplateVersion.GetChecklistTemplateVersions(decimal.Parse(checklistckey));
                decimal      templateversionckey         = versions[0].ChecklistTemplateVersionCKey;
                DropDownList Protocols       = (DropDownList)Master.FindControl("ContentPlaceHolder_Menu").FindControl("protocols");
                decimal      protocolversion = decimal.Parse(txtProtocolVersion.Text);
                int          sortorder       = 0;


                //current item is the parent of new item; sort order of new item is 1 larger than that of parent, so that it becomes the first child when ordered

                if (parent == "")
                {
                    sortorder = 9999999;  //large number so that it goes to the bottom
                }
                else
                {
                    sortorder = ChecklistTemplateItems.GetSortOrder(decimal.Parse(parent));
                }

                if (parent == "")
                {
                    ChecklistTemplateItems.AddChecklistItem(templateversionckey, protocolversion, null, vistext, null, null,
                                                            null, null, int.Parse(type), int.Parse(required), condition, false, false, false, false, sortorder + 1, notes);
                }
                else
                {
                    ChecklistTemplateItems.AddChecklistItem(templateversionckey, protocolversion, decimal.Parse(parent), vistext, null, null,
                                                            null, null, int.Parse(type), int.Parse(required), condition, false, false, false, false, sortorder + 1, notes);
                }
            }
            else if (arguments[0] == "RESTORE")
            {
                string retval = ChecklistTemplateItems.RestoreChecklistItem(decimal.Parse(arguments[1]));
            }
            else if (arguments[0] == "DELETE")
            {
                string key = arguments[1];
                if (ChecklistTemplateItems.CanDelete(decimal.Parse(key), 0))
                {
                    ChecklistTemplateItems.DeleteChecklistItemHard(decimal.Parse(key));
                }
            }
            else if (arguments[0] == "SETIMAGE")
            {
                TreeListNode node = treeList.FindNodeByKeyValue(arguments[1]);
            }

            LoadChecklists();
            BindChecklists();
            LoadChecklistItems();
            BindChecklistTree();
        }