public static int InsDObject(DObject _param) { int result = -1; _param.CreateUs = 1; if (_param.BPolicyOID == null) { _param.BPolicyOID = BPolicyRepository.SelBPolicy(new BPolicy { Type = _param.Type }).First().OID; } if (_param.Revision == null) { BPolicy tmpBPolicy = BPolicyRepository.SelBPolicy(new BPolicy { OID = _param.BPolicyOID }).First(); if (tmpBPolicy.IsRevision != null && tmpBPolicy.IsRevision.Equals("Y")) { _param.TdmxOID = DObjectRepository.SelTdmxOID(new DObject { Type = _param.Type }); _param.Revision = CommonConstant.REVISION_PREFIX + CommonConstant.INIT_REVISION; } } _param.IsLatest = 1; _param.IsReleasedLatest = 0; result = DaoFactory.SetInsert("Comm.InsDObject", _param); return(result); }
public static void SelDepartment(JqTreeModel _jqxTree, DObject _param) { List <JqTreeModel> items = new List <JqTreeModel>(); DObject tmpDepartment = null; DRelationshipRepository.SelRelationship(new DRelationship { Type = CommonConstant.RELATIONSHIP_DEPARTMENT, FromOID = _param.OID }).ForEach(item => { if (tmpDepartment != null) { tmpDepartment = null; } JqTreeModel innerJqTreeModel = new JqTreeModel(); tmpDepartment = DObjectRepository.SelDObject(new DObject { Type = CommonConstant.TYPE_DEPARTMENT, OID = item.ToOID }); innerJqTreeModel.id = tmpDepartment.OID; innerJqTreeModel.label = tmpDepartment.Name; innerJqTreeModel.icon = CommonConstant.ICON_DEPARTMENT; innerJqTreeModel.iconsize = CommonConstant.DEFAULT_ICONSIZE; innerJqTreeModel.expanded = true; innerJqTreeModel.type = CommonConstant.TYPE_DEPARTMENT; SelDepartment(innerJqTreeModel, tmpDepartment); items.Add(innerJqTreeModel); }); _jqxTree.items = items; }
public static int CloneDObject(DObject _param) { int result = -1; DObject targetDobj = DObjectRepository.SelDObject(new DObject { OID = _param.OID }); result = DObjectRepository.InsDObject(targetDobj); return(result); }
public static Person SelPerson(Person _param) { _param.Type = CommonConstant.TYPE_PERSON; Person person = DaoFactory.GetData <Person>("Users.SelPerson", _param); person.Password = "******"; person.DepartmentNm = DObjectRepository.SelDObject(new DObject { Type = CommonConstant.TYPE_DEPARTMENT, OID = person.DepartmentOID }).Name; return(person); }
public static void SelDepartmentWithPerson(JqTreeModel _jqxTree, DObject _param, List <string> _checkitemtypes) { List <JqTreeModel> items = new List <JqTreeModel>(); DObject tmpDepartment = null; DRelationshipRepository.SelRelationship(new DRelationship { Type = CommonConstant.RELATIONSHIP_DEPARTMENT, FromOID = _param.OID }).ForEach(item => { if (tmpDepartment != null) { tmpDepartment = null; } JqTreeModel innerJqTreeModel = new JqTreeModel(); tmpDepartment = DObjectRepository.SelDObject(new DObject { Type = CommonConstant.TYPE_DEPARTMENT, OID = item.ToOID }); innerJqTreeModel.id = tmpDepartment.OID; innerJqTreeModel.label = tmpDepartment.Name; innerJqTreeModel.icon = CommonConstant.ICON_DEPARTMENT; innerJqTreeModel.iconsize = CommonConstant.DEFAULT_ICONSIZE; innerJqTreeModel.expanded = true; innerJqTreeModel.type = CommonConstant.TYPE_DEPARTMENT; innerJqTreeModel.checkitemtypes = _checkitemtypes; List <Person> personItems = PersonRepository.SelPersons(new Person { DepartmentOID = tmpDepartment.OID }); personItems.ForEach(personItem => { JqTreeModel personJqTreeModel = new JqTreeModel(); personJqTreeModel.id = personItem.OID; personJqTreeModel.label = personItem.Name; personJqTreeModel.icon = CommonConstant.ICON_PERSON; personJqTreeModel.iconsize = CommonConstant.DEFAULT_ICONSIZE; personJqTreeModel.type = CommonConstant.TYPE_PERSON; personJqTreeModel.checkitemtypes = _checkitemtypes; personJqTreeModel.value = personItem.DepartmentNm; if (innerJqTreeModel.items == null) { innerJqTreeModel.items = new List <JqTreeModel>(); } innerJqTreeModel.items.Add(personJqTreeModel); }); SelDepartmentWithPerson(innerJqTreeModel, tmpDepartment, _checkitemtypes); items.Add(innerJqTreeModel); }); if (_jqxTree.items == null) { _jqxTree.items = new List <JqTreeModel>(); } _jqxTree.items.AddRange(items); }
public static List <Person> SelPersons(Person _param) { _param.Type = CommonConstant.TYPE_PERSON; List <Person> lPerson = DaoFactory.GetList <Person>("Users.SelPerson", _param); lPerson.ForEach(person => { person.Password = "******"; person.DepartmentNm = DObjectRepository.SelDObject(new DObject { Type = CommonConstant.TYPE_DEPARTMENT, OID = person.DepartmentOID }).Name; }); return(lPerson); }
public static int ReviseDObject(DObject _param) { int result = -1; DObject targetDobj = DObjectRepository.SelDObject(new DObject { OID = _param.OID }); DObjectRepository.UdtReleaseLatestDObject(new DObject { OID = _param.OID, IsReleasedLatest = 0 }); targetDobj.BPolicyOID = null; targetDobj.Revision = SemsUtil.MakeMajorRevisonUp(targetDobj.Revision); result = DObjectRepository.InsDObject(targetDobj); return(result); }
public static int CopyDObject(DObject _param) { int result = -1; DObject targetDobj = DObjectRepository.SelDObject(new DObject { OID = _param.OID }); targetDobj.BPolicyOID = null; targetDobj.Revision = null; if (_param.Name != null) { targetDobj.Name = _param.Name; } result = DObjectRepository.InsDObject(targetDobj); return(result); }
public static JqTreeModel SelOrganizationWithPerson(List <string> checkitemtypes) { DObject dCompany = DObjectRepository.SelDObject(new DObject { Type = CommonConstant.TYPE_COMPANY }); JqTreeModel jqTreeModel = new JqTreeModel(); jqTreeModel.id = dCompany.OID; jqTreeModel.label = dCompany.Name; jqTreeModel.icon = CommonConstant.ICON_COMPANY; jqTreeModel.iconsize = CommonConstant.DEFAULT_ICONSIZE; jqTreeModel.expanded = true; jqTreeModel.type = CommonConstant.TYPE_COMPANY; jqTreeModel.checkitemtypes = checkitemtypes; List <JqTreeModel> items = new List <JqTreeModel>(); DObject tmpDepartment = null; DRelationshipRepository.SelRelationship(new DRelationship { Type = CommonConstant.RELATIONSHIP_DEPARTMENT, FromOID = dCompany.OID }).ForEach(item => { if (tmpDepartment != null) { tmpDepartment = null; } JqTreeModel innerJqTreeModel = new JqTreeModel(); tmpDepartment = DObjectRepository.SelDObject(new DObject { Type = CommonConstant.TYPE_DEPARTMENT, OID = item.ToOID }); innerJqTreeModel.id = tmpDepartment.OID; innerJqTreeModel.label = tmpDepartment.Name; innerJqTreeModel.icon = CommonConstant.ICON_DEPARTMENT; innerJqTreeModel.iconsize = CommonConstant.DEFAULT_ICONSIZE; innerJqTreeModel.expanded = true; innerJqTreeModel.type = CommonConstant.TYPE_DEPARTMENT; innerJqTreeModel.checkitemtypes = checkitemtypes; SelDepartmentWithPerson(innerJqTreeModel, tmpDepartment, checkitemtypes); items.Add(innerJqTreeModel); }); jqTreeModel.items = items; return(jqTreeModel); }
public static string StatusPromote(bool Transaction, string RelType, string CurrentStatus, int OID, int RootOID, string Action, string Comment) { string result = ""; try { if (Transaction) { DaoFactory.BeginTransaction(); } string checkProgram = StatusCheckPromote(RelType, CurrentStatus, OID, RootOID, Action, Comment); if (checkProgram != null && checkProgram.Length > 0) { throw new Exception(checkProgram); } List <Dictionary <string, string> > actionProgram = BPolicyRepository.SelActionProgram(new BPolicy { Type = RelType, OID = Convert.ToInt32(CurrentStatus) }); if (actionProgram != null && actionProgram.Count > 0) { actionProgram.ForEach(item => { string returnMessage = SemsUtil.Invoke(item[CommonConstant.POLICY_TRIGGER_CLASS], item[CommonConstant.POLICY_TRIGGER_FUNCTION], new string[] { RelType, CurrentStatus, Convert.ToString(OID), Convert.ToString(RootOID), Action, Comment }); if (returnMessage != null && returnMessage.Length > 0) { throw new Exception(returnMessage); } }); } string strNextAction = BPolicyRepository.SelBPolicy(new BPolicy { Type = RelType, OID = Convert.ToInt32(CurrentStatus) }).First().NextActionOID; string strActionOID = ""; if (strNextAction != null) { strNextAction.Split(',').ToList().ForEach(action => { if (action.IndexOf(Action) > -1) { strActionOID = action.Substring(action.IndexOf(":") + 1); return; } }); } DObjectRepository.UdtDObject(new DObject { OID = OID, BPolicyOID = Convert.ToInt32(strActionOID) }); if (Transaction) { DaoFactory.Commit(); } } catch (Exception ex) { if (Transaction) { DaoFactory.Rollback(); } result = ex.Message; } return(result); }