示例#1
0
        public async Task UpdateAllNegotiationWaitingSupplierResponse()
        {
            var allNegotiations = await _communicationRequestJobQueries.FindAllNegotiationWaitingSupplierResponse();

            foreach (var NEG in allNegotiations)
            {
                var currentSupplier = NEG.NegotiationFirstStageSuppliers.FirstOrDefault(w => w.NegotiationSupplierStatusId == (int)Enums.enNegotiationSupplierStatus.PendeingSupplierReply);
                if (currentSupplier == null || DateTime.Now.Subtract(currentSupplier.PeriodStartDateTime.Value).TotalHours < NEG.SupplierReplyPeriodHours)
                {
                    continue;
                }
                NEG.UpdateSupplierStatus(currentSupplier.Id, (int)Enums.enNegotiationSupplierStatus.NoReply, null);

                var _notInvitedSuppliers = NEG.NegotiationFirstStageSuppliers.Where(w => w.NegotiationSupplierStatusId == (int)Enums.enNegotiationSupplierStatus.NotSent).OrderBy(d => d.Offer.FinalPriceAfterDiscount).ToList();
                var Next = _notInvitedSuppliers.FirstOrDefault();
                if (Next != null)
                {
                    Next.StartSupplierPeriodService();
                    var SuppliersCRs = Next.SupplierCR;
                    var _offer       = await _communicationRequestJobQueries.GetOfferById(Next.OfferId);

                    var _tender = await _communicationRequestJobQueries.FindTenderByTenderId(_offer.TenderId);

                    var _supplier = await _communicationRequestJobQueries.FindSupplierByCRNumber(_offer.CommericalRegisterNo);



                    NotificationArguments NotificationArgumentsforSupplier = new NotificationArguments
                    {
                        BodyEmailArgs    = new object[] { _supplier.SelectedCrName, _tender.TenderName },
                        SubjectEmailArgs = new object[] { },
                        PanelArgs        = new object[] { _supplier.SelectedCrName, _tender.TenderName },
                        SMSArgs          = new object[] { _supplier.SelectedCrName, _tender.TenderName }
                    };

                    MainNotificationTemplateModel mainNotificationTemplateModelforSupplier = new MainNotificationTemplateModel(NotificationArgumentsforSupplier,
                                                                                                                               $"CommunicationRequest/SupplierNegotiation/{Util.Encrypt(_offer.TenderId)}/{Util.Encrypt(NEG.NegotiationId)}",
                                                                                                                               NotificationEntityType.Tender,
                                                                                                                               _offer.TenderId.ToString(), null, _tender.OffersCheckingCommitteeId);

                    _communicationRequestJobQueries.UpdateNegotiationFirstStage(NEG);
                    await _communicationRequestJobQueries.SaveChanges();

                    await _notificationJobAppService.SendNotificationForSuppliers(NotificationOperations.Supplier.AgencyCommunicationRequest.SendNegotiationToSupplier, new List <string> {
                        SuppliersCRs
                    }, mainNotificationTemplateModelforSupplier);
                }
                else
                {
                    NEG.UpdateNegotiationFirstStageStatus((int)Enums.enNegotiationStatus.SupplierNotAgreed, "");
                    _communicationRequestJobQueries.UpdateNegotiationFirstStage(NEG);
                    await _communicationRequestJobQueries.SaveChanges();
                }
            }
        }
示例#2
0
        public async Task UpdateAllSecondNegotiationWaitingSupplierResponse()
        {
            var allNegotiations = await _communicationRequestJobQueries.FindAllSecondNegotiationWaitingSupplierResponse();

            var agencies = await _communicationRequestJobQueries.FindAgenciesByAgencyCodes(allNegotiations.Select(d => d.AgencyCommunicationRequest.Tender.AgencyCode).Distinct().ToList());

            int?agencyCategoryId = 0;

            foreach (var NEG in allNegotiations)
            {
                agencyCategoryId = agencies.Where(a => a.AgencyCode == NEG.AgencyCommunicationRequest.Tender.AgencyCode).FirstOrDefault().CategoryId;

                NEG.UpdateNegotiationStatus((int)Enums.enNegotiationStatus.SupplierNotAgreed);

                #region [Send Approval To Agency]
                int?   committeId = NEG.AgencyCommunicationRequest.Tender.OffersCheckingCommitteeId;
                string userRole   = Enums.UserRole.NewMonafasat_OffersCheckSecretary.ToString();
                int    codeId     = NotificationOperations.OffersCheckSecretary.AgencyCommunicationRequest.RecectSecondNegotiationSupplier;
                if (NEG.AgencyCommunicationRequest.Tender.TenderTypeId == (int)Enums.TenderType.CurrentDirectPurchase || NEG.AgencyCommunicationRequest.Tender.TenderTypeId == (int)Enums.TenderType.NewDirectPurchase)
                {
                    committeId = NEG.AgencyCommunicationRequest.Tender.DirectPurchaseCommitteeId;
                    userRole   = Enums.UserRole.NewMonafasat_SecretaryDirtectPurshasingCommittee.ToString();
                    codeId     = NotificationOperations.DirectPurchaseSecretary.AgencyCommunicationRequest.RecectSecondNegotiationSupplier;
                }
                await _communicationRequestJobQueries.UpdateNegotiationAsync(NEG);

                NotificationArguments NotificationArguments = new NotificationArguments
                {
                    BodyEmailArgs    = new object[] { "", NEG.AgencyCommunicationRequest.Tender.ReferenceNumber },
                    SubjectEmailArgs = new object[] { },
                    PanelArgs        = new object[] { "", NEG.AgencyCommunicationRequest.Tender.ReferenceNumber },
                    SMSArgs          = new object[] { "", NEG.AgencyCommunicationRequest.Tender.ReferenceNumber }
                };

                MainNotificationTemplateModel mainNotificationTemplateModel = new MainNotificationTemplateModel(NotificationArguments,
                                                                                                                $"CommunicationRequest/CreateSecondNegotiationRequestAsync/{Util.Encrypt(NEG.NegotiationId)}",
                                                                                                                NotificationEntityType.Tender,
                                                                                                                NEG.AgencyCommunicationRequest.Tender.TenderId.ToString(), NEG.AgencyCommunicationRequest.Tender.BranchId, committeId);
                await _notificationJobAppService.SendNotifications(codeId, NEG.AgencyCommunicationRequest.Tender.AgencyCode, agencyCategoryId.Value, mainNotificationTemplateModel, userRole, committeId.Value, 0);

                #endregion
                await _communicationRequestJobQueries.UpdateNegotiationSecondStageAsync(NEG);
            }
            await _communicationRequestJobQueries.SaveChanges();
        }
