コード例 #1
0
        public ActionResult HospitalLaboratoryItemSeq_Update(string sHospID, string sHLIRowid, int iHLISeq)
        {
            if (String.IsNullOrEmpty(sHospID) != true)
            {
                GetLink();

                // 判斷資料庫是否存在
                if (myClass.DatabaseOrTableExist(dbs, ic, userid, password, "his" + sHospID, null, 0) == true)
                {
                    LIS_HISEntities db_zmcmsdata = new LIS_HISEntities(myClass.GetSQLConnectionString(dbs, "his" + sHospID, userid, password, @"res://*/Models.LIS_HISModel.csdl|res://*/Models.LIS_HISModel.ssdl|res://*/Models.LIS_HISModel.msl"));

                    var lisHospitalLaboratoryItem = new lisHospitalLaboratoryItem()
                    {
                        HLIRowid = sHLIRowid, HLISeqno = iHLISeq
                    };
                    db_zmcmsdata.lisHospitalLaboratoryItem.Attach(lisHospitalLaboratoryItem);
                    db_zmcmsdata.Entry(lisHospitalLaboratoryItem).Property(p => p.HLISeqno).IsModified = true;
                    var result = db_zmcmsdata.SaveChanges();

                    return(Json(result));
                }
            }

            return(Json(""));
        }
コード例 #2
0
        public ActionResult HosptialLaboratoryItem_Update([DataSourceRequest] DataSourceRequest request, ViewModel_HospitalLaboratoryItem crud)
        {
            if (Session["HospID"] != null)
            {
                string sHospID = Session["HospID"].ToString();

                GetLink();

                LIS_HISEntities db_zmcmsdata = new LIS_HISEntities(myClass.GetSQLConnectionString(dbs, "his" + sHospID, userid, password, @"res://*/Models.LIS_HISModel.csdl|res://*/Models.LIS_HISModel.ssdl|res://*/Models.LIS_HISModel.msl"));

                if (ModelState.IsValid)
                {
                    var entity = new lisHospitalLaboratoryItem
                    {
                        HLIRowid        = crud.HLIRowid,
                        LLIRowid        = crud.LLIRowid,
                        LLISubRowid     = crud.LLISubRowid,
                        HLICode         = crud.HLICode,
                        HLIName         = crud.HLIName,
                        HLITitleName    = crud.HLITitleName,
                        HLIDisplayRange = crud.HLIDisplayRange,
                        HLISeqno        = crud.HLISeqno
                    };

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

            return(Json(new[] { crud }.ToDataSourceResult(request, ModelState)));
        }