예제 #1
0
        public void addADR()
        {
            ADR _ADR = new ADR
            {
                ADRName     = "Name",
                ADRAddress  = "address1",
                ADRAddress2 = "address2",
                ADRCity     = "city1",
                ADRStateID  = 1,
                ADRZip      = "12343",
            };
            var _id = _IADRRepository.addADR(_ADR);

            Assert.IsTrue(_id > 0, "failed");
        }
예제 #2
0
        public void updateADR()
        {
            ADR _ADR = new ADR
            {
                ADRName     = "Nameeqwqew",
                ADRAddress  = "address1ewe",
                ADRAddress2 = "address2eqwewq",
                ADRCity     = "city1wqewq",
                ADRStateID  = 2,
                ADRZip      = "12133",
                ADRID       = 1
            };
            var _id = _IADRRepository.updateADR(_ADR);

            Assert.IsTrue(_id > 0, "failed");
        }
예제 #3
0
        public ActionResult SaveADRDetail(ADR _ADR)
        {
            var message = GlobalConst.ConstantChar.StringBlank;

            try
            {
                _ADR.ADRName = _ADR.ADRName.Trim();
                if (_ADR.ADRID != GlobalConst.ConstantChar.Zero)
                {
                    if (_iPaticipantService.updateADR(Mapper.Map <MMCService.PaticipantService.ADR>(_ADR)) > GlobalConst.ConstantChar.Zero)
                    {
                        message = GlobalConst.Message.UpdateMessage;
                    }
                    else
                    {
                        message = GlobalConst.Message.ErrorMessage;
                    }
                }
                else
                {
                    if (_iPaticipantService.addADR(Mapper.Map <MMCService.PaticipantService.ADR>(_ADR)) > GlobalConst.ConstantChar.Zero)
                    {
                        message = GlobalConst.Message.SaveMessage;
                    }
                    else
                    {
                        message = GlobalConst.Message.ErrorMessage;
                    }
                }
            }
            catch
            {
                message = GlobalConst.Message.ErrorMessage;
            }
            return(Json(message));
        }
예제 #4
0
 public BasicMessage()
 {
     _SYNC = sync;
     _ADR = ADR.BillValidator;
     _DATA = new List<byte>();
     _CMD = CMD.NO_COMMAND;
     _LNG = 6;
     _CRC = GetMessageCRC16(null);
     _MSG = GetFormedMessage();
     _MSG_RESPONSE = new List<byte>();
     _TEXT_RESPONSE = new List<string>();
     _responseType = RESPONSE_TYPE.DATA;
     _minResponseLength = 6;
     _maxResponseLength = _minResponseLength;
     _responseStatusString = string.Empty;
 }
예제 #5
0
        //fetch operand-> pune in A si M operanzii
        int FO(int MA, string operand)
        {
            //cu aj dec_reg care are return int
            if (MA == 0)//imediata
            {
                int op = Int32.Parse(operand);
                return(op);
            }
            else if (MA == 1)//directa
            {
                operand = operand.Replace("r", string.Empty);
                int op = Int32.Parse(operand);
                INDEX_RG = op;
                return(R[op]);
            }
            else if (MA == 2)
            {
                //mem*R[operand]
                operand = operand.Replace("(r", string.Empty);
                operand = operand.Replace(")", string.Empty);
                int op     = Int32.Parse(operand);
                int pt_mem = R[op];
                op = Mm[pt_mem];

                MEMtxt.BackColor  = Color.SandyBrown;
                MBUStxt.BackColor = Color.SandyBrown;
                ADR = op;
                ADRtxt.BackColor = Color.SandyBrown;
                return(op);
            }
            else if (MA == 3)
            {
                //index* mem(r[op])
                string Rg     = operand;
                int    indexi = operand.IndexOf('(');
                int    indexj = operand.IndexOf(')');

                Rg = Rg.Substring(operand.IndexOf('(') + 2, operand.IndexOf(')') - 3);
                string[] operand_split = operand.Split('(');

                string string_index = operand_split[0];
                int    index        = Int32.Parse(string_index);


                int operand_decod = decod_reg(Rg);

                indexi = operand.IndexOf('(') + 1; // dupa prima paranteza
                indexj = operand.IndexOf(')') - 2; // inainte de a doua paranteza

                operand = operand.Substring(indexi, indexj);
                operand = operand.Replace("r", string.Empty);
                int op   = Int32.Parse(operand);
                int suma = R[op] + index;
                // operand = null;

                MEMtxt.BackColor = Color.SandyBrown;
                ADR               = suma;
                ADRtxt.Text       = ADR.ToString();
                ADRtxt.BackColor  = Color.SandyBrown;
                MBUStxt.BackColor = Color.SandyBrown;
                return(suma);
            }
            return(-1);
        }
