public WorkUnitDescriptor(IAggregateRoot entity, IUnitOfWorkRepository unitOfWorkRepository, WorkUnitType workUnitType)
 {
     Entity = entity;
     UnitOfWorkRepository = unitOfWorkRepository;
     WorkUnitType         = workUnitType;
     RegisteredTime       = DateTime.Now;
 }
 public IActionResult Create([FromBody] WorkUnitType newmodel)
 {
     if (ModelState.IsValid)
     {
         _context.WorkUnitType.Add(newmodel);
         _context.SaveChanges();
         return(CreatedAtRoute("GetWorkUnitType", new { id = newmodel.WorkUnitTypeID }, newmodel));
     }
     else
     {
         return(BadRequest());
     }
 }
        public IActionResult UpdateEntry([FromBody] WorkUnitType objupd)
        {
            var targetObject = _context.WorkUnitType.FirstOrDefault(t => t.WorkUnitTypeID == objupd.WorkUnitTypeID);

            if (targetObject == null)
            {
                return(NotFound());
            }

            _context.Entry(targetObject).CurrentValues.SetValues(objupd);
            ReturnData ret;

            ret = _context.SaveData();

            if (ret.Message == "Success")
            {
                return(Ok());
            }

            return(NotFound(ret));
        }
Example #4
0
        public void WorkUnitType()
        {
            IQueryable <WorkUnitType> WorkUnitTypeCollection = Enumerable.Empty <WorkUnitType>().AsQueryable();
            WorkUnitType ct = new WorkUnitType {
                WorkUnitTypeID = 1, WorkUnitTypeName = "Test WUT"
            };

            Mock <IWorkUnitTypeRepository> WorkUnitTypeService = new Mock <IWorkUnitTypeRepository>();

            object obj = new object();

            try
            {
                WorkUnitTypeService.Setup(x => x.GetAll()).Returns(WorkUnitTypeCollection);
                WorkUnitTypeService.Setup(x => x.Get(It.IsAny <int>())).Returns(ct);
                WorkUnitTypeService.Setup(x => x.Add(It.IsAny <WorkUnitType>())).Returns(ct);
                WorkUnitTypeService.Setup(x => x.Delete(It.IsAny <WorkUnitType>())).Verifiable();
                WorkUnitTypeService.Setup(x => x.Update(It.IsAny <WorkUnitType>(), It.IsAny <object>())).Returns(ct);

                var WorkUnitTypeObject = WorkUnitTypeService.Object;
                var p1 = WorkUnitTypeObject.GetAll();
                var p2 = WorkUnitTypeObject.Get(1);
                var p3 = WorkUnitTypeObject.Update(ct, obj);
                var p4 = WorkUnitTypeObject.Add(ct);
                WorkUnitTypeObject.Delete(ct);

                Assert.IsAssignableFrom <IQueryable <WorkUnitType> >(p1);
                Assert.IsAssignableFrom <WorkUnitType>(p2);
                Assert.Equal("Test WUT", p2.WorkUnitTypeName);
                Assert.Equal("Test WUT", p3.WorkUnitTypeName);

                WorkUnitTypeService.VerifyAll();

                WorkUnitTypeObject.Dispose();
            }
            finally
            {
                WorkUnitTypeService = null;
            }
        }
