コード例 #1
0
        public JsonResult InsPerson(Person _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();

                DObject dobj = new DObject();
                dobj.Type = CommonConstant.TYPE_PERSON;
                dobj.Name = _param.Name;
                result    = DObjectRepository.InsDObject(dobj);

                _param.OID = result;
                int returnValue = PersonRepository.InsPerson(_param);
                if (returnValue < 0)
                {
                    throw new Exception("ID가 중복입니다.");
                }

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #2
0
        public JsonResult UtpPerson(Person _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();

                DObject dobj = new DObject();
                dobj.Type      = CommonConstant.TYPE_PERSON;
                dobj.Name      = _param.Name;
                dobj.OID       = _param.OID;
                dobj.Thumbnail = _param.Thumbnail;
                DObjectRepository.UdtDObject(dobj);

                PersonRepository.UtpPerson(_param);
                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #3
0
        public JsonResult InsDepartment(JqTreeModel _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();

                DObject dobj = new DObject();
                dobj.Type        = CommonConstant.TYPE_DEPARTMENT;
                dobj.Name        = _param.label;
                dobj.Description = _param.value;
                result           = DObjectRepository.InsDObject(dobj);

                DRelationship dRel = new DRelationship();
                dRel.Type    = CommonConstant.RELATIONSHIP_DEPARTMENT;
                dRel.FromOID = _param.parentId;
                dRel.ToOID   = result;
                DRelationshipRepository.InsDRelationshipNotOrd(dRel);

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #4
0
        public JsonResult InsRole(Role _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();

                DObject dobj = new DObject();
                dobj.Type = CommonConstant.TYPE_ROLE;
                dobj.Name = _param.Name;
                if (DObjectRepository.SelDObject(dobj) != null)
                {
                    throw new Exception("Role 중복입니다.");
                }
                result = DObjectRepository.InsDObject(dobj);
                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #5
0
        public JsonResult DelDepartment(JqTreeModel _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();

                DRelationship dRel = new DRelationship();
                dRel.Type    = CommonConstant.RELATIONSHIP_DEPARTMENT;
                dRel.FromOID = _param.parentId;
                dRel.ToOID   = _param.id;
                result       = DRelationshipRepository.DelDRelationship(dRel);

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #6
0
        public JsonResult DelEOContents(List <EO> _param)
        {
            int resultOid = 0;

            try
            {
                DaoFactory.BeginTransaction();
                if (_param != null && _param.Count > 0)
                {
                    _param.ForEach(obj =>
                    {
                        if (obj != null)
                        {
                            EORepository.delEOContents(obj);
                        }
                    });
                }
                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(resultOid));
        }
コード例 #7
0
        public JsonResult InsProblemsLibrary(ProblemsLibrary _param)
        {
            int resultOid = 0;

            try
            {
                DaoFactory.BeginTransaction();

                DObject dobj = new DObject();
                dobj.Type        = EcontentsConstant.TYPE_ECONTENTS;
                dobj.TableNm     = EcontentsConstant.TABLE_PROBLEMS_LIBRARY;
                dobj.Name        = _param.Name;
                dobj.Description = _param.Description;

                resultOid = DObjectRepository.InsDObject(dobj);

                _param.OID = resultOid;
                DaoFactory.SetInsert("Econtents.InsProblemsLibrary", _param);

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(resultOid));
        }
コード例 #8
0
        public JsonResult UtpDepartment(JqTreeModel _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();

                DObject dobj = new DObject();
                dobj.Type        = CommonConstant.TYPE_DEPARTMENT;
                dobj.OID         = _param.id;
                dobj.Name        = _param.label;
                dobj.Description = _param.value;
                result           = DObjectRepository.UdtDObject(dobj);

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #9
0
        public JsonResult InsertLibrary(Library _param)
        {
            int resultOid = 0;

            try
            {
                DaoFactory.BeginTransaction();
                // DObjectRepository.UdtLatestDObject(new DObject { OID = _param.OID });

                DObject dobj = new DObject();
                dobj.Type        = CommonConstant.TYPE_LIBRARY;
                dobj.TableNm     = CommonConstant.TABLE_LIBRARY;
                dobj.Name        = _param.Name;
                dobj.Description = _param.Description;
                resultOid        = DObjectRepository.InsDObject(dobj);

                _param.OID = resultOid;
                //_param.DocType = _param.DocType;
                //_param.Title = _param.Title;
                //_param.Eo_No = _param.Eo_No;
                DaoFactory.SetInsert("Library.InsLibrary", _param);

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(resultOid));
        }
コード例 #10
0
        public JsonResult InsertChangeOrder(ECO _param)
        {
            int resultOid = 0;

            try
            {
                DaoFactory.BeginTransaction();
                //       DObjectRepository.UdtLatestDObject(new DObject { OID = _param.OID });

                DObject dobj = new DObject();
                dobj.Type        = EoConstant.TYPE_CHANGE_ORDER;
                dobj.TableNm     = EoConstant.TABLE_CHANGE_ORDER;
                dobj.Name        = _param.Name;
                dobj.Description = _param.Description;
                //dobj.TdmxOID = DObjectRepository.SelTdmxOID(new DObject { Type = DocumentContant.TYPE_DOCUMENT });
                resultOid = DObjectRepository.InsDObject(dobj);

                _param.OID = resultOid;
                //_param.DocType = _param.DocType;
                //_param.Title = _param.Title;
                //_param.Eo_No = _param.Eo_No;
                DaoFactory.SetInsert("ChangeOrder.InsChangeOrder", _param);

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(resultOid));
        }
コード例 #11
0
        public JsonResult InsertCalenderDetail(Calendar _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();

                Calendar calendar = DaoFactory.GetData <Calendar>("Manage.SelCalendar", new Calendar {
                    Type = CommonConstant.TYPE_CALENDAR, OID = _param.OID
                });
                List <CalendarDetail> lCalendarDetails = DaoFactory.GetList <CalendarDetail>("Manage.SelCalenderDetail", new CalendarDetail {
                    CalendarOID = calendar.OID
                });
                if (lCalendarDetails != null && lCalendarDetails.Count > 0)
                {
                    DObjectRepository.UdtLatestDObject(new DObject {
                        OID = calendar.OID
                    });
                    DObject dObj = new DObject();
                    dObj.Name    = calendar.Name;
                    dObj.Type    = CommonConstant.TYPE_CALENDAR;
                    dObj.TableNm = CommonConstant.TABLE_CALENDAR;
                    dObj.TdmxOID = calendar.TdmxOID;
                    result       = DObjectRepository.InsDObject(dObj);

                    Calendar tmpCalendar = new Calendar();
                    tmpCalendar.OID        = result;
                    tmpCalendar.WorkingDay = calendar.WorkingDay;
                    DaoFactory.SetInsert("Manage.InsCalendar", tmpCalendar);
                }
                else
                {
                    result = Convert.ToInt32(calendar.OID);
                }

                if (_param.CalendarDetails != null && _param.CalendarDetails.Count > 0)
                {
                    _param.CalendarDetails.ForEach(item =>
                    {
                        item.CalendarOID = result;
                        DaoFactory.SetInsert("Manage.InsCalendarDetail", item);
                    });
                }
                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #12
0
        public JsonResult InsEPart(EPart _param)
        {
            int resultOid = 0;

            try
            {
                DaoFactory.BeginTransaction();
                var check = CreateEPartChk(_param);
                if (check == 1)
                {
                    DaoFactory.Rollback();
                    return(Json(new ResultJsonModel {
                        isError = true, resultMessage = "품번이 이미 존재합니다.", resultDescription = ""
                    }));
                }
                DObject dobj = new DObject();
                dobj.Type        = EBomConstant.TYPE_PART;
                dobj.TableNm     = EBomConstant.TABLE_PART;
                dobj.Name        = _param.Name;
                dobj.Description = _param.Description;
                dobj.Thumbnail   = _param.Thumbnail;
                resultOid        = DObjectRepository.InsDObject(dobj);

                _param.OID = resultOid;

                //_param.Title              = _param.Title;
                //_param.Rep_Part_No        = _param.Rep_Part_No;
                //_param.Rep_Part_No2       = _param.Rep_Part_No2;
                //_param.Eo_No              = _param.Eo_No;
                //_param.Eo_No_ApplyDate    = _param.Eo_No_ApplyDate;
                //_param.Eo_No_History      = _param.Eo_No_History;
                //_param.Etc                = _param.Etc;
                //_param.ApprovOID          = _param.ApprovOID;
                //_param.EPartType          = _param.EPartType;
                //_param.Sel_Eo             = _param.Sel_Eo;
                //_param.Sel_Eo_Date        = _param.Sel_Eo_Date;
                //_param.Spec               = _param.Spec;
                //_param.Surface            = _param.Surface;

                DaoFactory.SetInsert("EBom.InsEPart", _param);

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(resultOid));
        }
コード例 #13
0
        public JsonResult InsertChangeRequest(ECR _param)
        {
            int resultOid = 0;

            try
            {
                DaoFactory.BeginTransaction();

                var YYYY = DateTime.Now.ToString("yyyy");
                var MM   = DateTime.Now.ToString("MM");

                var YY = YYYY.Substring(2, 2);

                DObject dobj = new DObject();
                dobj.Type    = EoConstant.TYPE_CHANGE_REQUEST;
                dobj.TableNm = EoConstant.TABLE_CHANGE_REQUEST;

                var selName = "ECR-" + YY + MM;

                var LateName = ECRRepository.SelChangeRequest(new ECR {
                    Name = selName
                });

                if (LateName.Count == 0)
                {
                    dobj.Name = "ECR-" + YY + MM + "-001";
                }
                else
                {
                    int NUM = Convert.ToInt32(LateName.Last().Name.Substring(9, 3)) + 1;
                    dobj.Name = "ECR-" + YY + MM + "-" + string.Format("{0:D3}", NUM);
                }

                dobj.Description = _param.Description;
                resultOid        = DObjectRepository.InsDObject(dobj);


                _param.OID = resultOid;
                DaoFactory.SetInsert("ChangeRequest.InsChangeRequest", _param);

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(resultOid));
        }
コード例 #14
0
 public JsonResult delCodeLibrary(Library _param)
 {
     try
     {
         DaoFactory.BeginTransaction();
         LibraryRepository.deleteCodeLibrary(_param);
         DaoFactory.Commit();
     }
     catch (Exception ex)
     {
         DaoFactory.Rollback();
         return(Json(new ResultJsonModel {
             isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
         }));
     }
     return(Json(0));
 }
コード例 #15
0
        public JsonResult UdtPwPerson(Person _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();
                PersonRepository.UtpPwPerson(_param);
                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #16
0
        public JsonResult updateLibrary(Library _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();
                result = DObjectRepository.UdtDObject(_param);
                LibraryRepository.updateLibrary(_param);
                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #17
0
        public JsonResult UdtChangeOrder(ECO _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();

                DObjectRepository.UdtDObject(_param);
                ECORepository.UdtChangeOrderObject(_param);

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #18
0
        public JsonResult InsertCodeLibrary(Library _param)
        {
            int resultOid = 0;

            try
            {
                DaoFactory.BeginTransaction();
                // DObjectRepository.UdtLatestDObject(new DObject { OID = _param.OID });

                DaoFactory.SetInsert("Library.InsCodeLibrary", _param);

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(resultOid));
        }
コード例 #19
0
        public JsonResult InsECOContents(List <EO> _param, EO delData)
        {
            int resultOid = 0;

            try
            {
                DaoFactory.BeginTransaction();
                if (delData != null && delData.Type != null && delData.RootOID != null)
                {
                    EORepository.delEOContents(delData);
                }
                //dobj.TdmxOID = DObjectRepository.SelTdmxOID(new DObject { Type = DocumentContant.TYPE_DOCUMENT });
                if (_param != null && _param.Count > 0)
                {
                    _param.ForEach(obj =>
                    {
                        if (obj != null)
                        {
                            EORepository.InsEOContents(obj);
                        }
                    });
                }

                //_param.DocType = _param.DocType;
                //_param.Title = _param.Title;
                //_param.Eo_No = _param.Eo_No;


                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(resultOid));
        }
コード例 #20
0
        public JsonResult InsertCalendar(Calendar _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();
                DObject dObj = new DObject();
                dObj.Name    = _param.Name;
                dObj.Type    = CommonConstant.TYPE_CALENDAR;
                dObj.TableNm = CommonConstant.TABLE_CALENDAR;
                dObj.TdmxOID = DObjectRepository.SelTdmxOID(new DObject {
                    Type = dObj.Type
                });
                dObj.IsLatest = 1;
                int dOid = DObjectRepository.InsDObject(dObj);

                _param.OID = dOid;
                DaoFactory.SetInsert("Manage.InsCalendar", _param);

                List <CalendarDetail> holidayDefault = DaoFactory.GetList <CalendarDetail>("Manage.SelCalendarHolidayDefailt", null);
                holidayDefault.ForEach(item =>
                {
                    item.CalendarOID = dOid;
                    DaoFactory.SetInsert("Manage.InsCalendarDetail", item);
                });
                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #21
0
        public JsonResult PromoteApprovalTask(ApprovalTask _param)
        {
            try
            {
                DaoFactory.BeginTransaction();
                DObjectRepository.StatusPromote(false, CommonConstant.TYPE_APPROVAL_TASK, Convert.ToString(_param.BPolicyOID), Convert.ToInt32(_param.OID), Convert.ToInt32(_param.OID), _param.ActionType, "");
                ApprovalTaskRepository.UdtInboxTask(new ApprovalTask {
                    ActionType = _param.ActionType, Comment = _param.Comment, OID = _param.OID
                });

                if (_param.ActionType == CommonConstant.ACTION_REJECT)
                {
                    Approval tmpApproval = ApprovalRepository.SelApprovalNonStep(new Approval {
                        OID = _param.ApprovalOID
                    });
                    DObjectRepository.StatusPromote(false, CommonConstant.TYPE_APPROVAL, Convert.ToString(tmpApproval.BPolicyOID), Convert.ToInt32(tmpApproval.OID), Convert.ToInt32(tmpApproval.OID), _param.ActionType, "");

                    DObject targetDobj = DObjectRepository.SelDObject(new DObject {
                        OID = tmpApproval.TargetOID
                    });
                    DObjectRepository.StatusPromote(false, targetDobj.Type, Convert.ToString(targetDobj.BPolicyOID), Convert.ToInt32(targetDobj.OID), Convert.ToInt32(targetDobj.OID), _param.ActionType, "");
                    DaoFactory.Commit();
                    return(Json(CommonConstant.RETURN_SUCCESS));
                }

                bool         allSuccess      = true;
                ApprovalStep tmpApprovalStep = ApprovalStepRepository.SelApprovalStep(new ApprovalStep {
                    OID = _param.StepOID
                });
                tmpApprovalStep.InboxTask.ForEach(task =>
                {
                    if (task.BPolicy.Name != CommonConstant.POLICY_APPROVAL_COMPLETED)
                    {
                        allSuccess = false;
                    }
                });

                if (allSuccess)
                {
                    Approval tmpApproval = ApprovalRepository.SelApprovalNonStep(new Approval {
                        OID = _param.ApprovalOID
                    });
                    int cntCurrent = Convert.ToInt32(tmpApproval.CurrentNum);
                    cntCurrent += 1;
                    if (tmpApproval.ApprovalCount >= cntCurrent)
                    {
                        ApprovalRepository.UdtApproval(new Approval {
                            CurrentNum = cntCurrent, OID = tmpApproval.OID
                        });
                        ApprovalRepository.SelApproval(new Approval {
                            OID = tmpApproval.OID
                        }).InboxStep.Find(step => step.Ord == cntCurrent).InboxTask.ForEach(task =>
                        {
                            DObjectRepository.StatusPromote(false, CommonConstant.TYPE_APPROVAL_TASK, Convert.ToString(task.BPolicyOID), Convert.ToInt32(task.OID), Convert.ToInt32(task.OID), _param.ActionType, "");
                        });
                    }
                    else if (tmpApproval.ApprovalCount < cntCurrent)
                    {
                        ApprovalRepository.UdtApproval(new Approval {
                            CurrentNum = cntCurrent, OID = tmpApproval.OID
                        });
                        DObjectRepository.StatusPromote(false, CommonConstant.TYPE_APPROVAL, Convert.ToString(tmpApproval.BPolicyOID), Convert.ToInt32(tmpApproval.OID), Convert.ToInt32(tmpApproval.OID), _param.ActionType, "");

                        DObject targetDobj = DObjectRepository.SelDObject(new DObject {
                            OID = tmpApproval.TargetOID
                        });
                        DObjectRepository.StatusPromote(false, targetDobj.Type, Convert.ToString(targetDobj.BPolicyOID), Convert.ToInt32(targetDobj.OID), Convert.ToInt32(targetDobj.OID), _param.ActionType, "");
                    }
                }
                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(CommonConstant.RETURN_SUCCESS));
        }
コード例 #22
0
        public JsonResult InsApproval(Approval _param)
        {
            int result = 0;

            try
            {
                DaoFactory.BeginTransaction();

                DObject dobj = new DObject();
                if (_param.TargetOID == null)
                {
                    dobj.Type = CommonConstant.TYPE_SAVE_APPROVAL;
                    dobj.Name = _param.Name;
                }
                else
                {
                    dobj.Type = CommonConstant.TYPE_APPROVAL;
                    string strApprovalPrefix = dobj.Type + "-" + DateTime.Now.ToString("yyyyMMdd") + "-";
                    dobj.Name = strApprovalPrefix + SemsUtil.MakeSeq(DObjectRepository.SelNameSeq(new DObject {
                        Type = CommonConstant.TYPE_APPROVAL, Name = strApprovalPrefix + "%"
                    }), "000");
                    dobj.Description = _param.Description;
                }
                dobj.TableNm = CommonConstant.TABLE_APPROVAL;
                result       = DObjectRepository.InsDObject(dobj);

                _param.OID           = result;
                _param.ApprovalCount = _param.InboxStep.FindAll(step => step.ApprovalType.Equals(CommonConstant.TYPE_APPROVAL_APPROV) || step.ApprovalType.Equals(CommonConstant.TYPE_APPROVAL_AGREE)).Count;
                ApprovalRepository.InsApproval(_param);

                List <int> lPromoteOID = new List <int>();
                int        index       = 0;
                _param.InboxStep.ForEach(step =>
                {
                    step.ApprovalOID = result;
                    int stepResult   = ApprovalStepRepository.InsApprovalStep(step);

                    step.InboxTask.ForEach(task =>
                    {
                        if (dobj != null)
                        {
                            dobj = null;
                        }
                        dobj                     = new DObject();
                        dobj.Type                = CommonConstant.TYPE_APPROVAL_TASK;
                        dobj.TableNm             = CommonConstant.TABLE_APPROVAL_TASK;
                        string strApprovalPrefix = dobj.Type + "-" + DateTime.Now.ToString("yyyyMMdd") + "-";
                        dobj.Name                = strApprovalPrefix + SemsUtil.MakeSeq(DObjectRepository.SelNameSeq(new DObject {
                            Type = CommonConstant.TYPE_APPROVAL_TASK, Name = strApprovalPrefix + "%"
                        }), "000");
                        int taskResult = DObjectRepository.InsDObject(dobj);

                        task.ApprovalOID = result;
                        task.StepOID     = stepResult;
                        task.OID         = taskResult;
                        ApprovalTaskRepository.InsInboxTask(task);

                        if (index == 0)
                        {
                            lPromoteOID.Add(taskResult);
                        }
                    });
                    index++;
                });

                if (_param.TargetOID != null)
                {
                    DObject targetDobj = DObjectRepository.SelDObject(new DObject {
                        OID = _param.TargetOID
                    });
                    DObjectRepository.StatusPromote(false, targetDobj.Type, Convert.ToString(targetDobj.BPolicyOID), Convert.ToInt32(targetDobj.OID), Convert.ToInt32(targetDobj.OID), CommonConstant.ACTION_PROMOTE, null);
                    if (lPromoteOID != null && lPromoteOID.Count > 0)
                    {
                        lPromoteOID.ForEach(promoteOID =>
                        {
                            if (dobj != null)
                            {
                                dobj = null;
                            }
                            dobj = DObjectRepository.SelDObject(new DObject {
                                OID = promoteOID
                            });
                            DObjectRepository.StatusPromote(false, dobj.Type, Convert.ToString(dobj.BPolicyOID), Convert.ToInt32(dobj.OID), Convert.ToInt32(dobj.OID), CommonConstant.ACTION_PROMOTE, null);
                        });

                        DObject approvDobj = DObjectRepository.SelDObject(new DObject {
                            OID = result
                        });
                        DObjectRepository.StatusPromote(false, approvDobj.Type, Convert.ToString(approvDobj.BPolicyOID), Convert.ToInt32(approvDobj.OID), Convert.ToInt32(approvDobj.OID), CommonConstant.ACTION_PROMOTE, null);
                    }
                    ApprovalRepository.UdtApproval(new Approval {
                        OID = result, CurrentNum = 1
                    });
                }

                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(result));
        }
コード例 #23
0
ファイル: DObject.cs プロジェクト: Seonghyun-Kim/SemsPLM
        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);
        }