Beispiel #1
0
        private void confirmCategory()
        {
            string[] shp = new string[2];
            shp[0] = System.IO.Path.GetDirectoryName(shpPathText.Text);
            shp[1] = System.IO.Path.GetFileName(shpPathText.Text);

            if (shp[0] == null)
            {
                return;
            }
            IFeatureClass  pFC         = mg.openShapefile(shp[0], shp[1]);
            IFeatureCursor pFeatureCur = pFC.Search(null, false);
            IFeature       pFeature    = pFeatureCur.NextFeature();

            Hashtable i = mg.Index(pFC);

            readExcel t = new readExcel();

            t.OpenExcel(excelText.Text);
            List <TrashInfo> trashItems = t.readTrashTables();

            t.closeExcel();

            IQueryFilter tQueryFilter = new QueryFilterClass();

            tQueryFilter.WhereClause = "";
            tQueryFilter.AddField(pFC.OIDFieldName);
            //Invoke(new MethodInvoker(() =>
            //{
            //    proWork.Maximum = pFC.FeatureCount(tQueryFilter);
            //    proWork.Value = 0;
            //}));

            //int number = 1;
            while (pFeature != null)
            {
                ResultItem value = new ResultItem();
                value = mg.getFields(i, pFeature);

                #region 查找与excel中匹配的数据
                TrashInfo right = trashItems.Find(
                    delegate(TrashInfo T)
                {
                    return(T.Figure == value.Figure);
                });

                pFeature.set_Value((int)i["垃圾类别"], right.Category); //如果垃圾类别没设置,则取消注释
                pFeature.Store();
                #endregion
                //Invoke(new MethodInvoker(() =>
                //{
                //    proWork.Value = number++;
                //}));
                pFeature = pFeatureCur.NextFeature();
            }
        }
 // Start is called before the first frame update
 void Start()
 {
     convInfo       = "Cost: $2\nThe Conveyer moves trash.";
     splitInfo      = "Cost: $15\nRecyling goes UP, Trash goes DOWN";
     binInfo        = "Cost: $10\nBlue for Recyling, Green for Trash.";
     infoComponent  = info.GetComponent <Info>();
     phaseComponent = info.GetComponentInChildren <Phase>();
     trashComponent = info.GetComponentInChildren <TrashInfo>();
     bComponent     = BinSelection.GetComponent <BinSelection>();
 }
Beispiel #3
0
        protected void btnDelete_OnClick(object sender, EventArgs e)
        {
            var    aUserInfo = (UserInfo)Session["UserInfo"];
            Button btnDelete = (Button)sender;
            //var ImageInfos = new List<ImagesInfo>();
            var imgImage = (HiddenField)btnDelete.Parent.FindControl("hdtemplateId");

            int aFolderId = int.Parse(imgImage.Value);

            IFolderMediaFacade aFolderMediaFacade = new FolderMediaFacade();
            var          aFolderMediaInfo         = aFolderMediaFacade.SelectById(aFolderId);
            ITrashFacade aTrashFacade             = new TrashFacade();
            var          aTrashInfo = new TrashInfo();

            aTrashInfo.TrashDate = DateTime.Now;
            if (!Directory.Exists(Server.MapPath("~/Upload/Trash/") + aUserInfo.UserName + DateTime.Now.ToShortDateString()))
            {
                Directory.CreateDirectory(Server.MapPath("~/Upload/Trash/") + aUserInfo.UserName +
                                          DateTime.Now.ToShortDateString());
            }
            aTrashInfo.TrashFolderName = "/Upload/Trash/" + aUserInfo.UserName +
                                         DateTime.Now.ToShortDateString();

            string filename = aFolderMediaInfo.FolderImage.Replace(ServerHostName(), "");
            string desfile  = Server.MapPath(aTrashInfo.TrashFolderName) + "/" +
                              filename.Split('/')[filename.Split('/')
                                                  .Length - 1].Replace(@"\", "").Replace(@"\", "").Replace(@"\", "");

            if (File.Exists(Server.MapPath(filename)))
            {
                File.Move(Server.MapPath(filename), desfile);
            }
            aTrashInfo.TrashImageLink = aTrashInfo.TrashFolderName + "/" + filename.Split('/')[filename.Split('/').Length - 1];
            aTrashFacade.Insert(aTrashInfo);
            if (Directory.Exists(Server.MapPath("~/" + aFolderMediaInfo.FolderName.Replace("template.html", ""))))
            {
                Directory.Delete(Server.MapPath("~/" + aFolderMediaInfo.FolderName.Replace("template.html", "")), true);
            }
            aFolderMediaFacade.Delete(aFolderMediaInfo);
            dtlListTemplate.DataSource = aFolderMediaFacade.Select();
            dtlListTemplate.DataBind();
        }
Beispiel #4
0
 public void Initialize(TrashInfo trashInfo)
 {
     this.trashInfo = trashInfo;
     GetComponentInChildren <GlowingAura>().Initialize();
     if (trashInfo.trashType == TrashType.Green)
     {
         Instantiate(prefabGlassTrashList[Random.Range(0, prefabGlassTrashList.Count)], transform);
     }
     else if (trashInfo.trashType == TrashType.Blue)
     {
         Instantiate(prefabPaperTrashList[Random.Range(0, prefabPaperTrashList.Count)], transform);
     }
     else if (trashInfo.trashType == TrashType.Yellow)
     {
         Instantiate(prefabPlasticTrashList[Random.Range(0, prefabPlasticTrashList.Count)], transform);
     }
     else if (trashInfo.trashType == TrashType.White)
     {
         Instantiate(prefabDefaultTrashList[Random.Range(0, prefabDefaultTrashList.Count)], transform);
     }
 }
Beispiel #5
0
        public void Delete(TrashInfo pTrashInfo)
        {
            try
            {
                aISession    = aISessionFactor.OpenSession();
                aTransaction = aISession.BeginTransaction();

                aISession.Delete(pTrashInfo);
                aTransaction.Commit();
            }
            catch (Exception ex)
            {
                aTransaction.Rollback();
                throw new Exception(ex.Message);
            }
            finally
            {
                if (aISession.IsOpen)
                {
                    aISession.Close();
                }
            }
        }
Beispiel #6
0
 public TrashInfo(TrashInfo trashInfo)
 {
     this.trashType = trashInfo.trashType;
 }