예제 #6
0
        public void Asamblor()
        {
            int    lungime = toate_liniile.Length, clasa;
            string linie;

            index_linie = PC / 4;
            if (index_linie < lungime)
            {
                InputAsm.Text = InputAsm.Text + toate_liniile[index_linie] + "\n";
                linie         = toate_liniile[index_linie];
                string[] cuvSeparat = linie.Split(' ');                                // baga in vector cuvintele separate
                int      ct = 0, ma_rs, ma_rd;
                char     ultimul_caracter = cuvSeparat[ct][cuvSeparat[ct].Length - 1]; //vf daca am eticheta ( daca se termina cu : )

                ADR             = PC;
                PC             += 4;
                PCtxt.Text      = PC.ToString();
                PCtxt.BackColor = Color.GreenYellow;

                if (ultimul_caracter == ':')// am eticheta:_
                {
                    index_et++;
                    ct++;
                }

                //---------------------------------------------------------------------------------------------------------
                instructiune = cuvSeparat[ct];
                nrInstr      = Dec_Opcode(instructiune);

                string opcode = int_to_bin(nrInstr, 4);//!!!! atentie dep de clasa
                //string binar = int_to_bin(nrInstr, 4);
                OutputBinar.Text += opcode + " ";
                IR = opcode;
                if (IR.Length < 16)
                {
                    IR = IR.PadRight(16, '1');
                }
                IR    = Reverse(IR);
                clasa = getClasa(IR);


                //---------------------------------------------------------------------------------------------------------

                if (clasa == 1)
                {
                    Rd = cuvSeparat[ct + 1]; //reg drest
                    Rs = cuvSeparat[ct + 2]; //reg sursa

                    //pt reg sursa
                    ma_rs  = dec_mod_adresare(Rs);
                    opcode = int_to_bin(ma_rs, 2); OutputBinar.Text += opcode + " ";
                    afisare_MA_Rg(Rs);
                    //pt reg destinatie
                    ma_rd  = dec_mod_adresare(Rd);
                    opcode = int_to_bin(ma_rd, 2); OutputBinar.Text += opcode + " ";
                    afisare_MA_Rg(Rd);
                    if (ma_rs == 3)
                    {
                        OutputBinar.Text += "\n" + "i" + index_decodificat;
                    }
                }
                else if (clasa == 2)
                {
                    Rd     = cuvSeparat[ct + 1]; //reg drest
                    ma_rd  = dec_mod_adresare(Rd);
                    opcode = int_to_bin(ma_rd, 2); OutputBinar.Text += opcode + " ";
                    afisare_MA_Rg(Rd); // mod de adresare si registru
                    //if (ma_rs == 3) OutputBinar.Text += "\n" + "i" + index_decodificat;
                }
                else if (clasa == 3)
                {
                    ADRtxt.Text      = ADR.ToString();
                    ADRtxt.BackColor = Color.SandyBrown;
                    Adresa           = cuvSeparat[ct + 1];

                    if (nrInstr == 161 && Z == 0) //bne, sar daca Z=0
                    {
                        ADR = get_new_PC(Adresa);
                        string offset = int_to_bin(ADR, 8);
                        OutputBinar.Text += offset;
                        ADR -= 4;//pt ca am pc+4 mai jos
                    }
                }
                // else if(clasa==4)
                //{

                //}

                string verific_index = OutputBinar.Lines[index_IR];
                if (verific_index.Contains("i") == false)
                {
                    IR = OutputBinar.Lines[index_IR];
                }
                else
                {
                    index_IR++;
                    IR = OutputBinar.Lines[index_IR];
                }


                IR              = IR.Replace(" ", string.Empty);
                IRtxt.Text      = IR.ToString();
                IRtxt.BackColor = Color.GreenYellow;
                IR              = Reverse(IR);

                ADRtxt.Text      = ADR.ToString();
                ADRtxt.BackColor = Color.GreenYellow;
                // PC += 4;

                index_IR++;
                OutputBinar.Text += "\n";
            }
        }
