예제 #1
0
 public IActionResult Edit(vmBranchHead modelData)
 {
     //var headObj = db.BranchHead.Get(modelData.Id);
     if (ModelState.IsValid)
     {
         BranchHead head = db.BranchHead.GetFirstOrDefault(c => c.Id == modelData.Id);
         head.CompanyId       = modelData.CompanyId;
         head.EmployeeId      = modelData.EmployeeId;
         head.BranchId        = modelData.BranchId;
         head.DivisionId      = modelData.DivisionId;
         head.SisterConcernId = modelData.SisterConcernId;
         db.BranchHead.Update(head);
         db.Save();
         if (head.Id > 0)
         {
             return(Json(true));
         }
     }
     return(Json(false));
 }
예제 #2
0
        public IActionResult Create(vmBranchHead vmBranchHead)
        {
            if (!ModelState.IsValid)
            {
                BranchHead branchHead = new BranchHead()
                {
                    CompanyId       = vmBranchHead.CompanyId,
                    SisterConcernId = vmBranchHead.SisterConcernId,
                    EmployeeId      = vmBranchHead.EmployeeId,
                    BranchId        = vmBranchHead.BranchId,
                    DivisionId      = vmBranchHead.DivisionId
                };
                db.BranchHead.Add(branchHead);
                db.Save();
                ModelState.Clear();

                if (branchHead.Id > 0)
                {
                    return(Json(true));
                }
            }
            return(Json(false));
        }
예제 #3
0
        public async Task <Branch> SaveHead(Branch[] values, Guid?branchParentId, Guid userId)
        {
            var item = await Get(branchParentId);

            if (item != null)
            {
                foreach (var itemHead in values)
                {
                    var itemExistD = this.appContext.BranchHead.FirstOrDefault(
                        p => p.BranchParentId == branchParentId &&
                        p.BranchId == itemHead.BranchId);

                    if (itemExistD != null)
                    {
                        itemExistD.IsDeleted = !itemHead.IsExist;
                    }
                    else
                    {
                        itemExistD = new BranchHead
                        {
                            BranchHeadId   = Guid.NewGuid(),
                            BranchId       = itemHead.BranchId,
                            BranchParentId = branchParentId,
                            CreatedBy      = userId,
                            CreatedDate    = DateTime.Now,
                            UpdatedBy      = userId,
                            UpdatedDate    = DateTime.Now,
                            IsDeleted      = !itemHead.IsExist
                        };
                        await appContext.BranchHead.AddAsync(itemExistD);
                    }

                    await appContext.SaveChangesAsync();
                }
            }
            return(item);
        }
예제 #4
0
 private HgBranch ConvertToBranch(BranchHead branch, string activeBranchId)
 {
     string id = GetChangeSet(branch.RevisionNumber).Id;
     return new HgBranch(id, branch.Name, String.Equals(id, activeBranchId, StringComparison.OrdinalIgnoreCase));
 }
예제 #5
0
파일: HgRepository.cs 프로젝트: DinoV/kudu
        private HgBranch ConvertToBranch(BranchHead branch, string activeBranchId)
        {
            string id = GetChangeSet(branch.RevisionNumber).Id;

            return(new HgBranch(id, branch.Name, String.Equals(id, activeBranchId, StringComparison.OrdinalIgnoreCase)));
        }