public void Init()
        {
            ModelDB modeldb;// = Substitute.For<List<StorageImitation>>() as ModelDB;

            service = new CollarEntityService();
            _modelCollar = Substitute.For<List<COLLAR2>>();
            _modelAssays = Substitute.For<List<ASSAYS2>>();
            for (int i = 0; i < 15; i++)
            {
                COLLAR2 newCollar2 = new COLLAR2();
                newCollar2.ID = i;
                newCollar2.GORIZONT = new GORIZONT();
                newCollar2.RL_EXPLO2 = new RL_EXPLO2();
                newCollar2.DRILLING_TYPE = new DRILLING_TYPE();
                _modelCollar.Add(newCollar2);
                ASSAYS2 newAssays2 = new ASSAYS2();
                newAssays2.BHID = newCollar2.ID;
                newAssays2.COLLAR2 = newCollar2;
                newAssays2.REESTR_VEDOMOSTEI = new REESTR_VEDOMOSTEI();
                newAssays2.BLOCK_ZAPASOV = new BLOCK_ZAPASOV();
                newAssays2.GEOLOGIST1 = new GEOLOGIST();
                newAssays2.JOURNAL1 = new JOURNAL();
                newAssays2.LITOLOGY = new LITOLOGY();
                newAssays2.RANG1 = new RANG();
                _modelAssays.Add(newAssays2);

            }
            modeldb.COLLAR2.Returns(_modelCollar as IEnumerable<COLLAR2>);
            modeldb.ASSAYS2.Returns(_modelAssays as IEnumerable<ASSAYS2>);
        }
        public void Init()
        {
            _modelCollarRecords = new List<COLLAR2>();
            for (int i = 0; i < 15; i++)
            {
                COLLAR2 newCollar2 = new COLLAR2();
                newCollar2.ID = i;
                newCollar2.BHID = "bhid" + i.ToString();
                newCollar2.HOLE_ID = i;
                newCollar2.GORIZONT = new GORIZONT();
                newCollar2.RL_EXPLO2 = new RL_EXPLO2();
                newCollar2.DRILLING_TYPE = new DRILLING_TYPE();
                _modelCollarRecords.Add(newCollar2);
            }
            _modelGeologist = Substitute.For<IBaseService<GEOLOGIST>>();
            _modelGeologist.Get().Returns(new List<GEOLOGIST>());
            _modelGeologist.Count().Returns(0);

            _modelCollar = Substitute.For<IBaseService<COLLAR2>>();
            _broCollar = new BrowseCollar(_modelCollar, _modelGeologist, 5);
        }
示例#3
0
        private void OnClickOk(object sender,EventArgs e)
        {
            COLLAR2 obj;
                if ( modeFormData._mode == ModeFormEnum.creating)
                {
                    obj = new COLLAR2();
                }
                else if (modeFormData._mode == ModeFormEnum.modifying)
                {
                    obj = _model.Get(modeFormData.id ?? -1);
                }
                else
                {
                    obj = _model.Get(modeFormData.id ?? -1);
                }
                obj.BENCH_ID = _view.gorizontID ?? -1;
                obj.LINE_ID = _view.blast ?? -1;
                obj.HOLE_ID = _view.hole ?? -1;
                obj.BHID = _modelGorizont.Get(obj.BENCH_ID).BENCH_NAME.ToString().Trim() + "-" + _modelBlast.Get(obj.LINE_ID).EXPL_LINE_NAME.Trim() + "-" + obj.HOLE_ID.ToString().Trim();
                obj.XCOLLAR = _view.xcollar ?? -1;
                obj.YCOLLAR = _view.ycollar ?? -1;
                obj.ZCOLLAR = _view.zcollar ?? -1;
                obj.DRILL_TYPE = _view.drillType ?? -1;
                obj.ENDDEPTH = _view.enddepth ?? -1;
                obj.DOMEN = _view.domenId ?? -1;
                obj.LastUserID = 6;
                obj.LastDT = DateTime.Now;

                try
                {
                    if (modeFormData._mode == ModeFormEnum.creating)
                    {
                        _model.Create(obj);
                    }
                    else if (modeFormData._mode == ModeFormEnum.modifying)
                    {
                        _model.Modify(obj);
                    }
                    else
                    {
                        _model.Delete(obj);
                    }

                }
                catch(Exception ex)
                {
                    if (modeFormData._mode != ModeFormEnum.creating)
                    {
                        _model.Refresh(obj);
                    }
                    throw new InvalidOperationException("Что то пошло не так при сохранении./n  Что то пошло не так при сохранении.",ex.InnerException);
                }
                var ev = DataChanged;
                if (ev != null)
                {
                    ev(this, EventArgs.Empty);
                }
            _view.Close();
        }
