Exemple #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);
            }
        }
Exemple #2
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);
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(DigiPower.Onlinecol.Standard.Model.T_WorkFlow_MDL model)
 {
     dal.Update(model);
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(DigiPower.Onlinecol.Standard.Model.T_WorkFlow_MDL model)
 {
     return(dal.Add(model));
 }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <DigiPower.Onlinecol.Standard.Model.T_WorkFlow_MDL> DataTableToList(DataTable dt)
        {
            List <DigiPower.Onlinecol.Standard.Model.T_WorkFlow_MDL> modelList = new List <DigiPower.Onlinecol.Standard.Model.T_WorkFlow_MDL>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                DigiPower.Onlinecol.Standard.Model.T_WorkFlow_MDL model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DigiPower.Onlinecol.Standard.Model.T_WorkFlow_MDL();
                    if (dt.Rows[n]["WorkFlowID"].ToString() != "")
                    {
                        model.WorkFlowID = int.Parse(dt.Rows[n]["WorkFlowID"].ToString());
                    }
                    model.WorkFlowCode = dt.Rows[n]["WorkFlowCode"].ToString();
                    model.WorkFlowName = dt.Rows[n]["WorkFlowName"].ToString();
                    if (dt.Rows[n]["OrderIndex"].ToString() != "")
                    {
                        model.OrderIndex = int.Parse(dt.Rows[n]["OrderIndex"].ToString());
                    }
                    if (dt.Rows[n]["Del"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Del"].ToString() == "1") || (dt.Rows[n]["Del"].ToString().ToLower() == "true"))
                        {
                            model.Del = true;
                        }
                        else
                        {
                            model.Del = false;
                        }
                    }
                    if (dt.Rows[n]["PID"].ToString() != "")
                    {
                        model.PID = int.Parse(dt.Rows[n]["PID"].ToString());
                    }
                    if (dt.Rows[n]["RoleID"].ToString() != "")
                    {
                        model.RoleID = int.Parse(dt.Rows[n]["RoleID"].ToString());
                    }
                    if (dt.Rows[n]["UserID"].ToString() != "")
                    {
                        model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString());
                    }
                    if (dt.Rows[n]["UseForSuperAdmin"].ToString() != "")
                    {
                        if ((dt.Rows[n]["UseForSuperAdmin"].ToString() == "1") || (dt.Rows[n]["UseForSuperAdmin"].ToString().ToLower() == "true"))
                        {
                            model.UseForSuperAdmin = true;
                        }
                        else
                        {
                            model.UseForSuperAdmin = false;
                        }
                    }
                    if (dt.Rows[n]["UseForArchive"].ToString() != "")
                    {
                        if ((dt.Rows[n]["UseForArchive"].ToString() == "1") || (dt.Rows[n]["UseForArchive"].ToString().ToLower() == "true"))
                        {
                            model.UseForArchive = true;
                        }
                        else
                        {
                            model.UseForArchive = false;
                        }
                    }
                    if (dt.Rows[n]["UseForCompanyLeader"].ToString() != "")
                    {
                        if ((dt.Rows[n]["UseForCompanyLeader"].ToString() == "1") || (dt.Rows[n]["UseForCompanyLeader"].ToString().ToLower() == "true"))
                        {
                            model.UseForCompanyLeader = true;
                        }
                        else
                        {
                            model.UseForCompanyLeader = false;
                        }
                    }
                    if (dt.Rows[n]["UseForCompany"].ToString() != "")
                    {
                        if ((dt.Rows[n]["UseForCompany"].ToString() == "1") || (dt.Rows[n]["UseForCompany"].ToString().ToLower() == "true"))
                        {
                            model.UseForCompany = true;
                        }
                        else
                        {
                            model.UseForCompany = false;
                        }
                    }
                    if (dt.Rows[n]["UseForAll"].ToString() != "")
                    {
                        if ((dt.Rows[n]["UseForAll"].ToString() == "1") || (dt.Rows[n]["UseForAll"].ToString().ToLower() == "true"))
                        {
                            model.UseForAll = true;
                        }
                        else
                        {
                            model.UseForAll = false;
                        }
                    }
                    model.SubmitURL   = dt.Rows[n]["SubmitURL"].ToString();
                    model.DoResultURL = dt.Rows[n]["DoResultURL"].ToString();

                    if (dt.Rows[n]["CompanyID"].ToString() != "")
                    {
                        model.CompanyID = int.Parse(dt.Rows[n]["CompanyID"].ToString());
                    }
                    model.DescriptionToArchive = dt.Rows[n]["DescriptionToArchive"].ToString();
                    model.DescriptionToCompany = dt.Rows[n]["DescriptionToCompany"].ToString();
                    model.RightListID          = dt.Rows[n]["RightListID"].ToString();

                    modelList.Add(model);
                }
            }
            return(modelList);
        }