Beispiel #1
0
        //todo 废弃
        public void AddDocFile(string name, int floor, int width, int height)
        {
            DocumentFile df = new DocumentFile(name, floor);

            df.Width  = width;
            df.Height = height;
            this.AddDocFile(df);
        }
Beispiel #2
0
 public void AddDocFile(DocumentFile Doc)
 {
     foreach (CarbinetFloor cf in this.floors)
     {
         if (cf.floorNumber == Doc.floorNumber)
         {
             Doc.floor = cf;
             cf.AddDoc(Doc);
             break;
         }
     }
 }
        public void RemoveDoc(DocumentFile doc, int i)
        {
#if TRACE
            Debug.WriteLine("footprint -> CarbinetFloor.RemoveDoc");
#endif
            this.controls.Remove(doc.doc);
            this.documentList.Remove(doc);
            //this.chairsList.Remove(this.chairsList[i]);
#if TRACE
            Debug.WriteLine("RemoveDoc <-");
#endif
        }
        // 添加物资时,将物资重新排序
        public void AddDoc(DocumentFile Doc)
        {
#if TRACE
            Debug.WriteLine("footprint -> CarbinetFloor.AddDoc");
#endif
            //检查是否档案数量是否已经超出设置的最大数量或者超出了该层的宽度
            int totalDocumentWidth = this.getDocumentsTotalWidth(-1) + (this.documentList.Count - 1) * CarbinetFloor.DOCUMENT_GAP;
            if (totalDocumentWidth + Doc.Width > this.width)
            {
                return;
            }
            if (this.maxDocNumber != -1 && this.documentList.Count >= this.maxDocNumber)
            {
                return;
            }

            //检查是否已经存在了
            bool bExist = false;
            foreach (DocumentFile df in this.documentList)
            {
                if (Doc.name == df.name)
                {
                    bExist = true;
                    break;
                }
            }
            if (bExist)//存在的将不再重复添加
            {
                return;
            }

            //物资添加到每层的列表中
            this.documentList.Add(Doc);
            if (Doc.Height > this.height)
            {
                Doc.Height = this.height - 5;
            }
            Doc.Top = this.top + this.height - Doc.Height;
            //Doc.Top = this.height - Doc.Height;
            //重新排序物资
            this.reIndexDocs();

            this.controls.Add(Doc.doc);
        }
Beispiel #5
0
        public DocumentFile getDoc(string docName)
        {
            DocumentFile dfr   = null;
            bool         bFind = false;

            foreach (CarbinetFloor cf in this.floors)
            {
                foreach (DocumentFile df in cf.documentList)
                {
                    if (df.name == docName)
                    {
                        //df.setBackgroundColor(color);
                        dfr   = df;
                        bFind = true;
                        break;
                    }
                }
                if (bFind)
                {
                    break;
                }
            }
            return(dfr);
        }
Beispiel #6
0
        // 向柜子的指定层添加档案文件
        public void AddDocFile(string name, int floor)
        {
            DocumentFile df = new DocumentFile(name, floor);

            this.AddDocFile(df);
        }
        //整理所有物资的位置
        public void reIndexDocs()
        {
            for (int i = 0; i < this.documentList.Count; i++)
            {
                DocumentFile df = this.documentList[i];
                Debug.WriteLine(
                    string.Format("before sort  -> i = {0} name = {1}"
                                  , i.ToString(), df.name));
            }
            this.documentList.Sort();

            for (int i = 0; i < this.documentList.Count; i++)
            {
                DocumentFile df = this.documentList[i];
                if (i > 0)
                {
                    //如果档案所占空间超出了该层的右边界,则不显示
                    int crtLeft = this.documentList[i - 1].Left + this.documentList[i - 1].Width
                                  + CarbinetFloor.DOCUMENT_GAP;
                    df.Left = crtLeft;
                    if (crtLeft + df.Width > this.width)
                    {
                        df.doc.Visible = false;
                    }
                    else
                    {
                        df.doc.Visible = true;
                    }
                }
                else
                {
                    df.Left = this.Left;
                }
                df.Top = this.top + this.height - df.Height;

                Debug.WriteLine(
                    string.Format("CarbinetFloor.reIndexDocs  -> i = {0} Left = {1}  Top = {2}"
                                  , i.ToString(), df.Left, df.Top));
            }
            for (int i = 0; i < this.documentList.Count; i++)
            {
                DocumentFile df = this.documentList[i];
                Debug.WriteLine(
                    string.Format("after sort  -> i = {0} name = {1} left = {2}"
                                  , i.ToString(), df.name, df.Left));
            }
            return;
            //for (int i = 0; i < this.documentList.Count; i++)
            //{
            //    DocumentFile df = this.documentList[i];
            //    df.index = 0;
            //    for (int j = 0; j < this.documentList.Count; j++)
            //    {
            //        if (j == i)
            //        {
            //            continue;
            //        }
            //        if ((df > this.documentList[j]) > 0)
            //        {
            //            df.index++;
            //        }
            //    }
            //}
        }