Пример #1
0
 /// <summary>
 /// 添加新公司
 /// </summary>
 /// <param name="company"></param>
 /// <returns></returns>
 public int addCompany(ABiCompany company)
 {
     VPDAL.ABi_Company obj = new VPDAL.ABi_Company();
     obj.CompanyName = company.CompanyName;
     obj.CompanyCode = company.CompanyCode;
     dbContext.ABi_Company.AddObject(obj);
     return dbContext.SaveChanges();
 }
Пример #2
0
        public static ABiCompany FromABi_Company(VPDAL.ABi_Company ac)
        {
            ABiCompany obj = new ABiCompany();
            obj.ID = ac.ABi_Company_ID.ToString();
            obj.CompanyCode = ac.CompanyCode;
            obj.CompanyName = ac.CompanyName;

            return obj;
        }
Пример #3
0
 /// <summary>
 /// 更新公司
 /// </summary>
 /// <param name="company"></param>
 /// <returns></returns>
 public int updateCompany(ABiCompany company)
 {
     int id = Convert.ToInt32(company.ID);
     var obj = dbContext.ABi_Company.FirstOrDefault(o => o.ABi_Company_ID == id);
     if (obj != null)
     {
         obj.CompanyName = String.IsNullOrEmpty(company.CompanyName) ? obj.CompanyName : company.CompanyName;
         obj.CompanyCode = String.IsNullOrEmpty(company.CompanyCode) ? obj.CompanyCode : company.CompanyCode;
         return dbContext.SaveChanges();
     }
     return 0;
 }