예제 #7
0
        /// <summary>
        /// Method used to add a property to the instance. Will be placed in the correct class Property.
        /// </summary>
        /// <param name="input">The vCard.Property to add.</param>
        public void AddProperty(Props.IProperty input)
        {
            if (input == null || input.IsValueNull)
            {
                return;
            }

            switch (input.Property)
            {
            case KnownProperties.ADR:
                ADR.AddIfNotNull(input as Props.ADR);
                break;

            case KnownProperties.ANNIVERSARY:
                ANNIVERSARY = input as Props.ANNIVERSARY;
                break;

            case KnownProperties.BDAY:
                BDAY = input as Props.BDAY;
                break;

            case KnownProperties.CALADRURI:
                CALADRURI.AddIfNotNull(input as Props.CALADRURI);
                break;

            case KnownProperties.CALURI:
                CALURI.AddIfNotNull(input as Props.CALURI);
                break;

            case KnownProperties.CATEGORIES:
                CATEGORIES.AddIfNotNull(input as Props.CATEGORIES);
                break;

            case KnownProperties.CLIENTPIDMAP:
                CLIENTPIDMAP.AddIfNotNull(input as Props.CLIENTPIDMAP);
                break;

            case KnownProperties.EMAIL:
                EMAIL.AddIfNotNull(input as Props.EMAIL);
                break;

            case KnownProperties.FBURL:
                FBURL.AddIfNotNull(input as Props.FBURL);
                break;

            case KnownProperties.FN:
                FN.AddIfNotNull(input as Props.FN);
                break;

            case KnownProperties.GENDER:
                GENDER = input as Props.GENDER;
                break;

            case KnownProperties.GEO:
                GEO.AddIfNotNull(input as Props.GEO);
                break;

            case KnownProperties.IMPP:
                IMPP.AddIfNotNull(input as Props.IMPP);
                break;

            case KnownProperties.KEY:
                KEY.AddIfNotNull(input as Props.KEY);
                break;

            case KnownProperties.KIND: {
                char k = (input as Props.KIND).Value.ToLower()[0];
                if (k == 'i')
                {
                    KIND = Kinds.Individual;
                }
                else if (k == 'g')
                {
                    KIND = Kinds.Group;
                }
                else if (k == 'o')
                {
                    KIND = Kinds.Org;
                }
                else if (k == 'l')
                {
                    KIND = Kinds.Location;
                }
                else
                {
                    KIND = Kinds.Individual;
                }
                break;
            }

            case KnownProperties.LANG:
                LANG.AddIfNotNull(input as Props.LANG);
                break;

            case KnownProperties.LOGO:
                LOGO.AddIfNotNull(input as Props.LOGO);
                break;

            case KnownProperties.MEMBER:
                MEMBER.AddIfNotNull(input as Props.MEMBER);
                break;

            case KnownProperties.N:
                N = input as Props.N;
                break;

            case KnownProperties.NICKNAME:
                NICKNAME.AddIfNotNull(input as Props.NICKNAME);
                break;

            case KnownProperties.NOTE:
                NOTE.AddIfNotNull(input as Props.NOTE);
                break;

            case KnownProperties.ORG:
                ORG.AddIfNotNull(input as Props.ORG);
                break;

            case KnownProperties.PHOTO:
                PHOTO.AddIfNotNull(input as Props.PHOTO);
                break;

            case KnownProperties.PRODID:
                PRODID = input as Props.PRODID;
                break;

            case KnownProperties.RELATED:
                RELATED.AddIfNotNull(input as Props.RELATED);
                break;

            case KnownProperties.REV:
                REV = input as Props.REV;
                break;

            case KnownProperties.ROLE:
                ROLE.AddIfNotNull(input as Props.ROLE);
                break;

            case KnownProperties.SOUND:
                SOUND.AddIfNotNull(input as Props.SOUND);
                break;

            case KnownProperties.SOURCE:
                SOURCE.AddIfNotNull(input as Props.SOURCE);
                break;

            case KnownProperties.TEL:
                TEL.AddIfNotNull(input as Props.TEL);
                break;

            case KnownProperties.TITLE:
                TITLE.AddIfNotNull(input as Props.TITLE);
                break;

            case KnownProperties.TZ:
                TZ.AddIfNotNull(input as Props.TZ);
                break;

            case KnownProperties.UID:
                UID = input as Props.UID;
                break;

            case KnownProperties.URL:
                URL.AddIfNotNull(input as Props.URL);
                break;

            case KnownProperties.VERSION:
                VERSION = input as Props.VERSION;
                break;

            case KnownProperties.XML:
                XML.AddIfNotNull(input as Props.XML);
                break;

            default:
                return;
            }
        }
예제 #8
0
 public int updateADR(ADR _ADR)
 {
     return(_ADRRepo.Update(_ADR));
 }
예제 #9
0
 public int addADR(ADR _ADR)
 {
     return(_ADRRepo.Add(_ADR).ADRID);
 }
예제 #10
0
 public int updateADR(ADR _ADR)
 {
     return(_iADRRepository.updateADR(Mapper.Map <DTO.ADR, MMC.Core.Data.Model.ADR>(_ADR)));
 }