예제 #1
0
 /// <summary>
 /// 删除养护单位
 /// </summary>
 /// <param name="companyid"></param>
 /// <returns></returns>
 public int DeleteConserbation(int companyid)
 {
     using (Entities db = new Entities())
     {
         yh_companys yhmodel = db.yh_companys.FirstOrDefault(a => a.companyid == companyid);
         if (yhmodel != null)
         {
             db.yh_companys.Remove(yhmodel);
         }
         return(db.SaveChanges());
     }
 }
예제 #2
0
 /// <summary>
 /// 修改养护单位
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int EditConserbation(YH_CompanyModel model)
 {
     using (Entities db = new Entities())
     {
         yh_companys yhmodel = db.yh_companys.FirstOrDefault(a => a.companyid == model.companyid);
         if (yhmodel != null)
         {
             yhmodel.companyname  = model.companyname;
             yhmodel.legal        = model.legal;
             yhmodel.contact      = model.contact;
             yhmodel.mobilephone  = model.mobilephone;
             yhmodel.telephone    = model.telephone;
             yhmodel.faxnumber    = model.faxnumber;
             yhmodel.email        = model.email;
             yhmodel.companytype  = model.companytype;
             yhmodel.address      = model.address;
             yhmodel.isenadle     = model.isenadle;
             yhmodel.createuserid = model.createuserid;
             yhmodel.createtime   = DateTime.Now;
         }
         return(db.SaveChanges());
     }
 }
예제 #3
0
 /// <summary>
 /// 添加养护单位
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddConserbation(YH_CompanyModel model)
 {
     using (Entities db = new Entities())
     {
         yh_companys yhmodel = new yh_companys();
         yhmodel.companyid    = model.companyid;
         yhmodel.companyname  = model.companyname;
         yhmodel.legal        = model.legal;
         yhmodel.contact      = model.contact;
         yhmodel.mobilephone  = model.mobilephone;
         yhmodel.telephone    = model.telephone;
         yhmodel.faxnumber    = model.faxnumber;
         yhmodel.email        = model.email;
         yhmodel.companytype  = model.companytype;
         yhmodel.address      = model.address;
         yhmodel.isenadle     = 1;
         yhmodel.createuserid = model.createuserid;
         yhmodel.createtime   = DateTime.Now;
         db.yh_companys.Add(yhmodel);
         db.SaveChanges();
         return(yhmodel.companyid);
     }
 }