Пример #1
0
        public static CostDiaryDetails GetById(string id)
        {
            CostDiaryDetails details = null;

            if (string.IsNullOrEmpty(id))
            {
                return(details);
            }
            using (pm2Entities entities = new pm2Entities())
            {
                return((from m in entities.Bud_IndirectDiaryDetails
                        where m.InDiaryDetailsId == id
                        select new CostDiaryDetails {
                    Id = m.InDiaryDetailsId, Amount = m.Amount, Name = m.Name, CBSCode = m.CBSCode, Note = m.Note, InDiaryId = m.Bud_IndirectDiaryCost.InDiaryId
                }).FirstOrDefault <CostDiaryDetails>());
            }
        }
Пример #2
0
 public void Update(CostDiaryDetails costDDetails)
 {
     if (costDDetails != null)
     {
         using (pm2Entities entities = new pm2Entities())
         {
             Bud_IndirectDiaryDetails details = (from m in entities.Bud_IndirectDiaryDetails
                                                 where m.InDiaryDetailsId == costDDetails.Id
                                                 select m).FirstOrDefault <Bud_IndirectDiaryDetails>();
             if (details == null)
             {
                 throw new Exception("找不到要修改的间接成本明细对象!!!");
             }
             details.Name    = costDDetails.Name;
             details.Note    = costDDetails.Note;
             details.Amount  = costDDetails.Amount;
             details.CBSCode = costDDetails.CBSCode;
             entities.SaveChanges();
         }
     }
 }
Пример #3
0
 public void Update(CostDiaryDetails orgDetails)
 {
     if (orgDetails != null)
     {
         using (pm2Entities entities = new pm2Entities())
         {
             Bud_OrgDiaryDetails details = (from m in entities.Bud_OrgDiaryDetails
                                            where m.OrgDiaryDetailsId == orgDetails.Id
                                            select m).FirstOrDefault <Bud_OrgDiaryDetails>();
             if (details == null)
             {
                 throw new Exception("找不到要修改的组织机构明细对象!");
             }
             details.Name           = orgDetails.Name;
             details.OrgdetailsCode = orgDetails.Code;
             details.Note           = orgDetails.Note;
             details.Amount         = orgDetails.Amount;
             details.CBSCode        = orgDetails.CBSCode;
             entities.SaveChanges();
         }
     }
 }
Пример #4
0
 public void Add(CostDiaryDetails costDDetails)
 {
     if (costDDetails != null)
     {
         using (pm2Entities entities = new pm2Entities())
         {
             Bud_IndirectDiaryCost cost = (from m in entities.Bud_IndirectDiaryCost
                                           where m.InDiaryId == costDDetails.InDiaryId
                                           select m).FirstOrDefault <Bud_IndirectDiaryCost>();
             Bud_IndirectDiaryDetails details = new Bud_IndirectDiaryDetails {
                 InDiaryDetailsId      = costDDetails.Id,
                 IndetailsCode         = costDDetails.Code,
                 Name                  = costDDetails.Name,
                 CBSCode               = costDDetails.CBSCode,
                 Bud_IndirectDiaryCost = cost,
                 Amount                = costDDetails.Amount,
                 Note                  = costDDetails.Note
             };
             entities.AddToBud_IndirectDiaryDetails(details);
             entities.SaveChanges();
         }
     }
 }