コード例 #1
0
 public void UpdatePanoramaScene(PanoramaScene scene)
 {
     if (scene == null)
     {
         throw new ArgumentNullException("scene");
     }
     else
     {
         _sceneRepository.Update(scene);
         _eventPublisher.EntityUpdated(scene);
     }
 }
コード例 #2
0
 public void DeletePanoramaScene(PanoramaScene location)
 {
     if (location == null)
     {
         throw new ArgumentNullException("location");
     }
     else
     {
         _sceneRepository.Delete(location);
         _eventPublisher.EntityDeleted(location);
     }
 }
コード例 #3
0
 public void InsertPanoramaScene(PanoramaScene sence)
 {
     if (sence == null)
     {
         throw new ArgumentNullException("sence");
     }
     else
     {
         _sceneRepository.Insert(sence);
         _eventPublisher.EntityInserted(sence);
     }
 }
コード例 #4
0
        public IHttpActionResult Temp()
        {
            // return Ok("导入成功");

            var filePath = @"D:\aaa.xls";
            //string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + filePath + ";" + "Extended Properties=Excel 8.0;";
            string strConn = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'", filePath);

            System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(strConn);
            conn.Open();
            string strExcel = "";

            System.Data.OleDb.OleDbDataAdapter myCommand = null;
            System.Data.DataSet ds = null;
            strExcel  = "select * from [Sheet1$]";
            myCommand = new System.Data.OleDb.OleDbDataAdapter(strExcel, strConn);
            ds        = new System.Data.DataSet();
            myCommand.Fill(ds, "table1");

            var table = ds.Tables[0];

            for (var i = 0; i < table.Rows.Count; i++)
            {
                var row = table.Rows[i];

                var location = _locationService.GetLocationByName(row[0].ToString());

                if (location == null)
                {
                    continue;
                }

                var scene = new PanoramaScene();
                scene.Views            = 0;
                scene.Stars            = 0;
                scene.ProductionDate   = Convert.ToDateTime(row[1]);
                scene.LastViewDate     = DateTime.Now;
                scene.PanoramaLocation = location;
                _sceneService.InsertPanoramaScene(scene);

                location.DefaultPanoramaSceneId = scene.Id;
                _locationService.UpdatePanoramaLocation(location);
            }
            return(Ok("更新完成"));
        }
コード例 #5
0
 public static PanoramaScene ToEntity(this PanoramaSceneModel createmodel, PanoramaScene destination)
 {
     return(createmodel.MapTo(destination));
 }
コード例 #6
0
 public static PanoramaScenePreviewModel ToPreviewModel(this PanoramaScene entity)
 {
     return(entity.MapTo <PanoramaScene, PanoramaScenePreviewModel>());
 }
コード例 #7
0
 public static PanoramaSceneListItemModel ToListItemModel(this PanoramaScene entity)
 {
     return(entity.MapTo <PanoramaScene, PanoramaSceneListItemModel>());
 }