public long InsertInfo(CompanyInfo info)
        {
            OrganizationInfo organinfo = new OrganizationInfo();

            organinfo.Fid = Guid.NewGuid();
            ///把前台传来的父节点FID赋予ORGANIZATION对象上
            organinfo.ParentFid  = info.ParentOid;
            organinfo.Code       = info.CCode;
            organinfo.Name       = info.CName;
            organinfo.ValidFlag  = true;
            organinfo.CreateDate = DateTime.Now;
            organinfo.CreateUser = info.CreateUser;
            info.ValidFlag       = true;
            ////再把ORGANIZATION对象与COMPANY对象以OID做关联
            info.Oid = organinfo.Fid;
            using (var trans = new TransactionScope())
            {
                if (new OrganizationDAL().Add(organinfo) == 0)
                {
                    throw new Exception("ORGANIZATION ADD FAIL");
                }
                info.Id = dal.Add(info);
                if (info.Id == 0)
                {
                    throw new Exception("COMPANY ADD FAIL");
                }
                trans.Complete();
            }
            return(info.Id);
        }
예제 #2
0
        public IHttpActionResult Post(Company model)
        {
            AjaxStringResult result = new AjaxStringResult();

            model.CreateTime = DateTime.Now;
            _CompanyDAL.Add(model);

            result.data = "保存成功";
            return(Json(result));
        }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(BWJS.Model.Company model)
 {
     return(dal.Add(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Company model)
 {
     return(_dal.Add(model));
 }