Beispiel #1
0
 public static bool insertTask(t_GZL_TaskList task)
 {
     using (DataClassesEduDataContext dc = new DataClassesEduDataContext())
     {
         dc.t_GZL_TaskList.InsertOnSubmit(task);
         dc.SubmitChanges();
         return true;
     }
 }
Beispiel #2
0
        protected void btAdd_Click(object sender, EventArgs e)
        {
            try
            {

                t_GZL_Item item = new t_GZL_Item();
                item.ApplyDate = DateTime.Now;
                item.ApplyUserId = (int)Session["userid"];
                item.deptId = Convert.ToInt32(ddlDept.SelectedValue);
                item.ItemName = tbItemName.Text;
                item.ItemType = "采购单";
                item.RoutId = 1;
                item.State = "待发布";
                Guid guid = Guid.NewGuid();
                item.itemGuid = guid;
                BLL.Application.GZL.GzlManagement.createItem(item);

                t_GZL_TaskList task = new t_GZL_TaskList();
                t_GZL_Actor actor = BLL.Application.GZL.Setting.ActorManagement.getActorForNextSortByRoutId(1, 0);
                if (actor != null)
                    task.actorId = actor.actorId;
                task.itemGuid = guid;
                task.state = "待检出";
                task.version = 1;
                BLL.Application.GZL.GzlManagement.insertTask(task);

                t_GZL_actorUser au = new t_GZL_actorUser();

                au.actorId = actor.actorId;
                au.itemGuid = guid;
                au.operateUserId = (int)Session["userid"];
                BLL.Application.GZL.GzlManagement.insertActorUser(au);

                t_GZL_TaskHistory history = new t_GZL_TaskHistory();
                history.actorId = actor.actorId;
                history.createDate = System.DateTime.Now;
                history.itemGuid = guid;
                history.operatorName = Session["username"].ToString();
                history.action = "创建";
                BLL.Application.GZL.GzlManagement.insertTaskHistory(history);

                lbMessage.Text = "添加成功";
                databind();
            }
            catch (Exception ex)
            {
                lbMessage.Text = "添加失败:" + ex.Message;
            }
        }