Esempio n. 1
0
        public static int Insert(F_FLOW entity)
        {
            using (MainDataContext dbContext = new MainDataContext())
            {
                var list = from a in dbContext.F_FLOW select a.ID;

                long total = list.LongCount();

                if (total == 0)
                {
                    entity.ID = 1;
                }
                else
                {
                    entity.ID = dbContext.F_FLOW.Max(a => a.ID) + 1;
                }


                dbContext.F_FLOW.InsertOnSubmit(entity);

                dbContext.SubmitChanges();

                return(entity.ID);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 修改的保存
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool Save(F_FLOW entity)
 {
     if (entity.ID == 0)
     {
         entity.ID = DAL.WorkFlow.Flow.Insert(entity);
     }
     return(DAL.WorkFlow.Flow.Save(entity));
 }
Esempio n. 3
0
        public FlowDefine(int flowId)
        {
            m_FlowId = flowId;

            F_FLOW flow = DAL.WorkFlow.Flow.Get(flowId);

            m_FlowName = flow.Name;

            m_IsInner = flow.IsInner.ToUpper() == "Y"? true:false;

            m_Url = flow.Url;
        }
Esempio n. 4
0
        public static bool Save(F_FLOW entity)
        {
            using (MainDataContext dbContext = new MainDataContext())
            {
                var model = dbContext.F_FLOW.FirstOrDefault(t => t.ID == entity.ID);

                model.Name        = entity.Name;
                model.Description = entity.Description;
                model.CatalogID   = entity.CatalogID;
                //model.CreateDate = entity.CreateDate;
                model.ModifyDate = entity.ModifyDate;
                model.LayoutType = entity.LayoutType;
                model.Url        = entity.Url;
                model.IsInner    = entity.IsInner;

                dbContext.SubmitChanges();
            }

            return(true);
        }
Esempio n. 5
0
        public ActionResult FlowSave(F_FLOW entity)
        {
            Flow flow = new Flow();

            entity.IsInner    = Request.Form["isInner"];
            entity.LayoutType = int.Parse(Request.Form["layoutType"]);

            if (ModelState.IsValid)
            {
                bool save;

                try
                {
                    if (entity.ID == 0)
                    {
                        entity.CreateDate = DateTime.Now;
                        save = flow.Insert(entity);
                    }
                    else
                    {
                        entity.ModifyDate = DateTime.Now;
                        save = flow.Save(entity);
                    }
                }
                catch (Exception)
                {
                    save = false;
                }

                if (save)
                {
                    return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { IsSuccess = false, Message = "保存失败" }, "text/html", JsonRequestBehavior.AllowGet));
                }
            }

            return(View());
        }
Esempio n. 6
0
 /// <summary>
 /// 新增的保存
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool Insert(F_FLOW entity)
 {
     DAL.WorkFlow.Flow.Insert(entity);
     return(true);
 }