protected override void AddNew()
 {
     this._productMouldTest = new Book.Model.ProductMouldTest();
 }
Exemplo n.º 2
0
 public bool IsExistId(Model.ProductMouldTest test)
 {
     return(accessor.IsExistId(test));
 }
        public override void Refresh()
        {
            if (this._productMouldTest == null)
            {
                this._productMouldTest = new Book.Model.ProductMouldTest();
                this.action            = "isnert";
            }
            else
            {
                this._productMouldTest = this._productMouldTestManager.Get(this._productMouldTest.ProductMouldTestId);
                if (this._productMouldTest == null)
                {
                    this._productMouldTest = new Book.Model.ProductMouldTest();
                    // this.action = "isnert";
                }
            }

            this.textEditId.Text = this._productMouldTest.Id;

            this.newChooseContorlAreaCategoryId.EditValue = this._productMouldTest.AreaCategory;

            //this.newChooseContorlEmployee0Id.EditValue = this._productMouldTest.Employee;

            //this.newChooseContorlEmployeeId.EditValue = this._productMouldTest.Employee0;

            //this.newChooseContorlSupplierId.EditValue = this._productMouldTest.Supplier;

            this.lookUpEditPronoteMachine.EditValue = this._productMouldTest.PronoteMachineId;



            if (this._productMouldTest.InFactoryDate != null)
            {
                this.dateEditInFactoryDate.DateTime = this._productMouldTest.InFactoryDate.Value;
            }
            if (this._productMouldTest.OutFactoryDate != null)
            {
                this.dateEditOutFactoryDate.DateTime = this._productMouldTest.OutFactoryDate.Value;
            }

            this.memoEditTestCause.Text = this._productMouldTest.TestCause;

            this.bindingSourceProductMouldTest.DataSource = this._productMouldTestManager.Select();
            this.bindingSourcePronteMachine.DataSource    = this._pronoteMachineManager.Select();

            this.list = this._productMouldManager.SelectProductMouldByProductMouldTestId(this._productMouldTest.ProductMouldTestId);
            string text = string.Empty;

            foreach (Model.ProductMould item in list)
            {
                if (text == "")
                {
                    text = item.MouldName;
                }
                else
                {
                    text += "," + item.MouldName;
                }
            }

            this.buttonEditMould.Text = text;

            base.Refresh();
        }
Exemplo n.º 4
0
 public Model.ProductMouldTest GetNext(Model.ProductMouldTest e)
 {
     return(accessor.GetNext(e));
 }
Exemplo n.º 5
0
        public void Update(Model.ProductMouldTest productMouldTest)
        {
            Validate(productMouldTest);

            productMouldTest.UpdateTime = DateTime.Now;

            accessor.Update(productMouldTest);

            //上传修改附件
            string filedir = this.SaveSeverPath + "\\" + productMouldTest.ProductMouldTestId;

            if (!System.IO.Directory.Exists(filedir))
            {
                System.IO.Directory.CreateDirectory(filedir);
            }
            string[] newfilenames = productMouldTest.accessoriesList.Split('|'); //新上传附件
            string[] hasfilenames = System.IO.Directory.GetFiles(filedir);       //原始附件

            //添加新附件
            if (!string.IsNullOrEmpty(productMouldTest.accessoriesList))
            {
                foreach (string newfiles in newfilenames)
                {
                    try
                    {
                        bool flag = true;
                        foreach (string hasfile in hasfilenames)
                        {
                            if (hasfile.Equals(newfiles, StringComparison.OrdinalIgnoreCase))
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (flag)
                        {
                            System.IO.File.Copy(newfiles, filedir + "\\" + newfiles.Substring(newfiles.LastIndexOf("\\") + 1), true);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                }
            }
            //删除旧附件
            foreach (string hasfiles in hasfilenames)
            {
                try
                {
                    bool flag = true;
                    foreach (string newfiles in newfilenames)
                    {
                        string truenames = newfiles.Substring(newfiles.LastIndexOf("\\") + 1);
                        if (truenames.Equals(hasfiles.Substring(hasfiles.LastIndexOf("\\") + 1), StringComparison.OrdinalIgnoreCase))
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        System.IO.File.Delete(hasfiles);
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
Exemplo n.º 6
0
 public Model.ProductMouldTest GetPrev(Model.ProductMouldTest e)
 {
     return(accessor.GetPrev(e));
 }
Exemplo n.º 7
0
 public bool HasRowsAfter(Model.ProductMouldTest e)
 {
     return(accessor.HasRowsAfter(e));
 }
Exemplo n.º 8
0
 public bool HasRowsBefore(Model.ProductMouldTest e)
 {
     return(accessor.HasRowsBefore(e));
 }
Exemplo n.º 9
0
 public bool ExistsExcept(Model.ProductMouldTest e)
 {
     return(accessor.ExistsExcept(e));
 }
Exemplo n.º 10
0
 protected override void MoveFirst()
 {
     this._ProductMouldTest = this.productMouldTestList[0];
 }