Example #1
0
        public bool UpdateStage(PmsHead pmsHead, PmsChangeHistory pmsChangeHistory)
        {
            try
            {
                m_PMSSqlConnection.BeginTransaction();

                if (!UpdatePmsHeadOther(pmsHead))
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    m_Logger.Error("PmsHeadBiz/UpdateStage/UpdatePmsHeadOther");
                    return(false);
                }
                PmsChangeHistoryBiz pmsChangeHistoryBiz = new PmsChangeHistoryBiz();
                int result = pmsChangeHistoryBiz.InsertPmsChangeHistory(pmsChangeHistory);
                if (result == 0)
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    m_Logger.Error("PmsHeadBiz/UpdateStage/InsertPmsChangeHistory");
                    return(false);
                }
                m_PMSSqlConnection.CommitTransaction();

                return(true);
            }
            catch (Exception ex)
            {
                m_PMSSqlConnection.RollBackTransaction();
                m_Logger.Error("PmsHeadBiz/UpdateStage:" + ex.ToString());
                return(false);
            }
        }
Example #2
0
        public int InsertPmsHeadAndDoc(PmsHead pmsHead, SdpDetail sdpDetail, PmsChangeHistory pmsChangeHistory, PmsItarmMapping pmsItarmMapping,
                                       PmsFlow pmsFlow, ItarmCrList itarmCrList, IList <PmsDocuments> listPmsDocuments, out string errorInfo)
        {
            errorInfo = string.Empty;
            int returnResult = 0;

            try
            {
                m_PMSSqlConnection.BeginTransaction();

                #region Insert PmsHead
                //string type = pmsHead.PmsName.GetTypeCode;
                m_PMSSqlConnection.Insert("InsertPmsHead", pmsHead);
                #endregion

                #region Insert PmsItarmMapping
                PmsItarmMappingBiz pmsItarmMappingBiz = new PmsItarmMappingBiz();
                pmsItarmMappingBiz.InsertPmsItarmMapping(pmsItarmMapping);
                #endregion

                #region Insert PmsDocuments

                if (listPmsDocuments != null)
                {
                    foreach (PmsDocuments pmsDocuments in listPmsDocuments)
                    {
                        if (pmsDocuments.DocTypeId == 0)
                        {
                            errorInfo = "DocTypeId is Invalid!";
                            return(returnResult);
                        }

                        if (pmsDocuments.FileName == string.Empty)
                        {
                            errorInfo = "FileName is Empty!";
                            return(returnResult);
                        }

                        if (pmsDocuments.FileName != string.Empty)
                        {
                            m_PMSSqlConnection.Insert("InsertPmsDocuments", pmsDocuments);
                        }
                    }
                }


                #endregion

                #region Insert SdpDetail
                SdpDetailBiz sdpDetailBiz = new SdpDetailBiz();
                returnResult = sdpDetailBiz.InsertSdpDetailByTemplate(sdpDetail);

                if (returnResult == 0)
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    return(returnResult);
                }
                #endregion

                #region Insert PmsChangeHistory
                PmsChangeHistoryBiz pmsChangeHistoryBiz = new PmsChangeHistoryBiz();
                pmsChangeHistoryBiz.InsertPmsChangeHistory(pmsChangeHistory);
                #endregion

                #region Insert PmsFlow
                PmsFlowBiz pmsFlowBiz = new PmsFlowBiz();
                pmsFlowBiz.InsertPmsFlow(pmsFlow);
                #endregion

                #region Insert ItarmCrList
                bool resultInsertItarm = new PmsCRCreatBiz().InsertItarmCrList(itarmCrList);
                if (!resultInsertItarm)
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    errorInfo = "Save Fail";
                    return(0);
                }
                #endregion

                m_PMSSqlConnection.CommitTransaction();
            }
            catch (Exception ex)
            {
                m_PMSSqlConnection.RollBackTransaction();
                errorInfo = "Save Fail";
                m_Logger.Error("PmsHeadBiz/InsertPmsHeadAndDoc" + ex.Message.ToString());
            }

            return(returnResult);
        }