Example #5
0
        private XmlNode _xmlnode = null; //��ǰ��_sworkUnitһ�µĽڵ�

        #endregion Fields

        #region Constructors

        // ͨ��workUnitName�õ����е�����Դdataitem,��ͨ��dataitem�鵽��Ӧ��sqltext,���õ�table
        // workUnitFileԭ���ڴ�ָ�����������ļ�������workitem.xml��Ŀǰworkitem.xml��hmsys���ݿ��������ˣ����Բ��ٿ���
        // ��ʱ��workUnitNameΪ��Ԫ���ƣ�ֻ����hmsys��unititem���ҵ�workUnitName���ϼ���,Ȼ����ȡ��workUnitName��Ԫ����������
        public UnitItem(string	workUnitFile,string	workUnitName)
        {
            if (workUnitName == "") return;
            this._unitFile = workUnitFile;
            CreateAppTable(workUnitFile,workUnitName);
            if (this.dtWorkUnit == null) return;

            DataRow[] _drnodes = this.dtWorkUnit.Select("ntype='UnitItem'");
             if (_drnodes.Length == 0) return;
             this._drnode = _drnodes[0];
            this.SetWorkUnit(workUnitName);

            this.WorkItemList		=	this.GetWorkItemList();
            this.CommandItemList	=	this.GetCommandItemList();
            this.AppendItemList		=	this.GetAppendItemList();
            this.UnitType			=	this.GetWorkUnitType();
            this.DataSrcFile		=	this.GetDataSrcFile();
            this.FileEditTp			=	this.GetFileEditTp();
            this.WorkFlow           =   this.GetWorkFlow();

            this.FilePrnTp          =   this.GetFilePrintTp();
            this.SaveOPType			=	this.GetSaveType();
            this.DictColSrcFile		=	this.GetDictColSrcFile();
            this.StFilter			=	this.GetShortcutFilter();
            this.treeFilter			=	this.GetTreeFilter();

            this.BillType			=	this.GetBillType();
            this.PrintType          =   this.GetPrnType();
            this.IsVisibleNav       =   this.GetVisibleNav();
        }
		/// <summary>
		/// 根据工作单元类型返回对应的URL
		/// </summary>
		/// <param name="workType">工作单元</param>
		/// <returns>打开工作单元主窗口的URL</returns>
        /// 增加自定义Html类型,如果为自定义,则取出HTML模板路径及文件
		private string	getUrlByWorkType(WorkUnitType	workType)
		{
			string	ls_workurl="";
			switch(workType)
			{
                case WorkUnitType.SimpleBank:
                    ls_workurl = "wfSimple.aspx"; 
                    break;
                case WorkUnitType.SimpleBankLeft:
                    ls_workurl = "wfSimpMDTP.aspx"; 
                    break;
                case WorkUnitType.VmlChartTp:
                    ls_workurl = "wfVmlChart.aspx";
                    break;
				case WorkUnitType.ReportItem:
					break;
				case WorkUnitType.OtherItem:
					break;
				case WorkUnitType.Updatekey:
					ls_workurl="frmupdatekey.aspx";
					break;
				case WorkUnitType.HomePage:
					ls_workurl="frmstart.aspx";
					break;
				case WorkUnitType.NavPage:
					ls_workurl="frmnav.aspx";
					break;
				case WorkUnitType.VmlMapPage:
					ls_workurl="wfVMLTp.aspx";
					break;
			    //leo fixed
				//操作集设计
				case WorkUnitType.SysItem:
					ls_workurl="frmXMLset.aspx";
					break;
				case WorkUnitType.SysOptions:
					ls_workurl="frmoptiSet.aspx";
					break;
					// 权限管理 - 定义本独立单位的权限 	
				case WorkUnitType.SysOptRight:
					ls_workurl="frmOptright.aspx";
					break;
					// 定义组织机构 
				case WorkUnitType.SysOrganize:
					ls_workurl="frmorganize.aspx";
					break;
					// 定义为独立单位分配操作集
				case WorkUnitType.SysAssign:
					ls_workurl="frmassign.aspx";
					break;
                case WorkUnitType.HtmlBankLeft:
                    ls_workurl = unitItem.FileEditTp;
                    break;
            }
			return ls_workurl;
		}
Example #7
0
        // 通过workUnitName得到其中的数据源dataitem,再通过dataitem查到对应的sqltext,最后得到table
        // workUnitFile原用于打开指定操作集的文件名,即workitem.xml,目前workitem.xml由hmsys数据库替代,因此,可以不再考虑
        // 此时,workUnitName为单元名称,只需在hmsys的unititem中找到workUnitName集合即可,然后再取出workUnitName单元的所有属性
		public UnitItem(string	workUnitFile,string	workUnitName)
		{
            if (workUnitName == "") return;
            this._unitFile = workUnitFile;
            string strConn = DataAccRes.DefaultDataConnInfo.Value;
            myConnection = new SqlConnection(strConn);
            CreateAppTable(workUnitFile, workUnitName);
            if (this.dtWorkUnit == null || this.dtWorkUnit.Columns.Count < 1 || !this.dtWorkUnit.Columns.Contains("ntype"))
                return;

            DataRow[] _drnodes = this.dtWorkUnit.Select("ntype='UnitItem'");
             if (_drnodes.Length == 0) return;
             this._drnode = _drnodes[0];
			this.SetWorkUnit(workUnitName);

			this.WorkItemList		=	this.GetWorkItemList();
			this.CommandItemList	=	this.GetCommandItemList();
			this.AppendItemList		=	this.GetAppendItemList();
			this.UnitType			=	this.GetWorkUnitType();
			this.DataSrcFile		=	this.GetDataSrcFile();
			this.FileEditTp			=	this.GetFileEditTp();
            this.WorkFlow           =   this.GetWorkFlow();
            
            this.FilePrnTp          =   this.GetFilePrintTp();
			this.SaveOPType			=	this.GetSaveType();
			this.DictColSrcFile		=	this.GetDictColSrcFile();
			this.StFilter			=	this.GetShortcutFilter();
			this.treeFilter			=	this.GetTreeFilter();
			
			this.BillType			=	this.GetBillType();
            this.PrintType          =   this.GetPrnType();
            this.IsVisibleNav       =   this.GetVisibleNav();
		}
        public IActionResult Update([FromBody] WorkUnitType editentry)
        {
            var result = _repository.Update(editentry, editentry.WorkUnitTypeID);

            return(Helper.CheckResult(result));
        }
        public IActionResult Create([FromBody] WorkUnitType newentry)
        {
            var result = _repository.Add(newentry);

            return(Helper.CheckResult(result));
        }