Ejemplo n.º 1
0
        public static OrganizationDiaryDetails GetById(string id)
        {
            OrganizationDiaryDetails details = null;

            if (string.IsNullOrEmpty(id))
            {
                return(details);
            }
            using (pm2Entities entities = new pm2Entities())
            {
                return((from m in entities.Bud_OrgDiaryDetails
                        where m.OrgDiaryDetailsId == id
                        select new OrganizationDiaryDetails {
                    Id = m.OrgDiaryDetailsId, Code = m.OrgdetailsCode, Amount = m.Amount, Name = m.Name, CBSCode = m.CBSCode, Note = m.Note, InDiaryId = m.Bud_OrgDiaryCost.OrgDiaryId
                }).FirstOrDefault <OrganizationDiaryDetails>());
            }
        }
Ejemplo n.º 2
0
 public void Add(OrganizationDiaryDetails orgDetails)
 {
     if (orgDetails != null)
     {
         using (pm2Entities entities = new pm2Entities())
         {
             Bud_OrgDiaryCost cost = (from m in entities.Bud_OrgDiaryCost
                                      where m.OrgDiaryId == orgDetails.InDiaryId
                                      select m).FirstOrDefault <Bud_OrgDiaryCost>();
             Bud_OrgDiaryDetails details = new Bud_OrgDiaryDetails {
                 OrgDiaryDetailsId = orgDetails.Id,
                 OrgdetailsCode    = orgDetails.Code,
                 Name             = orgDetails.Name,
                 CBSCode          = orgDetails.CBSCode,
                 Bud_OrgDiaryCost = cost,
                 Amount           = orgDetails.Amount,
                 Note             = orgDetails.Note
             };
             entities.AddToBud_OrgDiaryDetails(details);
             entities.SaveChanges();
         }
     }
 }