示例#4
0
 /// <summary>
 /// Create a new COLLAR2 object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="bHID">Initial value of the BHID property.</param>
 /// <param name="bENCH_ID">Initial value of the BENCH_ID property.</param>
 /// <param name="lINE_ID">Initial value of the LINE_ID property.</param>
 /// <param name="hOLE_ID">Initial value of the HOLE_ID property.</param>
 /// <param name="xCOLLAR">Initial value of the XCOLLAR property.</param>
 /// <param name="yCOLLAR">Initial value of the YCOLLAR property.</param>
 /// <param name="zCOLLAR">Initial value of the ZCOLLAR property.</param>
 /// <param name="eNDDEPTH">Initial value of the ENDDEPTH property.</param>
 /// <param name="dRILL_TYPE">Initial value of the DRILL_TYPE property.</param>
 /// <param name="dOMEN">Initial value of the DOMEN property.</param>
 public static COLLAR2 CreateCOLLAR2(global::System.Int32 id, global::System.String bHID, global::System.Int32 bENCH_ID, global::System.Int32 lINE_ID, global::System.Int32 hOLE_ID, global::System.Double xCOLLAR, global::System.Double yCOLLAR, global::System.Double zCOLLAR, global::System.Double eNDDEPTH, global::System.Int32 dRILL_TYPE, global::System.Int32 dOMEN)
 {
     COLLAR2 cOLLAR2 = new COLLAR2();
     cOLLAR2.ID = id;
     cOLLAR2.BHID = bHID;
     cOLLAR2.BENCH_ID = bENCH_ID;
     cOLLAR2.LINE_ID = lINE_ID;
     cOLLAR2.HOLE_ID = hOLE_ID;
     cOLLAR2.XCOLLAR = xCOLLAR;
     cOLLAR2.YCOLLAR = yCOLLAR;
     cOLLAR2.ZCOLLAR = zCOLLAR;
     cOLLAR2.ENDDEPTH = eNDDEPTH;
     cOLLAR2.DRILL_TYPE = dRILL_TYPE;
     cOLLAR2.DOMEN = dOMEN;
     return cOLLAR2;
 }
示例#5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the COLLAR2 EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCOLLAR2(COLLAR2 cOLLAR2)
 {
     base.AddObject("COLLAR2", cOLLAR2);
 }
示例#6
0
        public void Init()
        {
            _itemToPage = 5;

            _modelCollarRecords = new List<COLLAR2>();
            _modelRecordsEmpty = new List<COLLAR2>();
            _modelAssaysRecords = new List<ASSAYS2>();

            for (int i = 0 ; i < 15 ; i++)
            {
                COLLAR2 newCollar2 = new COLLAR2();
                newCollar2.ID = i;
                newCollar2.BHID = "bhid" + i.ToString();
                newCollar2.HOLE_ID =  i;
                newCollar2.GORIZONT = new GORIZONT();
                newCollar2.RL_EXPLO2 = new RL_EXPLO2();
                newCollar2.DRILLING_TYPE = new DRILLING_TYPE();
                _modelCollarRecords.Add(newCollar2);
                ASSAYS2 newAssays2 = new ASSAYS2();
                newAssays2.BHID = newCollar2.ID;
                newAssays2.COLLAR2 = newCollar2;
                newAssays2.REESTR_VEDOMOSTEI = new REESTR_VEDOMOSTEI();
                newAssays2.BLOCK_ZAPASOV = new BLOCK_ZAPASOV();
                newAssays2.GEOLOGIST1 = new GEOLOGIST();
                newAssays2.JOURNAL1 = new JOURNAL();
                newAssays2.LITOLOGY = new LITOLOGY();
                newAssays2.RANG1 = new RANG();
                _modelAssaysRecords.Add(newAssays2);

            }

            _view = Substitute.For<IViewDrillHoles2>();
            _view.CollarList = new Dictionary<int, ICollar2VmFull>();
            _view.AssaysList = new Dictionary<int, IAssays2VmFull>();
            _viewEmpty = Substitute.For<IViewDrillHoles2>();
            _viewEmpty.CollarList = new Dictionary<int, ICollar2VmFull>();
            _viewEmpty.AssaysList = new Dictionary<int, IAssays2VmFull>();

            _modelCollar = Substitute.For<IBaseService<COLLAR2>>();
            _modelCollar.Get().Returns(_modelCollarRecords);
            _modelCollar.Count().Returns(_modelCollarRecords.Count);

            _modelAssays = Substitute.For<IBaseService<ASSAYS2>>();
            _modelAssays.Get().Returns(_modelAssaysRecords);
            _modelAssays.GetByBhid(Arg.Any<int>()).Returns(a=>_modelAssaysRecords.Where(x=>x.BHID==(int)a[0]));
            _modelAssays.Count().Returns(_modelAssaysRecords.Count);

            _modelGeologist = Substitute.For<IBaseService<GEOLOGIST>>();
            _modelGeologist.Get().Returns(new List<GEOLOGIST>());
            _modelGeologist.Count().Returns(0);

            _modelEmpty = Substitute.For<IBaseService<COLLAR2>>();
            _modelEmpty.Get().Returns(_modelRecordsEmpty);
            _modelEmpty.Count().Returns(_modelRecordsEmpty.Count);

            _browseCollar = new BrowseCollar(_modelCollar, _modelGeologist, _itemToPage);
            _browseAssays = new BrowseAssay(_modelAssays, _modelGeologist, _itemToPage);
        }