Esempio n. 1
0
        public static OrganizationDiary GetById(string id)
        {
            OrganizationDiary diary = null;

            if (string.IsNullOrEmpty(id))
            {
                return(diary);
            }
            using (pm2Entities entities = new pm2Entities())
            {
                return((from m in entities.Bud_OrgDiaryCost
                        where m.OrgDiaryId == id
                        select new OrganizationDiary {
                    Id = m.OrgDiaryId, Code = m.OrgdiaryCode, Department = m.Department, Name = m.Name, IssuedBy = m.IssuedBy, FlowState = m.FlowState, InputDate = m.InputDate, InputUser = m.InputUser
                }).FirstOrDefault <OrganizationDiary>());
            }
        }
Esempio n. 2
0
 public void Update(OrganizationDiary orgDiary)
 {
     if (orgDiary != null)
     {
         using (pm2Entities entities = new pm2Entities())
         {
             Bud_OrgDiaryCost cost = (from m in entities.Bud_OrgDiaryCost
                                      where m.OrgDiaryId == orgDiary.Id
                                      select m).FirstOrDefault <Bud_OrgDiaryCost>();
             if (cost == null)
             {
                 throw new Exception("找不到要修改的组织机构日记对象!");
             }
             cost.Name         = orgDiary.Name;
             cost.Department   = orgDiary.Department;
             cost.OrgdiaryCode = orgDiary.Code;
             cost.IssuedBy     = orgDiary.IssuedBy;
             cost.InputDate    = orgDiary.InputDate;
             cost.InputUser    = orgDiary.InputUser;
             entities.SaveChanges();
         }
     }
 }
Esempio n. 3
0
 public void Add(OrganizationDiary orgDiary)
 {
     if (orgDiary != null)
     {
         using (pm2Entities entities = new pm2Entities())
         {
             int num = Convert.ToInt32(orgDiary.PrjId);
             Bud_OrgDiaryCost cost = new Bud_OrgDiaryCost {
                 OrgDiaryId   = orgDiary.Id,
                 Name         = orgDiary.Name,
                 OrgdiaryCode = orgDiary.Code,
                 OrgId        = new int?(num),
                 Department   = orgDiary.Department,
                 IssuedBy     = orgDiary.IssuedBy,
                 InputUser    = orgDiary.InputUser,
                 InputDate    = orgDiary.InputDate,
                 FlowState    = orgDiary.FlowState
             };
             entities.AddToBud_OrgDiaryCost(cost);
             entities.SaveChanges();
         }
     }
 }