示例#3
0
        public static void AssociateOpcodes()
        {
            instructions[0] = new NOP();
            instructions[1] = new PRNT();

            instructions[16] = new PUSH();
            instructions[17] = new POP();
            instructions[18] = new SAVE();
            instructions[19] = new CPY();
            instructions[20] = new RNDM();
            instructions[21] = new EMPTY();

            instructions[128] = new ADD();
            instructions[129] = new SUB();
            instructions[130] = new MUL();
            instructions[131] = new DIV();

            instructions[132] = new SUB2();
            instructions[133] = new DIV2();

            instructions[134] = new NEG();
            instructions[135] = new ABS();

            instructions[144] = new INC();
            instructions[145] = new DEC();

            instructions[64] = new JMP();
            instructions[65] = new JGZ();
            instructions[66] = new JLZ();
            instructions[67] = new JEZ();
            instructions[68] = new JNZ();
            instructions[69] = new CALL();
            instructions[70] = new RET();
            instructions[71] = new LDLOC();
            instructions[72] = new STLOC();
            instructions[73] = new LDARG();
            instructions[74] = new STARG();

            instructions[0b10100100] = new CMP();
示例#4
0
 public AnonymousInstruction(NEG parent)
 {
     this.parent = parent;
 }
示例#5
0
        private void initOperators()
        {
            setName(NEG, "-");
            operators[NEG.operatorIndex()] = new[] {
                unary(NEG, TypeTag.INT, TypeTag.INT),
                unary(NEG, TypeTag.LONG, TypeTag.LONG),
                unary(NEG, TypeTag.FLOAT, TypeTag.DOUBLE),
                unary(NEG, TypeTag.DOUBLE, TypeTag.DOUBLE),
            };

            setName(NOT, "!");
            operators[NOT.operatorIndex()] = new[] {
                unary(NOT, TypeTag.BOOLEAN, TypeTag.BOOLEAN)
            };

            setName(COMPL, "~");
            operators[COMPL.operatorIndex()] = new[] {
                unary(COMPL, TypeTag.INT, TypeTag.INT),
                unary(COMPL, TypeTag.LONG, TypeTag.LONG)
            };

            setName(PRE_INC, "++");
            operators[PRE_INC.operatorIndex()] = new[] {
                unary(PRE_INC, TypeTag.INT, TypeTag.INT, LLVMAdd),
                unary(PRE_INC, TypeTag.LONG, TypeTag.LONG, LLVMAdd),
                unary(PRE_INC, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFAdd),
                unary(PRE_INC, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFAdd)
            };

            setName(PRE_DEC, "--");
            operators[PRE_DEC.operatorIndex()] = new[] {
                unary(PRE_DEC, TypeTag.INT, TypeTag.INT, LLVMSub),
                unary(PRE_DEC, TypeTag.LONG, TypeTag.LONG, LLVMSub),
                unary(PRE_DEC, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFSub),
                unary(PRE_DEC, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFSub)
            };

            setName(POST_INC, "++");
            operators[POST_INC.operatorIndex()] = new[] {
                unary(POST_INC, TypeTag.INT, TypeTag.INT, LLVMAdd),
                unary(POST_INC, TypeTag.LONG, TypeTag.LONG, LLVMAdd),
                unary(POST_INC, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFAdd),
                unary(POST_INC, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFAdd)
            };

            setName(POST_DEC, "--");
            operators[POST_DEC.operatorIndex()] = new[] {
                unary(POST_DEC, TypeTag.INT, TypeTag.INT, LLVMSub),
                unary(POST_DEC, TypeTag.LONG, TypeTag.LONG, LLVMSub),
                unary(POST_DEC, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFSub),
                unary(POST_DEC, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFSub)
            };

            setName(OR, "||");
            operators[OR.operatorIndex()] = new[] {
                binary(OR, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMOr),
            };

            setName(AND, "&&");
            operators[AND.operatorIndex()] = new[] {
                binary(AND, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMAnd),
            };

            // Order of combination listing for binary operators matters for correct resolution
            // More assignable types must be listed after less assignable ones,
            // which is the order listed in the TypeTag enum.

            setName(BITOR, "|");
            operators[BITOR.operatorIndex()] = new[] {
                binary(BITOR, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMOr),
                binary(BITOR, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMOr),
                binary(BITOR, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMOr),
            };

            setName(BITXOR, "^");
            operators[BITXOR.operatorIndex()] = new[] {
                binary(BITXOR, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMXor),
                binary(BITXOR, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMXor),
                binary(BITXOR, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMXor),
            };

            setName(BITAND, "&");
            operators[BITAND.operatorIndex()] = new[] {
                binary(BITAND, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMAnd),
                binary(BITAND, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMAnd),
                binary(BITAND, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMAnd),
            };

            setName(EQ, "==");
            operators[EQ.operatorIndex()] = new[] {
                binary(EQ, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMICmp, LLVMIntEQ),
                binary(EQ, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntEQ),
                binary(EQ, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntEQ),
                binary(EQ, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntEQ),
                binary(EQ, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOEQ),
                binary(EQ, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOEQ),
            };

            setName(NEQ, "!=");
            operators[NEQ.operatorIndex()] = new[] {
                binary(NEQ, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMICmp, LLVMIntNE),
                binary(NEQ, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntNE),
                binary(NEQ, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntNE),
                binary(NEQ, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntNE),
                binary(NEQ, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealONE),
                binary(NEQ, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealONE),
            };

            setName(LT, "<");
            operators[LT.operatorIndex()] = new[] {
                binary(LT, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntULT),
                binary(LT, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSLT),
                binary(LT, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSLT),
                binary(LT, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOLT),
                binary(LT, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOLT),
            };

            setName(GT, ">");
            operators[GT.operatorIndex()] = new[] {
                binary(GT, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntUGT),
                binary(GT, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSGT),
                binary(GT, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSGT),
                binary(GT, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOGT),
                binary(GT, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOGT),
            };

            setName(LE, "<=");
            operators[LE.operatorIndex()] = new[] {
                binary(LE, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntULE),
                binary(LE, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSLE),
                binary(LE, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSLE),
                binary(LE, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOLE),
                binary(LE, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOLE),
            };

            setName(GE, ">=");
            operators[GE.operatorIndex()] = new[] {
                binary(GE, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntUGE),
                binary(GE, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSGE),
                binary(GE, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSGE),
                binary(GE, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOGE),
                binary(GE, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOGE),
            };

            setName(SHL, "<<");
            operators[SHL.operatorIndex()] = new[] {
                binary(SHL, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMShl),
                binary(SHL, TypeTag.INT, TypeTag.LONG, TypeTag.INT, LLVMShl),
                binary(SHL, TypeTag.LONG, TypeTag.INT, TypeTag.LONG, LLVMShl),
                binary(SHL, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMShl),
            };

            setName(SHR, ">>");
            operators[SHR.operatorIndex()] = new[] {
                binary(SHR, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMLShr),
                binary(SHR, TypeTag.INT, TypeTag.LONG, TypeTag.INT, LLVMLShr),
                binary(SHR, TypeTag.LONG, TypeTag.INT, TypeTag.LONG, LLVMLShr),
                binary(SHR, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMLShr),
            };

            setName(PLUS, "+");
            operators[PLUS.operatorIndex()] = new[] {
                binary(PLUS, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMAdd),
                binary(PLUS, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMAdd),
                binary(PLUS, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFAdd),
                binary(PLUS, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFAdd),
            };

            setName(MINUS, "-");
            operators[MINUS.operatorIndex()] = new[] {
                binary(MINUS, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMSub),
                binary(MINUS, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMSub),
                binary(MINUS, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFSub),
                binary(MINUS, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFSub),
            };

            setName(MUL, "*");
            operators[MUL.operatorIndex()] = new[] {
                binary(MUL, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMMul),
                binary(MUL, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMMul),
                binary(MUL, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFMul),
                binary(MUL, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFMul),
            };

            setName(DIV, "/");
            operators[DIV.operatorIndex()] = new[] {
                binary(DIV, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMSDiv),
                binary(DIV, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMSDiv),
                binary(DIV, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFDiv),
                binary(DIV, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFDiv),
            };

            setName(MOD, "%");
            operators[MOD.operatorIndex()] = new[] {
                binary(MOD, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMSRem),
                binary(MOD, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMSRem),
                binary(MOD, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFRem),
                binary(MOD, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFRem),
            };
        }