Exemplo n.º 1
0
        public ReturnValueInfo Save(IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
        {
            ReturnValueInfo returnInfo = new ReturnValueInfo(false);
            SignalLightsStatus_sls_Info newObj = itemEntity as SignalLightsStatus_sls_Info;
            SignalLightsStatus_sls_Info cond = new SignalLightsStatus_sls_Info();
            try
            {
                switch (EditMode)
                {
                    case Common.DefineConstantValue.EditStateEnum.OE_Insert:

                        cond.sls_cStatus = newObj.sls_cStatus;
                        var newExist = this._signalLightsStatusDA.SearchRecords(cond);
                        if (newExist.Count > 0)
                        {
                            throw new Exception("此工程狀態已經設置控制信號,不能重複設置。");
                        }
                        newObj.sls_cRecordID = Guid.NewGuid();
                        returnInfo.boolValue = this._signalLightsStatusDA.InsertRecord(newObj);

                        break;
                    case Common.DefineConstantValue.EditStateEnum.OE_Update:

                        cond.sls_cStatus = newObj.sls_cStatus;
                        var oldObjs = this._signalLightsStatusDA.SearchRecords(cond);
                        if (oldObjs.Count > 0)
                        {
                            throw new Exception("此工程狀態已經設置控制信號,不能重複設置。");
                        }

                        returnInfo.boolValue = this._signalLightsStatusDA.UpdateRecord(newObj);

                        break;
                    case Common.DefineConstantValue.EditStateEnum.OE_Delete:

                        returnInfo.boolValue = this._signalLightsStatusDA.DeleteRecord(itemEntity as SignalLightsStatus_sls_Info);

                        break;
                    case Common.DefineConstantValue.EditStateEnum.OE_ReaOnly:
                        break;
                    default:
                        break;
                }
            }
            catch (Exception Ex)
            {

                throw Ex;
            }

            return returnInfo;
        }
Exemplo n.º 2
0
        public ReturnValueInfo SaveGroup(IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
        {
            ReturnValueInfo returnInfo = new ReturnValueInfo(false);
            if (itemEntity is SignalStatusGroup_ssg_Info)
            {
                SignalStatusGroup_ssg_Info group = (SignalStatusGroup_ssg_Info)itemEntity;
                try
                {
                    switch (EditMode)
                    {
                        case Common.DefineConstantValue.EditStateEnum.OE_Insert:
                            returnInfo.boolValue = ((SignalLightsStatusDA)this._signalLightsStatusDA).InsertGroup(group);
                            break;
                        case Common.DefineConstantValue.EditStateEnum.OE_Update:
                            returnInfo.boolValue = ((SignalLightsStatusDA)this._signalLightsStatusDA).UpdateGroup(group);
                            break;
                        case Common.DefineConstantValue.EditStateEnum.OE_Delete:
                            returnInfo.boolValue = ((SignalLightsStatusDA)this._signalLightsStatusDA).DeleteGroup(group);
                            break;
                        case Common.DefineConstantValue.EditStateEnum.OE_ReaOnly:
                            break;
                        default:
                            break;
                    }
                }
                catch (Exception Ex)
                {

                    throw Ex;
                }
            }
            return returnInfo;
        }
Exemplo n.º 3
0
        public ReturnValueInfo SaveGroupSignalStatus(IModelObject itemEntity, Guid parentId, Common.DefineConstantValue.EditStateEnum EditMode)
        {
            ReturnValueInfo returnInfo = new ReturnValueInfo(false);
            if (itemEntity is SignalLightsStatus_sls_Info)
            {
                SignalLightsStatus_sls_Info status = (SignalLightsStatus_sls_Info)itemEntity;
                try
                {
                    switch (EditMode)
                    {
                        case Common.DefineConstantValue.EditStateEnum.OE_Insert:
                            //returnInfo.boolValue = ((SignalLightsStatusDA)this._signalLightsStatusDA).CheckGroupSignalStatus(status, parentId);
                            //if (returnInfo.boolValue)
                            //{
                            returnInfo.boolValue = ((SignalLightsStatusDA)this._signalLightsStatusDA).InsertGroupSignalStatus(status, parentId);
                            //}
                            //else returnInfo.messageText = "信號狀態重複";
                            break;
                        case Common.DefineConstantValue.EditStateEnum.OE_Update:
                            //returnInfo.boolValue = ((SignalLightsStatusDA)this._signalLightsStatusDA).CheckGroupSignalStatus(status, parentId);
                            //if (returnInfo.boolValue)
                            //{
                            returnInfo.boolValue = ((SignalLightsStatusDA)this._signalLightsStatusDA).UpdateGroupSignalStatus(status);
                            //}else returnInfo.messageText = "信號狀態重複";
                            break;
                        case Common.DefineConstantValue.EditStateEnum.OE_Delete:
                            returnInfo.boolValue = ((SignalLightsStatusDA)this._signalLightsStatusDA).DeleteGroupSignalStatus(status);
                            break;
                        case Common.DefineConstantValue.EditStateEnum.OE_ReaOnly:
                            break;
                        default:
                            break;
                    }
                }
                catch (Exception Ex)
                {

                    throw Ex;
                }
            }
            return returnInfo;
        }
Exemplo n.º 4
0
        public Model.General.ReturnValueInfo Save(Model.IModel.IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
        {
            Model.General.ReturnValueInfo returnValue = new Model.General.ReturnValueInfo();
            PrepareProjectMaster_ppm_Info info = new PrepareProjectMaster_ppm_Info();
            returnValue.messageText = "";
            info = itemEntity as PrepareProjectMaster_ppm_Info;
            try
            {
                switch (EditMode)
                {
                    case Common.DefineConstantValue.EditStateEnum.OE_Insert:
                        bool isExist = false;

                        isExist = _prepareProjectMasterDA.IsExistRecord(info);
                        if (!isExist)
                        {

                            returnValue.boolValue = _prepareProjectMasterDA.InsertRecord(info);
                            _prepareProjectMasterDA.RepairRepeatSeq();
                        }
                        else
                        {
                            returnValue.boolValue = false;
                            returnValue.messageText = "準備項目編碼重复!";
                        }
                        break;
                    case Common.DefineConstantValue.EditStateEnum.OE_Update:

                        returnValue.boolValue = _prepareProjectMasterDA.UpdateRecord(info);
                        _prepareProjectMasterDA.RepairRepeatSeq();
                        if (returnValue.boolValue)
                        {
                            returnValue.messageText = "更新数据时出错!";
                        }
                        break;
                    case Common.DefineConstantValue.EditStateEnum.OE_Delete:
                        returnValue.boolValue = _prepareProjectMasterDA.DeleteRecord(info);
                        if (returnValue.boolValue)
                        {
                            returnValue.messageText = "删除数据时出错!";
                        }
                        break;
                    default:
                        break;
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return returnValue;
        }