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)));
        }
        public ActionResult HosptialLaboratoryItem_Update([DataSourceRequest] DataSourceRequest request, ViewModel_HospitalLaboratoryItem crud)
        {
            if (Session["HospID"] != null)
            {
                string sHospID = Session["HospID"].ToString();

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

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

            return(Json(new[] { crud }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult HosptialLaboratoryItem_Create([DataSourceRequest] DataSourceRequest request, ViewModel_HospitalLaboratoryItem crud, string sHospID)
        {
            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        = Guid.NewGuid().ToString(),
                    LLIRowid        = crud.LLIRowid,
                    LLISubRowid     = crud.LLISubRowid,
                    HLICode         = crud.HLICode,
                    HLIName         = crud.HLIName,
                    HLITitleName    = crud.HLITitleName,
                    HLIDisplayRange = crud.HLIDisplayRange,
                    HLISeqno        = 0
                };

                db_zmcmsdata.lisHospitalLaboratoryItem.Add(entity);
                db_zmcmsdata.SaveChanges();
            }

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