Exemple #1
0
        public ActionResult SysHospitalGrafting_Update([DataSourceRequest] DataSourceRequest request, SysHospitalGrafting update_SHG)
        {
            if (ModelState.IsValid)
            {
                var entity = new SysHospitalGrafting
                {
                    HGRowid         = update_SHG.HGRowid,
                    HospRowid       = update_SHG.HospRowid,
                    CBDRowid        = update_SHG.CBDRowid,
                    HGMachine       = update_SHG.HGMachine,
                    HGMachinePort   = update_SHG.HGMachinePort,
                    HGLoginUser1    = update_SHG.HGLoginUser1,
                    HGLoginUser2    = update_SHG.HGLoginUser2,
                    HGLoginUser3    = update_SHG.HGLoginUser3,
                    HGLoginPassword = update_SHG.HGLoginPassword,
                    HGGetDataPath   = update_SHG.HGGetDataPath,
                    HGSaveLogPath   = update_SHG.HGSaveLogPath,
                    HGUrl           = update_SHG.HGUrl
                };

                db.SysHospitalGrafting.Attach(entity);
                db.Entry(entity).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(Json(new[] { update_SHG }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult SysMedicalGroup_Update([DataSourceRequest] DataSourceRequest request, SysMedicalGroup sysMedicalGroup)
        {
            if (ModelState.IsValid)
            {
                var entity = new SysMedicalGroup
                {
                    MGRowid    = sysMedicalGroup.MGRowid,
                    MGName     = sysMedicalGroup.MGName,
                    MGDescript = sysMedicalGroup.MGDescript,
                    MGFont     = sysMedicalGroup.MGFont
                };

                db.SysMedicalGroup.Attach(entity);
                db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }

            return(Json(new[] { sysMedicalGroup }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult ComboMaster_Update([DataSourceRequest] DataSourceRequest request, ComboMaster combomaster)
        {
            if (ModelState.IsValid)
            {
                var entity = new ComboMaster
                {
                    CBMRowid                = combomaster.CBMRowid,
                    CBMClass                = combomaster.CBMClass,
                    CBMDescription          = combomaster.CBMDescription,
                    CBMRemark               = combomaster.CBMRemark,
                    CBMGroup                = combomaster.CBMGroup,
                    CBMLastModifiedDateTime = combomaster.CBMLastModifiedDateTime,
                    CBMModifiedUserRowid    = combomaster.CBMModifiedUserRowid
                };

                db.ComboMaster.Attach(entity);
                db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }

            return(Json(new[] { combomaster }.ToDataSourceResult(request, ModelState)));
        }
Exemple #4
0
        public ActionResult SysHospital_Update([DataSourceRequest] DataSourceRequest request, SysHospital sysHospital)
        {
            if (ModelState.IsValid)
            {
                // 處理HospImage變作空白後要產生一張空白圖片給該機構
                // 已有影像資料者不得做上述動作
                //if (String.IsNullOrEmpty(sysHospital.HospImage) == true)
                //{
                //    string sPath = "/PhotoCloud/HospitalImages/";
                //    string targetPathAndFile = sysHospital.HospRowid + "_" + "no-photo-available.png";

                //    if (System.IO.File.Exists(Request.MapPath(sPath + targetPathAndFile)))
                //    {
                //        System.IO.File.Delete(Request.MapPath(sPath + targetPathAndFile));
                //    }

                //    System.IO.File.Copy(Request.MapPath(sPath + "no-photo-available.png"), Request.MapPath(sPath + targetPathAndFile));
                //}

                // 開始更新資料
                var entity = new SysHospital
                {
                    HospRowid     = sysHospital.HospRowid,
                    HospID        = sysHospital.HospID,
                    HospName      = sysHospital.HospName,
                    HospPrincipal = sysHospital.HospPrincipal,
                    HospDean      = sysHospital.HospDean,
                    HospAddress   = sysHospital.HospAddress,
                    HospAreaCode  = sysHospital.HospAreaCode,
                    HospPhone     = sysHospital.HospPhone,
                    HospFaxno     = sysHospital.HospFaxno,
                    HospEmail     = sysHospital.HospEmail,
                    HospLevel     = sysHospital.HospLevel,
                    HospHIS       = sysHospital.HospHIS,
                    HospActive    = sysHospital.HospActive,
                    //HospImage = (Session["SourcePhotoFileName"] == null) ? sysHospital.HospRowid + "_no-photo-available.png" : sysHospital.HospImage,
                    HospImage  = sysHospital.HospImage,
                    HospRegSys = sysHospital.HospRegSys
                };

                db.SysHospital.Attach(entity);
                db.Entry(entity).State = EntityState.Modified;
                db.SaveChanges();
                //sysHospital.HospImage = (Session["SourcePhotoFileName"] == null) ? sysHospital.HospRowid + "_no-photo-available.png" : sysHospital.HospImage;

                //Session.Remove("SourcePhotoFileName");
            }

            return(Json(new[] { sysHospital }.ToDataSourceResult(request, ModelState)));
        }
Exemple #5
0
 /// <summary>
 /// 删除实体对象
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="isSaveChanges"></param>
 /// <returns></returns>
 public int Delete(T entity, bool isSaveChanges = true)
 {
     _ctx.Entry(entity).State = EntityState.Deleted;
     return(IsSaveChanges(isSaveChanges));
 }