Exemple #1
0
        /// <summary>
        /// 养护单位详情
        /// </summary>
        /// <param name="companyid"></param>
        /// <returns></returns>
        public YH_CompanyModel GetConserbationModel(int companyid)
        {
            List <YH_CompanyModel> list = new List <YH_CompanyModel>();

            using (Entities db = new Entities())
            {
                IQueryable <YH_CompanyModel> queryable = from a in db.yh_companys
                                                         join b_join in db.base_zds on a.companytype equals b_join.zd_id into bTmp
                                                         from b in bTmp.DefaultIfEmpty()
                                                         where a.companyid == companyid
                                                         select new YH_CompanyModel
                {
                    companyid       = a.companyid,
                    companyname     = a.companyname,
                    legal           = a.legal,
                    contact         = a.contact,
                    companytype     = a.companytype,
                    isenadle        = a.isenadle,
                    address         = a.address,
                    companytypename = b == null ? "" : b.zd_name,
                    createtime      = a.createtime,
                    email           = a.email,
                    faxnumber       = a.faxnumber,
                    telephone       = a.telephone,
                    mobilephone     = a.mobilephone
                };
                YH_FileDAL      dal   = new YH_FileDAL();
                YH_CompanyModel model = queryable.FirstOrDefault();
                model.filelist = dal.GetFileList(3, model.companyid);
                return(model);
            }
        }
Exemple #2
0
        public HttpResponseMessage EditConserbation(YH_CompanyModel model)
        {
            int success = bll.EditConserbation(model);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            if (success > 0)
            {
                response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            else
            {
                response.Content = new StringContent("{\"success\":false}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            return(response);
        }
Exemple #3
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());
     }
 }
Exemple #4
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);
     }
 }
Exemple #5
0
 /// <summary>
 /// 修改养护单位
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int EditConserbation(YH_CompanyModel model)
 {
     return(dal.EditConserbation(model));
 }
Exemple #6
0
 /// <summary>
 /// 添加养护单位
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddConserbation(YH_CompanyModel model)
 {
     return(dal.AddConserbation(model));
 }