コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(DigiPower.Onlinecol.Standard.Model.T_WorkFlow_MDL model)
        {
            BLL.T_WorkFlow_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_WorkFlow_BLL();

            Model.T_WorkFlow_MDL currentMDL = bll.GetModel(model.WorkFlowID);
            //原 父 ,可空
            Model.T_WorkFlow_MDL oldParentMDL = bll.GetModel("WorkFlowID=" + currentMDL.PID);
            //原 子 ,可空
            Model.T_WorkFlow_MDL oldChildMDL = bll.GetModel("PID=" + currentMDL.WorkFlowID);

            //新 父 ,可空
            Model.T_WorkFlow_MDL newParentMDL = bll.GetModel("WorkFlowID=" + model.PID);
            //新 子 ,新父的子,可空
            Model.T_WorkFlow_MDL newChildMDL = null;
            if (newParentMDL != null)
            {
                newChildMDL = bll.GetModel("PID=" + newParentMDL.WorkFlowID);
            }
            else if (model.PID == 0)
            {
                newChildMDL = bll.GetModel("PID=" + model.PID);
            }

            bll.Update(model);       //更新填的结果

            if (oldChildMDL != null) // && newChildMDL.WorkFlowID > 0
            {
                if (oldParentMDL != null)
                {
                    oldChildMDL.PID = oldParentMDL.WorkFlowID;
                }
                else
                {
                    oldChildMDL.PID = 0;
                }
                bll.Update(oldChildMDL);
            }
            if (newChildMDL != null)// && newChildMDL.WorkFlowID > 0
            {
                newChildMDL.PID = model.WorkFlowID;
                bll.Update(newChildMDL);
            }
        }
コード例 #2
0
 public void Delete(int WorkFlowID)
 {
     BLL.T_WorkFlow_BLL   bll        = new DigiPower.Onlinecol.Standard.BLL.T_WorkFlow_BLL();
     Model.T_WorkFlow_MDL currentMDL = bll.GetModel(WorkFlowID);
     //原 父
     Model.T_WorkFlow_MDL oldParentMDL = bll.GetModel("WorkFlowID=" + currentMDL.PID);
     //原 子
     Model.T_WorkFlow_MDL oldChildMDL = bll.GetModel("PID=" + currentMDL.WorkFlowID);
     if (oldChildMDL != null && oldParentMDL != null)
     {
         oldChildMDL.PID = oldParentMDL.WorkFlowID;
         bll.Update(oldChildMDL);
     }
     else if (oldChildMDL != null)
     {
         oldChildMDL.PID = 0;
         bll.Update(oldChildMDL);
     }
     bll.Delete(WorkFlowID);
 }
コード例 #3
0
        public int Add(DigiPower.Onlinecol.Standard.Model.T_WorkFlow_MDL model)
        {
            int WorkFlowID = 0;

            BLL.T_WorkFlow_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_WorkFlow_BLL();
            if (model.PID == 0)
            {
                Model.T_WorkFlow_MDL newChildMDL = bll.GetModel("PID=" + model.PID);
                WorkFlowID = bll.Add(model);

                newChildMDL.PID = WorkFlowID;
                bll.Update(newChildMDL);
            }
            else
            {
                //新 父
                Model.T_WorkFlow_MDL newParentMDL = bll.GetModel("WorkFlowID=" + model.PID);
                //新 子
                Model.T_WorkFlow_MDL newChildMDL = bll.GetModel("PID=" + newParentMDL.WorkFlowID);

                WorkFlowID = bll.Add(model);//更新填的结果

                //更新父子关系
                Model.T_WorkFlow_MDL parentMDL = bll.GetModel("WorkFlowID=" + model.PID);
                if (newParentMDL != null)
                {
                    if (newChildMDL != null)
                    {
                        newChildMDL.PID = WorkFlowID;
                        bll.Update(newChildMDL);
                    }
                }
                WorkFlowID = model.WorkFlowID;
            }
            return(WorkFlowID);
        }