示例#1
0
			internal Channel(Int16 id, Layer layer)
			{
				ID = id;
				Layer = layer;
				Layer.Channels.Add(this);
				Layer.SortedChannels.Add(ID, this);
			}
示例#2
0
文件: Document.cs 项目: oeai/medx
 public Document(
     Int16 _TypeId,
     Int64 _Serial,
     Int32 _SignedUser,
     DateTime _Date,
     Boolean _Printed,
     String _DocumentShortName,
     String _DocumentFullName,
     String _MedexDataTable,
     String _DocumentBody,
     String _DocumentHeader,
     Boolean _SetDeleted
     
     )
 {
     TypeId = _TypeId;
        Serial = _Serial;
        SignedUser = _SignedUser;
        Date = _Date;
        Printed = _Printed;
        DocumentShortName = _DocumentShortName;
        DocumentFullName = _DocumentFullName;
        MedexDataTable = _MedexDataTable;
        DocumentBody = _DocumentBody;
        DocumentHeader = _DocumentHeader;
        SetDeleted = _SetDeleted;
 }
		public override void Write(Int16 val)
		{
			val = Utilities.SwapBytes(val);
			base.Write(val);

			if (AutoFlush) Flush();
		}
示例#4
0
        /// <summary>
        /// Converts a <see cref="Int16"/> to big endian notation.
        /// </summary>
        /// <param name="input">The <see cref="Int16"/> to convert.</param>
        /// <returns>The converted <see cref="Int16"/>.</returns>
        public static Int16 BigEndian(Int16 input)
        {
            if (!BitConverter.IsLittleEndian)
                return input;

            return Swap(input);
        }
        private static void VerifyInt16ImplicitCastToComplex(Int16 value)
        {
            Complex c_cast = value;

            if (false == Support.VerifyRealImaginaryProperties(c_cast, value, 0.0))
            {
                Console.WriteLine("Int16ImplicitCast ({0})" + value);
                Assert.True(false, "Verification Failed");
            }
            else
            {
                if (value != Int16.MaxValue)
                {
                    Complex c_cast_plus = c_cast + 1;
                    if (false == Support.VerifyRealImaginaryProperties(c_cast_plus, value + 1, 0.0))
                    {
                        Console.WriteLine("PLuS + Int16ImplicitCast ({0})" + value);
                        Assert.True(false, "Verification Failed");
                    }
                }

                if (value != Int16.MinValue)
                {
                    Complex c_cast_minus = c_cast - 1;
                    if (false == Support.VerifyRealImaginaryProperties(c_cast_minus, value - 1, 0.0))
                    {
                        Console.WriteLine("Minus - Int16ImplicitCast + 1 ({0})" + value);
                        Assert.True(false, "Verification Failed");
                    }
                }
            }
        }
示例#6
0
文件: Pack.cs 项目: HaKDMoDz/eStd
        public static byte[] Int16(Int16 i, Endianness e = Endianness.Machine)
        {
            byte[] bytes = BitConverter.GetBytes(i);

            if (NeedsFlipping(e)) Array.Reverse(bytes);

            return bytes;
        }
 public static void Write(this BinaryWriter writer, Int16 value, bool invertEndian = false)
 {
     if (invertEndian)
     {
         writer.WriteInvertedBytes(BitConverter.GetBytes(value));
     }
     else
     {
         writer.Write(value);
     }
 }
        private static void VerifyInt16ImplicitCastToComplex(Int16 value)
        {
            Complex c_cast = value;

            Support.VerifyRealImaginaryProperties(c_cast, value, 0.0, 
                string.Format("Int16ImplicitCast ({0})", value));
            
            if (value != Int16.MaxValue)
            {
                Complex c_cast_plus = c_cast + 1;
                Support.VerifyRealImaginaryProperties(c_cast_plus, value + 1, 0.0, 
                    string.Format("PLuS + Int16ImplicitCast ({0})", value));
            }

            if (value != Int16.MinValue)
            {
                Complex c_cast_minus = c_cast - 1;
                Support.VerifyRealImaginaryProperties(c_cast_minus, value - 1, 0.0, 
                    string.Format("Minus - Int16ImplicitCast + 1 ({0})", value));
            }
        }
        public void Write(Int16[] value, int offset, int count)
        {
            const int size = sizeof(Int16);

            CreateBuffer(size * count);
            for (int i = 0; i < count; i++)
            {
                Array.Copy(BitConverter.GetBytes(value[i + offset]), 0, buffer, i * size, size);
            }

            WriteBuffer(size * count, size);
        }
 private void btntotal_Click(object sender, RoutedEventArgs e)
 {
     if (textBox3.Text == "div")
     {
         if (textBox4.Text == "dot")
         {
             Decimal a = Convert.ToDecimal(textBox2.Text);
             Decimal b = Convert.ToDecimal(textBox1.Text);
             textBox1.Text = Convert.ToString(a / b);
         }
         else
         {
             Int16 a = Convert.ToInt16(textBox2.Text);
             Int16 b = Convert.ToInt16(textBox1.Text);
             textBox1.Text = Convert.ToString(a / b);
         }
     }
     if (textBox3.Text == "mul")
     {
         if (textBox4.Text == "dot")
         {
             Decimal a = Convert.ToDecimal(textBox2.Text);
             Decimal b = Convert.ToDecimal(textBox1.Text);
             textBox1.Text = Convert.ToString(a * b);
         }
         else
         {
             Int16 a = Convert.ToInt16(textBox2.Text);
             Int16 b = Convert.ToInt16(textBox1.Text);
             textBox1.Text = Convert.ToString(a * b);
         }
     }
     if (textBox3.Text == "sum")
     {
         if (textBox4.Text == "dot")
         {
             Decimal a = Convert.ToDecimal(textBox2.Text);
             Decimal b = Convert.ToDecimal(textBox1.Text);
             textBox1.Text = Convert.ToString(a + b);
         }
         else
         {
             Int16 a = Convert.ToInt16(textBox2.Text);
             Int16 b = Convert.ToInt16(textBox1.Text);
             textBox1.Text = Convert.ToString(a + b);
         }
     }
     if (textBox3.Text == "minus")
     {
         if (textBox4.Text == "dot")
         {
             Decimal a = Convert.ToDecimal(textBox2.Text);
             Decimal b = Convert.ToDecimal(textBox1.Text);
             textBox1.Text = Convert.ToString(a - b);
         }
         else
         {
             Int16 a = Convert.ToInt16(textBox2.Text);
             Int16 b = Convert.ToInt16(textBox1.Text);
             textBox1.Text = Convert.ToString(a - b);
         }
     }
 }
 /// <summary>
 /// Sets the value of a field in a record
 /// </summary>
 /// <param name="ordinal">The ordinal of the field</param>
 /// <param name="value">The new field value</param>
 public void SetInt16(int ordinal, Int16 value)
 {
     SetValue(ordinal, value);
 }
示例#12
0
 public override void WriteArray(string prefix, string localName, string namespaceUri, Int16[] array, int offset, int count)
 {
     throw new NotSupportedException(SR.JsonWriteArrayNotSupported);
 }
 internal static Exception TryToInt16(string s, out Int16 result) {
     if (!Int16.TryParse(s, NumberStyles.AllowLeadingSign|NumberStyles.AllowLeadingWhite|NumberStyles.AllowTrailingWhite, NumberFormatInfo.InvariantInfo, out result)) {
         return new FormatException(Res.GetString(Res.XmlConvert_BadFormat, s, "Int16"));
     }
     return null;
 }
示例#14
0
            /// <summary>
            /// Constructor to create a key from a file.
            /// </summary>
            /// <param name="fileName">The name of the file</param>
            public ErfKeyVer11(string fileName)
            {
                unused = 0;
                resourceID = 0;

                // Generate the ResType of the file based on it's extension, then
                // save the Int16 version of that value in resType.
                FileInfo info = new FileInfo(fileName);
                string resource = "Res" + info.Extension.Substring(1, info.Extension.Length - 1);
                resType = (Int16) (ResType) Enum.Parse(typeof(ResType), resource, true);

                // Strip the extension from the file name and that is the ResRef of the
                // file.
                resRef = RawSerializer.SerializeString(
                    Path.GetFileNameWithoutExtension(fileName).ToLower(), 32, false);
            }
示例#15
0
 internal static unsafe IntPtr ConvertInt16ByrefToPtr(ref Int16 value) {
     fixed (Int16 *x = &value) {
         AssertByrefPointsToStack(new IntPtr(x));
         return new IntPtr(x);
     }
 }
示例#16
0
        private static byte[] GenCentralDirectoryFooter(long StartOfCentralDirectory,
                                                        long EndOfCentralDirectory,
                                                        Zip64Option zip64,
                                                        int entryCount,
                                                        string comment,
                                                        ZipContainer container)
        {
            System.Text.Encoding encoding = GetEncoding(container, comment);
            int j            = 0;
            int bufferLength = 22;

            byte[] block         = null;
            Int16  commentLength = 0;

            if ((comment != null) && (comment.Length != 0))
            {
                block         = encoding.GetBytes(comment);
                commentLength = (Int16)block.Length;
            }
            bufferLength += commentLength;
            byte[] bytes = new byte[bufferLength];

            int i = 0;

            // signature
            byte[] sig = BitConverter.GetBytes(ZipConstants.EndOfCentralDirectorySignature);
            Array.Copy(sig, 0, bytes, i, 4);
            i += 4;

            // number of this disk
            // (this number may change later)
            bytes[i++] = 0;
            bytes[i++] = 0;

            // number of the disk with the start of the central directory
            // (this number may change later)
            bytes[i++] = 0;
            bytes[i++] = 0;

            // handle ZIP64 extensions for the end-of-central-directory
            if (entryCount >= 0xFFFF || zip64 == Zip64Option.Always)
            {
                // the ZIP64 version.
                for (j = 0; j < 4; j++)
                {
                    bytes[i++] = 0xFF;
                }
            }
            else
            {
                // the standard version.
                // total number of entries in the central dir on this disk
                bytes[i++] = (byte)(entryCount & 0x00FF);
                bytes[i++] = (byte)((entryCount & 0xFF00) >> 8);

                // total number of entries in the central directory
                bytes[i++] = (byte)(entryCount & 0x00FF);
                bytes[i++] = (byte)((entryCount & 0xFF00) >> 8);
            }

            // size of the central directory
            Int64 SizeOfCentralDirectory = EndOfCentralDirectory - StartOfCentralDirectory;

            if (SizeOfCentralDirectory >= 0xFFFFFFFF || StartOfCentralDirectory >= 0xFFFFFFFF)
            {
                // The actual data is in the ZIP64 central directory structure
                for (j = 0; j < 8; j++)
                {
                    bytes[i++] = 0xFF;
                }
            }
            else
            {
                // size of the central directory (we just get the low 4 bytes)
                bytes[i++] = (byte)(SizeOfCentralDirectory & 0x000000FF);
                bytes[i++] = (byte)((SizeOfCentralDirectory & 0x0000FF00) >> 8);
                bytes[i++] = (byte)((SizeOfCentralDirectory & 0x00FF0000) >> 16);
                bytes[i++] = (byte)((SizeOfCentralDirectory & 0xFF000000) >> 24);

                // offset of the start of the central directory (we just get the low 4 bytes)
                bytes[i++] = (byte)(StartOfCentralDirectory & 0x000000FF);
                bytes[i++] = (byte)((StartOfCentralDirectory & 0x0000FF00) >> 8);
                bytes[i++] = (byte)((StartOfCentralDirectory & 0x00FF0000) >> 16);
                bytes[i++] = (byte)((StartOfCentralDirectory & 0xFF000000) >> 24);
            }


            // zip archive comment
            if ((comment == null) || (comment.Length == 0))
            {
                // no comment!
                bytes[i++] = (byte)0;
                bytes[i++] = (byte)0;
            }
            else
            {
                // the size of our buffer defines the max length of the comment we can write
                if (commentLength + i + 2 > bytes.Length)
                {
                    commentLength = (Int16)(bytes.Length - i - 2);
                }
                bytes[i++] = (byte)(commentLength & 0x00FF);
                bytes[i++] = (byte)((commentLength & 0xFF00) >> 8);

                if (commentLength != 0)
                {
                    // now actually write the comment itself into the byte buffer
                    for (j = 0; (j < commentLength) && (i + j < bytes.Length); j++)
                    {
                        bytes[i + j] = block[j];
                    }
                    i += j;
                }
            }

            //   s.Write(bytes, 0, i);
            return(bytes);
        }
示例#17
0
        private void buttonSetSpeed_Click(object sender, EventArgs e)
        {
            if (!init_)
            {
                return;
            }

#if TEST_SLOW_PWM
            if (mode_ == PWM_ALT || mode_ == PWM_AZM)
            {
                Int16 value = 1;
                if (textBoxSpeed.Text.Length > 0)
                {
                    try
                    {
                        double x = Convert.ToDouble(textBoxSpeed.Text);
                        value = Convert.ToInt16(x);
                    }
                    catch
                    {
                    }
                }
                if (value < 1)
                {
                    value = 1;
                }
                else if (value > 255)
                {
                    value = 255;
                }

                Int16 period = 0;
                if (textBoxSetPos.Text.Length > 0)
                {
                    try
                    {
                        double x = Convert.ToDouble(textBoxSetPos.Text);
                        period = Convert.ToInt16(x);
                    }
                    catch
                    {
                    }
                }

                Int16 pwmSpeed = 0;
                if (textBoxPWMSpeed.Text.Length > 0)
                {
                    try
                    {
                        double x = Convert.ToDouble(textBoxPWMSpeed.Text);
                        pwmSpeed = Convert.ToInt16(x);
                    }
                    catch
                    {
                    }
                }
                if (pwmSpeed > value)
                {
                    pwmSpeed = value;
                }
                else if (pwmSpeed < -value)
                {
                    pwmSpeed = (Int16)(-value);
                }

                float dutyCycle = (float)pwmSpeed / (float)value;

                ChangePWMSpeed(value, period, dutyCycle, mode_ == PWM_ALT ? M_ALT : M_AZM);
                return;
            }
#endif

            if (textBoxSpeed.Text.Length == 0)
            {
                Stop(mode_);
                return;
            }

            double dValue = 0;
            try
            {
                dValue = Convert.ToDouble(textBoxSpeed.Text);
            }
            catch
            {
            }

            switch (mode_)
            {
            default:
            case A_ALT:
            case A_AZM: ChangeSpeed((Int32)dValue, mode_); break;

            case M_ALT:
            case M_AZM: ChangeSpeed((Int32)(dValue * 60 * 24 * M_RESOLUTION), mode_); break;
            }
        }
示例#18
0
        private bool ResetPLCWLCData()
        {
            int    iReturnCode;                     //Return code
            String szDeviceName  = "ZR1001";        //List data for 'DeviceName'
            int    iNumberOfData = 29;              //Data for 'DeviceSize'

            short[] arrDeviceValue;                 //Data for 'DeviceValue'
            char[]  chpid       = new char[10];
            char[]  chvin       = new char[18];
            char[]  chsuffix    = new char[2];
            char[]  chmodelcode = new char[4];
            char[]  chplccode   = new char[4];
            char[]  chchassis   = new char[20];

            //chpid = pid.ToCharArray();
            //chvin = vin.ToCharArray();
            //chsuffix = suffix.ToCharArray();
            //chmodelcode = modelcode.ToCharArray();
            //chplccode = plccode.ToCharArray();
            //chchassis = chassis.ToCharArray();

            //var listch = chpid.ToList();
            //listch.Add(chvin.ToList());

            //Char[] cr = chpid + chvin + chsuffix + chmodelcode + chplccode + chchassis;
            //Char[] cr = str.ToCharArray(); //Kumpulkan data dalam bentuk byte array

            //Assign the array for 'DeviceValue'.
            arrDeviceValue = new short[iNumberOfData];

            int k = 0;

            //int l = cr.Length;
            byte[] byt = new byte[58];
            foreach (var ea in chpid)
            {
                byt[k] = Convert.ToByte(ea);
                k++;
            }
            foreach (var ea in chvin)
            {
                byt[k] = Convert.ToByte(ea);
                k++;
            }
            foreach (var ea in chsuffix)
            {
                byt[k] = Convert.ToByte(ea);
                k++;
            }
            foreach (var ea in chmodelcode)
            {
                byt[k] = Convert.ToByte(ea);
                k++;
            }
            foreach (var ea in chplccode)
            {
                byt[k] = Convert.ToByte(ea);
                k++;
            }
            foreach (var ea in chchassis)
            {
                byt[k] = Convert.ToByte(ea);
                k++;
            }

            var a = 0;
            var b = 0;

            while (a < byt.Count())
            {
                //var txt = "ZR" + j;
                Int16 value = byt[a + 1];
                value <<= 8;
                value  += Convert.ToInt16(byt[a]);
                //plc.WriteDeviceBlock(txt, 1, Convert.ToInt32(value));
                //nilai[k] = ;
                arrDeviceValue[b] = value;
                a += 2;
                b += 1;
                //j++;
            }

            try
            {
                //The WriteDeviceRandom2 method is executed.
                iReturnCode = plc.WriteDeviceBlock2(szDeviceName,
                                                    iNumberOfData,
                                                    ref arrDeviceValue[0]);
            }
            //Exception processing
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                string stringFormat = "Reset WLC Data Failed";
                StatusPLCLog = stringFormat;
                return(false);
            }
            if (iReturnCode == 0)
            {
                string stringFormat = "Reset WLC Data Success";
                StatusPLCLog = stringFormat;
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#19
0
 //说明:初始化通讯接口
 public static extern int rf_init(Int16 port, int baud);
 public Veiculo(Int16 id, String marca, String nome, String combustivel, Int16 lugares, Int16 velocidadeMax)
 {
     this.id            = id;
     this.marca         = marca;
     this.nome          = nome;
     this.combustivel   = combustivel;
     this.lugares       = lugares;
     this.VelocidadeMax = velocidadeMax;
 }
示例#21
0
        private void button2_Click(object sender, EventArgs e) // dla przycisku zapisz
        {
            SqlConnection sqlConnection2 = new SqlConnection(@"Data Source=(localdb)\MSSQLLocalDB;AttachDbFilename=" + Form1.sciezka + ";Integrated Security=True");

            sqlConnection2.Open();
            SqlCommand sqlCommand = new SqlCommand("UPDATE Baza SET Prize=" + Int16.Parse(textBox4.Text) + " WHERE Id =" + Int16.Parse(textBox1.Text) + ";", sqlConnection2);


            sqlCommand.ExecuteNonQuery();
            MessageBox.Show("UPDATED");
        }
 /// <summary>
 /// Converts int16 to the array of bytes size 2
 /// </summary>
 /// <param name="value">Int16 value</param>
 /// <returns>Array of bytes of size 2.</returns>
 public static byte[] Int16ToBytes(Int16 value)
 {
     return Int32ToBytes(value, 2);
 }
示例#23
0
 private static void VerifyInt16ExplicitCastFromBigInteger(Int16 value)
 {
     BigInteger bigInteger = new BigInteger(value);
     VerifyInt16ExplicitCastFromBigInteger(value, bigInteger);
 }
示例#24
0
        private void btnTextBox_Click(object sender, EventArgs e)
        {
            try
            {
                var btnName = ((sender as System.Windows.Forms.Button).Name);
                (sender as System.Windows.Forms.Button).BackColor = Color.Yellow;

                if (MessageBox.Show("Do you want to update the selected value?", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                switch (btnName)
                {
                case "btnCIPS":
                    UpdateSettings("CIPS", txtCIPS.Text, "CIPS connection changed from ", true);
                    CONN_CIPS = txtCIPS.Text;
                    break;

                case "btnRxBackend":
                    UpdateSettings("RxBackend", txtRxBackend.Text, "RxBackend connection changed from ", true);
                    CONN_RX = txtRxBackend.Text;
                    break;

                case "btnDSN_CIPS":
                    UpdateSettings("DSN_CIPS", txtDSN_CIPS.Text, "CIPS DSN changed from ", true);
                    break;

                case "btnDSN_RxBackend":
                    UpdateSettings("DSN_RxBackend", txtDSN_RxBackend.Text, "RxBackend DSN changed from ", true);
                    break;

                case "btnAddress":
                    UpdateSettings("EmailAddress", txtAddress.Text, "Email Address changed from ", true);
                    CONN_RX = txtRxBackend.Text;
                    break;

                case "btnPassword":
                    UpdateSettings("EmailPassword", Encrypt(txtPassword.Text), "Email Password changed", false);
                    break;

                case "btnMailbox":
                    UpdateSettings("Mailbox", txtMailbox.Text, "Mailbox changed from ", true);
                    break;

                case "btnEmailServer":
                    UpdateSettings("EmailServer", txtEmailServer.Text, "Email server changed from ", true);
                    break;

                case "btnEmailPort":
                    Utility.WriteActivity("SMTP port changed from " + ReadConfig("EmailPort") + " to " + txtEmailPort.Text);
                    Properties.Settings.Default.EmailPort = Int16.Parse(txtEmailPort.Text);
                    Properties.Settings.Default.Save();
                    break;

                case "btnForward":
                    UpdateSettings("ForwardAddress", txtForward.Text, "Forwarding Email Address changed from ", true);
                    break;

                case "btnFaxPrinter":
                    UpdateSettings("FaxPrinter", txtFaxPrinter.Text, "Fax Printer changed from ", true);
                    break;

                case "btnCalendarID":
                    UpdateSettings("CalendarID", txtCalendarID.Text, "Calendar ID changed from ", true);
                    break;

                case "btnFaxFolder":
                    UpdateSettings("FaxFolder", txtFaxFolder.Text, "Fax Folder ID changed from ", true);
                    break;
                }
            }
            catch (Exception ex)
            {
                //LogError(ex.Message);
                MessageBox.Show(ex.Message);
            }
            finally
            {
                (sender as System.Windows.Forms.Button).BackColor = Color.Transparent;
            }
        }
示例#25
0
 public void Push(Int16 value)
 {
     Data[StackIndex++] = value;
 }
示例#26
0
        public static void Stat(Band band, int interleave, double begin, double end, out double min, out double max, out double mean, out double stddev, bool isCanApprox, Action <int, string> progressCallback)
        {
            min = max = mean = stddev = 0;
            double sum   = 0;
            int    count = 0;

            switch (band.DataType)
            {
            case DataType.GDT_Byte:
                Byte minByte = Byte.MaxValue;
                Byte maxByte = Byte.MinValue;
                using (BandPixelsVisitor <Byte> v = new BandPixelsVisitor <Byte>())
                {
                    v.Visit(band, interleave, pixel =>
                    {
                        if (pixel < begin || pixel > end)
                        {
                            return;
                        }
                        sum += pixel;
                        count++;
                        if (pixel < minByte)
                        {
                            minByte = pixel;
                        }
                        if (pixel > maxByte)
                        {
                            maxByte = pixel;
                        }
                    }, progressCallback);
                }
                min = minByte;
                max = maxByte;
                break;

            case DataType.GDT_UInt16:
                UInt16 minUInt16 = UInt16.MaxValue;
                UInt16 maxUInt16 = UInt16.MinValue;
                using (BandPixelsVisitor <UInt16> v = new BandPixelsVisitor <UInt16>())
                {
                    v.Visit(band, interleave, pixel =>
                    {
                        if (pixel < begin || pixel > end)
                        {
                            return;
                        }
                        sum += pixel;
                        count++;
                        if (pixel < minUInt16)
                        {
                            minUInt16 = pixel;
                        }
                        if (pixel > maxUInt16)
                        {
                            maxUInt16 = pixel;
                        }
                    }, progressCallback);
                }
                min = minUInt16;
                max = maxUInt16;
                break;

            case DataType.GDT_Int16:
                Int16 minInt16 = Int16.MaxValue;
                Int16 maxInt16 = Int16.MinValue;
                using (BandPixelsVisitor <Int16> v = new BandPixelsVisitor <Int16>())
                {
                    v.Visit(band, interleave, pixel =>
                    {
                        if (pixel < begin || pixel > end)
                        {
                            return;
                        }
                        sum += pixel;
                        count++;
                        if (pixel < minInt16)
                        {
                            minInt16 = pixel;
                        }
                        if (pixel > maxInt16)
                        {
                            maxInt16 = pixel;
                        }
                    }, progressCallback);
                }
                min = minInt16;
                max = maxInt16;
                break;

            case DataType.GDT_UInt32:
                UInt32 minUInt32 = UInt32.MaxValue;
                UInt32 maxUInt32 = UInt32.MinValue;
                using (BandPixelsVisitor <UInt32> v = new BandPixelsVisitor <UInt32>())
                {
                    v.Visit(band, interleave, pixel =>
                    {
                        if (pixel < begin || pixel > end)
                        {
                            return;
                        }
                        sum += pixel;
                        count++;
                        if (pixel < minUInt32)
                        {
                            minUInt32 = pixel;
                        }
                        if (pixel > maxUInt32)
                        {
                            maxUInt32 = pixel;
                        }
                    }, progressCallback);
                }
                min = minUInt32;
                max = maxUInt32;
                break;

            case DataType.GDT_Int32:
                Int32 minInt32 = Int32.MaxValue;
                Int32 maxInt32 = Int32.MinValue;
                using (BandPixelsVisitor <Int32> v = new BandPixelsVisitor <Int32>())
                {
                    v.Visit(band, interleave, pixel =>
                    {
                        if (pixel < begin || pixel > end)
                        {
                            return;
                        }
                        sum += pixel;
                        count++;
                        if (pixel < minInt32)
                        {
                            minInt32 = pixel;
                        }
                        if (pixel > maxInt32)
                        {
                            maxInt32 = pixel;
                        }
                    }, progressCallback);
                }
                min = minInt32;
                max = maxInt32;
                break;

            case DataType.GDT_Float32:
                float minFloat = float.MaxValue;
                float maxFloat = float.MinValue;
                using (BandPixelsVisitor <float> v = new BandPixelsVisitor <float>())
                {
                    v.Visit(band, interleave, pixel =>
                    {
                        if (pixel < begin || pixel > end)
                        {
                            return;
                        }
                        sum += pixel;
                        count++;
                        if (pixel < minFloat)
                        {
                            minFloat = pixel;
                        }
                        if (pixel > maxFloat)
                        {
                            maxFloat = pixel;
                        }
                    }, progressCallback);
                }
                min = minFloat;
                max = maxFloat;
                break;

            case DataType.GDT_Float64:
                double minDouble = double.MaxValue;
                double maxDouble = double.MinValue;
                using (BandPixelsVisitor <double> v = new BandPixelsVisitor <double>())
                {
                    v.Visit(band, interleave, pixel =>
                    {
                        if (pixel < begin || pixel > end)
                        {
                            return;
                        }
                        sum += pixel;
                        count++;
                        if (pixel < minDouble)
                        {
                            minDouble = pixel;
                        }
                        if (pixel > maxDouble)
                        {
                            maxDouble = pixel;
                        }
                    }, progressCallback);
                }
                min = minDouble;
                max = maxDouble;
                break;

            default:
                throw new DataTypeIsNotSupportException(band.DataType.ToString());
            }
            mean = sum / count;
            ComputeStddev(band, interleave, begin, end, count, mean, out stddev, isCanApprox, progressCallback);
        }
示例#27
0
        private static void VerifyInt16ImplicitCastToBigInteger(Int16 value)
        {
            BigInteger bigInteger = value;

            Assert.Equal(value, bigInteger);
            Assert.Equal(value.ToString(), bigInteger.ToString());
            Assert.Equal(value, (Int16)bigInteger);

            if (value != Int16.MaxValue)
            {
                Assert.Equal((Int16)(value + 1), (Int16)(bigInteger + 1));
            }

            if (value != Int16.MinValue)
            {
                Assert.Equal((Int16)(value - 1), (Int16)(bigInteger - 1));
            }
    
            VerifyBigIntegerUsingIdentities(bigInteger, 0 == value);
        }
示例#28
0
        internal int CheckCurrentStep(int readCount)
        {
            _messageBytesReadLength += readCount;
            _bufferStartIndex       += readCount;

            if (_currentFrameHeaderData == null)
            {
                if (_messageBytesReadLength < FrameFormat.FrameHeaderSize)
                {
                    return(0);
                }

                if (FrameFormat.CheckFrameHeader(_readBuffer) == false)
                {
                    return(-1);
                }

                var frameHeaderData = _tempFrameHeaderData;
                FrameFormat.ReadDataFromHeaderBuffer(_readBuffer, ref frameHeaderData);

                _headerExtentionLength = frameHeaderData.HeaderExtentionLength;
                _titleLength           = frameHeaderData.TitleLength;
                _contentLength         = frameHeaderData.ContentLength;
                _stateCode             = frameHeaderData.StateCode;
                _messageId             = frameHeaderData.MessageId;

                _currentFrameHeaderData = frameHeaderData;

                _headerExtentionBytes = _headerExtentionLength == 0 ? FrameFormat.EmptyBytes : new byte[_headerExtentionLength];
                _titleBytes           = _titleLength == 0 ? FrameFormat.EmptyBytes : new byte[_titleLength];
                _contentBytes         = _contentLength == 0 ? FrameFormat.EmptyBytes : new byte[_contentLength];

                if (GetBodyLength() == 0)
                {
                    return(_messageBytesReadLength == FrameFormat.FrameHeaderSize ? 1 : -1);
                }

                readCount = readCount - FrameFormat.FrameHeaderSize;
            }

            _unprocessCount += readCount;

            var messageLength = GetBodyLength() + FrameFormat.FrameHeaderSize;

            // message format error,return error code
            if (_messageBytesReadLength > messageLength)
            {
                return(-1);
            }

            // read datas and return success code
            if (_messageBytesReadLength == messageLength)
            {
                ReadBufferDatas(_unprocessCount);
                return(1);
            }

            // message is not complete,return continue-reading code
            // if buffer is full,move datas to cache and clear buffer
            if (_bufferStartIndex == _readBuffer.Length)
            {
                ReadBufferDatas(_unprocessCount);
                _unprocessCount   = 0;
                _bufferStartIndex = 0;
            }

            //continue to read
            return(0);
        }
示例#29
0
 public ADCResultEventArgs(Byte input, Int16 value)
 {
     this.input = input;
     this.value = value;
 }
        public static void FoodMenuUpdate(int MenuID, string MenuItem, float Price, int CatID, Int16 Status, Image img)
        {
            try
            {
                MemoryStream objMS = new MemoryStream();
                img.Save(objMS, ImageFormat.Png);
                byte[] arr = objMS.ToArray();

                SqlCommand sqlCmd = new SqlCommand("SP_FoodMenuUpdate", Main.sqlCon);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.AddWithValue("@m_id", MenuID);
                sqlCmd.Parameters.AddWithValue("@m_name", MenuItem);
                sqlCmd.Parameters.AddWithValue("@m_catID", CatID);
                sqlCmd.Parameters.AddWithValue("@m_price", Price);
                sqlCmd.Parameters.AddWithValue("@m_status", Status);
                sqlCmd.Parameters.AddWithValue("@m_image", arr);
                Main.sqlCon.Open();
                int value = sqlCmd.ExecuteNonQuery();
                Main.sqlCon.Close();
                if (value > 0)
                {
                    Main.showMessage(MenuItem + " " + "record updated successfully", "success");
                }
            }
            catch (Exception)
            {
                Main.sqlCon.Close();
                Main.showMessage("unable to update category.\n posible error :\n contact techincal support ", "error");
            }
        }
示例#31
0
 private unsafe int ReadArray(Int16[] array, int offset, int count)
 {
     CheckArray(array, offset, count);
     int actual = Math.Min(count, _arrayCount);
     fixed (Int16* items = &array[offset])
     {
         BufferReader.UnsafeReadArray((byte*)items, (byte*)&items[actual]);
     }
     SkipArrayElements(actual);
     return actual;
 }
示例#32
0
 public LitecoinService(String daemonUrl, String rpcUsername, String rpcPassword, String walletPassword, Int16 rpcRequestTimeoutInSeconds)
     : base(daemonUrl, rpcUsername, rpcPassword, walletPassword, rpcRequestTimeoutInSeconds)
 {
 }
示例#33
0
 public void WriteSInt16(Int16 value)
 {
     WriteInteger(BitConverter.GetBytes(value));
 }
        public void verifyingPricingPlanPushtoOfficeError()
        {
            string[] username = null;
            string[] password = null;

            var oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            // Initializing the objects
            var executionLog = new ExecutionLog();
            var loginHelper  = new LoginHelper(GetWebDriver());
            var corpMasterdata_PricingPlanHelper = new CorpMasterdata_PricingPlanHelper(GetWebDriver());

            username = oXMLData.getData("settings/Credentials", "username_corp");
            password = oXMLData.getData("settings/Credentials", "password");

            // Variable random
            var    name   = "Test" + GetRandomNumber();
            var    Test   = "New" + GetRandomNumber();
            String JIRA   = "";
            String Status = "Pass";

            try
            {
                executionLog.Log("VerifyingPricingPlanPushtoOfficeError", "Login with valid credential  Username");
                Login(username[0], password[0]);

                executionLog.Log("VerifyingPricingPlanPushtoOfficeError", "Verify Page title");
                VerifyTitle("Dashboard");
                Console.WriteLine("Redirected at Dashboard screen.");

                executionLog.Log("VerifyingPricingPlanPushtoOfficeError", "Procing plan page");
                VisitCorp("masterdata/pricing_plans");
                VerifyTitle("Master Pricing Plans");

                executionLog.Log("VerifyingPricingPlanPushtoOfficeError", "Click On Push Office");
                corpMasterdata_PricingPlanHelper.ClickElement("PushOffice");
                corpMasterdata_PricingPlanHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyingPricingPlanPushtoOfficeError", "Click Ok to Accept alert.");
                corpMasterdata_PricingPlanHelper.AcceptAlert();

                executionLog.Log("VerifyingPricingPlanPushtoOfficeError", "Verify 500 Interanl error not occured.");
                corpMasterdata_PricingPlanHelper.VerifyTextNotPresent("500 Internal Server Error");

                executionLog.Log("VerifyingPricingPlanPushtoOfficeError", "Verify Success message for push to office");
                corpMasterdata_PricingPlanHelper.WaitForText("Pricing Plans successfully pushed to offices.", 20);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("VerifyingPricingPlanPushtoOfficeError");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Verify Pricing Plan Push to office error");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Verify Pricing Plan Push to office error", "Bug", "Medium", "Corp Pricing plan page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Create Pricing Plan");
                        TakeScreenshot("VerifyingPricingPlanPushtoOfficeError");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyingPricingPlanPushtoOfficeError.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("VerifyingPricingPlanPushtoOfficeError");
                        string id            = loginHelper.getIssueID("Verify Pricing Plan Push to office error");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyingPricingPlanPushtoOfficeError.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Verify Pricing Plan Push to office error"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Verify Pricing Plan Push to office error");
                //  executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("VerifyingPricingPlanPushtoOfficeError");
                executionLog.WriteInExcel("Verify Pricing Plan Push to Office error", Status, JIRA, "Corp Master Data");
            }
        }
        public void Write(Int16 value)
        {
            const int size = sizeof(Int16);

            CreateBuffer(size);
            Array.Copy(BitConverter.GetBytes(value), 0, buffer, 0, size);
            WriteBuffer(size, size);
        }
示例#36
0
        public void leadPhoneUpdate()
        {
            string[] username = null;
            string[] password = null;

            var oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");

            // Initializing the objects
            var executionLog       = new ExecutionLog();
            var loginHelper        = new LoginHelper(GetWebDriver());
            var office_LeadsHelper = new Office_LeadsHelper(GetWebDriver());

            // VARIABLE
            var    Company = "My Company" + RandomNumber(1, 9999);
            var    name    = "TestEmployee" + RandomNumber(1, 9999);
            String JIRA    = "";
            String Status  = "Pass";

            try
            {
                executionLog.Log("LeadPhoneUpdate", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("LeadPhoneUpdate", "Verify Page title");
                VerifyTitle("Dashboard");

                executionLog.Log("LeadPhoneUpdate", "Redirect To create lead page. ");
                VisitOffice("leads/create");

                executionLog.Log("LeadPhoneUpdate", "Verify page title. ");
                VerifyTitle("Create a Lead");
                office_LeadsHelper.WaitForWorkAround(1000);

                executionLog.Log("LeadPhoneUpdate", "Wait for element to be visible.");
                office_LeadsHelper.WaitForElementPresent("LeadStatus", 10);

                executionLog.Log("LeadPhoneUpdate", "Select Lead Status");
                office_LeadsHelper.Select("LeadStatus", "New");

                executionLog.Log("LeadPhoneUpdate", "Select Lead Responsibility");
                office_LeadsHelper.SelectByText("Responsibility", "Howard Tang");

                executionLog.Log("LeadPhoneUpdate", "Click on Save");
                office_LeadsHelper.ClickElement("SaveLeadButton");
                office_LeadsHelper.WaitForWorkAround(1000);

                executionLog.Log("LeadPhoneUpdate", "Enter First Name ");
                office_LeadsHelper.TypeText("FirstNameLead", "Test Lead");

                executionLog.Log("LeadPhoneUpdate", "Enter Last Name");
                office_LeadsHelper.TypeText("LeadLastName", "Tester");

                executionLog.Log("LeadPhoneUpdate", "Enter Company Name");
                office_LeadsHelper.TypeText("CompanyName", Company);

                executionLog.Log("LeadPhoneUpdate", "Click on Save");
                office_LeadsHelper.ClickElement("SaveLeadButton");
                office_LeadsHelper.WaitForWorkAround(4000);

                var LocDub = "//button[text()='Create Duplicate']";
                if (office_LeadsHelper.IsElementPresent(LocDub))
                {
                    office_LeadsHelper.WaitForWorkAround(4000);

                    executionLog.Log("LeadPhoneUpdate", "Click on duplicate btn");
                    office_LeadsHelper.Click(LocDub);
                    office_LeadsHelper.WaitForWorkAround(4000);

                    executionLog.Log("LeadPhoneUpdate", "Verify text.");
                    office_LeadsHelper.WaitForText("Lead saved successfully.", 10);
                    office_LeadsHelper.WaitForWorkAround(1000);

                    executionLog.Log("LeadPhoneUpdate", "Redirect To lead page. ");
                    VisitOffice("leads");

                    executionLog.Log("LeadPhoneUpdate", "Enter Company Name");
                    office_LeadsHelper.TypeText("CompanySearch", Company);

                    executionLog.Log("LeadPhoneUpdate", "Wait for checkbox to appear.");
                    office_LeadsHelper.WaitForElementPresent("CheckDocToDel", 10);

                    executionLog.Log("LeadPhoneUpdate", "Select lead by check box");
                    office_LeadsHelper.ClickElement("CheckDocToDel");
                    office_LeadsHelper.WaitForWorkAround(2000);

                    executionLog.Log("LeadPhoneUpdate", "Click on delete lead");
                    office_LeadsHelper.ClickElement("DeleteLead");

                    executionLog.Log("LeadPhoneUpdate", "Accept alert message.");
                    office_LeadsHelper.AcceptAlert();

                    executionLog.Log("LeadPhoneUpdate", "Wait for success message.");
                    office_LeadsHelper.WaitForText("1 records deleted successfully", 10);
                }
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("LeadPhoneUpdate");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Lead Phone Update");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Lead Phone Update", "Bug", "Medium", "PDF Tab page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Lead Phone Update");
                        TakeScreenshot("LeadPhoneUpdate");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\LeadPhoneUpdate.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("LeadPhoneUpdate");
                        string id            = loginHelper.getIssueID("Lead Phone Update");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\LeadPhoneUpdate.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Lead Phone Update"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Lead Phone Update");
                //  executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("LeadPhoneUpdate");
                executionLog.WriteInExcel("Lead Phone Update", Status, JIRA, "Leads Management");
            }
        }
        public Int16[] ReadInt16s(int count)
        {
            const int size = sizeof(Int16);
            Int16[] temp;

            temp = new Int16[count];
            FillBuffer(size * count, size);

            for (int i = 0; i < count; i++)
            {
                temp[i] = BitConverter.ToInt16(buffer, size * i);
            }
            return temp;
        }
示例#38
0
        public JsonResult <Fanatic> getinfo(DbConnection dbConnection)
        {
            Fanatic       result       = new Fanatic();
            SqlConnection myConnection = new SqlConnection();

            myConnection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            if (dbConnection.detail_type == "2")
            {
                string action = "select * from userxinfo full outer join fanatic on userxinfo.fanatic_login = fanatic.fanatic_login where userxinfo_id =" + Int32.Parse(dbConnection.detail_xinfo);

                myConnection.Open();
                SqlCommand sqlCmd = new SqlCommand(action, myConnection);


                sqlCmd.CommandType = CommandType.Text;
                var reader = sqlCmd.ExecuteReader();
                while (reader.Read())
                {
                    DateTime datetmp = (DateTime)reader["fanatic_date_create"];
                    result.fanatic_name        = (string)reader["fanatic_name"];
                    result.fanatic_last_name   = (string)reader["fanatic_last_name"];
                    result.fanatic_birth       = (string)reader["fanatic_birth"];
                    result.fanatic_date_create = datetmp.ToString("dd-mm-yyyy hh:mm");
                    result.fanatic_description = (string)reader["fanatic_description"];
                    result.fanatic_email       = (string)reader["fanatic_email"];
                    result.fanatic_id          = (string)reader["fanatic_login"];
                }
                myConnection.Close();
                return(Json(result));
            }
            else
            {
                string action = "select * from adminxinfo full outer join admin on adminxinfo.admin_username = admin.admin_username where adminxinfo_id =" + Int16.Parse(dbConnection.detail_xinfo);
                myConnection.Open();
                SqlCommand sqlCmd = new SqlCommand(action, myConnection);


                sqlCmd.CommandType = CommandType.Text;
                var reader = sqlCmd.ExecuteReader();
                while (reader.Read())
                {
                    DateTime datetmp = (DateTime)reader["admin_date_create"];
                    result.fanatic_name        = (string)reader["admin_name"];
                    result.fanatic_last_name   = (string)reader["admin_last_name"];
                    result.fanatic_date_create = datetmp.ToString("dd-mm-yyyy hh:mm");
                    result.fanatic_email       = (string)reader["admin_email"];
                    result.fanatic_login       = (string)reader["admin_username"];
                }
                myConnection.Close();
                return(Json(result));
            }
        }
示例#39
0
        public void TestGetObject()
        {
            ActiveMQMapMessage msg          = new ActiveMQMapMessage();
            Boolean            booleanValue = true;
            Byte byteValue = Byte.Parse("1");

            byte[] bytesValue  = new byte[3];
            Char   charValue   = (Char)'a';
            Double doubleValue = Double.Parse("1.5", CultureInfo.InvariantCulture);
            Single floatValue  = Single.Parse("1.5", CultureInfo.InvariantCulture);
            Int32  intValue    = Int32.Parse("1");
            Int64  longValue   = Int64.Parse("1");
            Int16  shortValue  = Int16.Parse("1");
            String stringValue = "string";

            try
            {
                msg.Body["boolean"] = booleanValue;
                msg.Body["byte"]    = byteValue;
                msg.Body["bytes"]   = bytesValue;
                msg.Body["char"]    = charValue;
                msg.Body["double"]  = doubleValue;
                msg.Body["float"]   = floatValue;
                msg.Body["int"]     = intValue;
                msg.Body["long"]    = longValue;
                msg.Body["short"]   = shortValue;
                msg.Body["string"]  = stringValue;
            }
            catch (MessageFormatException)
            {
                Assert.Fail("object formats should be correct");
            }

            msg = (ActiveMQMapMessage)msg.Clone();

            Assert.IsTrue(msg.Body["boolean"] is Boolean);
            Assert.AreEqual(msg.Body["boolean"], booleanValue);
            Assert.AreEqual(msg.Body.GetBool("boolean"), booleanValue);
            Assert.IsTrue(msg.Body["byte"] is Byte);
            Assert.AreEqual(msg.Body["byte"], byteValue);
            Assert.AreEqual(msg.Body.GetByte("byte"), byteValue);
            Assert.IsTrue(msg.Body["bytes"] is byte[]);
            Assert.AreEqual(((byte[])msg.Body["bytes"]).Length, bytesValue.Length);
            Assert.AreEqual((msg.Body["bytes"] as byte[]).Length, bytesValue.Length);
            Assert.IsTrue(msg.Body["char"] is Char);
            Assert.AreEqual(msg.Body["char"], charValue);
            Assert.AreEqual(msg.Body.GetChar("char"), charValue);
            Assert.IsTrue(msg.Body["double"] is Double);
            Assert.AreEqual(msg.Body["double"], doubleValue);
            Assert.AreEqual(msg.Body.GetDouble("double"), doubleValue, 0);
            Assert.IsTrue(msg.Body["float"] is Single);
            Assert.AreEqual(msg.Body["float"], floatValue);
            Assert.AreEqual(msg.Body.GetFloat("float"), floatValue, 0);
            Assert.IsTrue(msg.Body["int"] is Int32);
            Assert.AreEqual(msg.Body["int"], intValue);
            Assert.AreEqual(msg.Body.GetInt("int"), intValue);
            Assert.IsTrue(msg.Body["long"] is Int64);
            Assert.AreEqual(msg.Body["long"], longValue);
            Assert.AreEqual(msg.Body.GetLong("long"), longValue);
            Assert.IsTrue(msg.Body["short"] is Int16);
            Assert.AreEqual(msg.Body["short"], shortValue);
            Assert.AreEqual(msg.Body.GetShort("short"), shortValue);
            Assert.IsTrue(msg.Body["string"] is String);
            Assert.AreEqual(msg.Body["string"], stringValue);
            Assert.AreEqual(msg.Body.GetString("string"), stringValue);

            msg.ClearBody();
            try
            {
                msg.Body["object"] = new Object();
                Assert.Fail("should have thrown exception");
            }
            catch (MessageFormatException)
            {
            }
        }
示例#40
0
        protected void LlenarFormularioImpresion(string EmpleadoAsignado, string TipoActivo, string VehiculoPadre, string ProveedorId, string TipoServicioId)
        {
            ActivoEntidad    ActivoObjetoEntidad   = new ActivoEntidad();
            ActivoEntidad    ActivoVehiculoObjeto  = new ActivoEntidad();
            UsuarioEntidad   UsuarioEntidadActual  = new UsuarioEntidad();
            ResultadoEntidad Resultado             = new ResultadoEntidad();
            ActivoProceso    ActivoProcesoObjeto   = new ActivoProceso();
            EmpleadoEntidad  EmpleadoObjetoEntidad = new EmpleadoEntidad();
            EmpleadoProceso  EmpleadoProcesoObjeto = new EmpleadoProceso();
            string           FechaActual           = string.Empty;

            UsuarioEntidadActual = (UsuarioEntidad)Session["UsuarioEntidad"];

            LlenarTabla();


            if (TipoActivo == ((Int16)ConstantePrograma.TipoAtivo.Vehiculo).ToString())
            {
                ActivoVehiculoObjeto.ActivoId = int.Parse(VehiculoPadre);
                PanelAutomovil.Visible        = true;
                Resultado        = ActivoProcesoObjeto.SeleccionarActivo(ActivoVehiculoObjeto);
                Vehiculo.Text    = Resultado.ResultadoDatos.Tables[0].Rows[0]["Descripcion"].ToString();
                NoEconomico.Text = Resultado.ResultadoDatos.Tables[0].Rows[0]["CodigoBarrasParticular"].ToString();
                SeleccionarPlacas(int.Parse(VehiculoPadre));
            }



            SeleccionarTipoServicio(Int16.Parse(TipoServicioId));
            SeleccionarProveedor(Int16.Parse(ProveedorId));

            FechaActual = DateTime.Today.Year.ToString() + "/" + DateTime.Today.Month.ToString("0#") + "/" + DateTime.Today.Day.ToString("0#") + "/" + DateTime.Today.Hour.ToString("0#") + "/" + DateTime.Today.Minute.ToString("0#");
            ActivoObjetoEntidad.FechaMovimiento = FormatoFecha.AsignarFormato(FechaActual, ConstantePrograma.UniversalFormatoFecha);
            FechaMovimiento.Text = ActivoObjetoEntidad.FechaMovimiento.ToString();
            //Resultado = EmpleadoProcesoObjeto.SeleccionarEmpleado(EmpleadoObjetoEntidad);
            //Departamento.Text = ConfigurationManager.AppSettings["Activos.Web.Secretaria"].ToString();
            //Direccion.Text = ConfigurationManager.AppSettings["Activos.Web.Direccion"].ToString();
            //NumeroEmpleado.Text = ConfigurationManager.AppSettings["Activos.Web.Domicilio"].ToString();
            EmpleadoObjetoEntidad.EmpleadoId = Int16.Parse(EmpleadoAsignado.ToString());
            Resultado = EmpleadoProcesoObjeto.SeleccionarEmpleado(EmpleadoObjetoEntidad);
            //Entrega.Text = Resultado.ResultadoDatos.Tables[0].Rows[0]["Nombre"].ToString() + " " + Resultado.ResultadoDatos.Tables[0].Rows[0]["ApellidoPaterno"].ToString();
            CampoDireccion.Text    = Resultado.ResultadoDatos.Tables[0].Rows[0]["NombreDireccion"].ToString();
            CampoDepartamento.Text = Resultado.ResultadoDatos.Tables[0].Rows[0]["NombreDepartamento"].ToString();
            CampoNoEmpleado.Text   = Resultado.ResultadoDatos.Tables[0].Rows[0]["NumeroEmpleado"].ToString();
            CampoNombre.Text       = Resultado.ResultadoDatos.Tables[0].Rows[0]["NombreEmpleadoCompleto"].ToString();
            if (Resultado.ResultadoDatos.Tables[0].Rows[0]["TelefonoCasa"].ToString() == "")
            {
                CampoTelefono.Text = "Cel.  " + Resultado.ResultadoDatos.Tables[0].Rows[0]["Celular"].ToString();
            }
            else if (Resultado.ResultadoDatos.Tables[0].Rows[0]["Celular"].ToString() == "")
            {
                CampoTelefono.Text = "Tel.  " + Resultado.ResultadoDatos.Tables[0].Rows[0]["TelefonoCasa"].ToString();
            }
            else
            {
                CampoTelefono.Text = "Tel. " + Resultado.ResultadoDatos.Tables[0].Rows[0]["TelefonoCasa"].ToString() + "     Cel. " + Resultado.ResultadoDatos.Tables[0].Rows[0]["Celular"].ToString();
            }

            //con esta información se llenarán los nombres de las firmas de autorización


            Adquisiciones.Text          = ConfigurationManager.AppSettings["Activos.Web.AdquisicionesYServicios"].ToString();
            DirectorAdministrativo.Text = ConfigurationManager.AppSettings["Activos.Web.DirectorAdministrativo"].ToString();
        }
示例#41
0
 private static void VerifyInt16ExplicitCastFromBigInteger(Int16 value, BigInteger bigInteger)
 {
     Assert.Equal(value, (Int16)bigInteger);
 }
        public void verifyModifiedMovementIssue()
        {
            string[] username = null;
            string[] password = null;

            var oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");

            // Initializing the objects
            var executionLog       = new ExecutionLog();
            var loginHelper        = new LoginHelper(GetWebDriver());
            var office_LeadsHelper = new Office_LeadsHelper(GetWebDriver());

            // Variable
            String JIRA   = "";
            String Status = "Pass";

            try
            {
                executionLog.Log("VerifyModifiedMovementIssue", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("VerifyModifiedMovementIssue", "Verify Page title");
                VerifyTitle("Dashboard");
                Console.WriteLine("Redirected at Dashboard screen.");

                executionLog.Log("VerifyModifiedMovementIssue", "Redirect To URL");
                VisitOffice("leads");
                office_LeadsHelper.WaitForWorkAround(5000);

                executionLog.Log("VerifyModifiedMovementIssue", "Verify page title.");
                VerifyTitle("Leads");

                executionLog.Log("VerifyModifiedMovementIssue", "Click on advance filter.");
                office_LeadsHelper.ClickElement("AdvanceFilter");
                office_LeadsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyModifiedMovementIssue", "Select 'Modified' in displayed columns.");
                office_LeadsHelper.SelectByText("DisplayedCols", "Modified");
                office_LeadsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyModifiedMovementIssue", "Move column to available columns");
                office_LeadsHelper.ClickElement("RemoveCols");
                office_LeadsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyModifiedMovementIssue", "Click on apply button.");
                office_LeadsHelper.ClickElement("Apply");
                office_LeadsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyModifiedMovementIssue", "Verify unexpected error message not present on the page.");
                office_LeadsHelper.VerifyTextNot("OOPS you are trying to access a non existing page on the website.");
                office_LeadsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyModifiedMovementIssue", "Logout from the application.");
                VisitOffice("logout");
            }

            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("VerifyModifiedMovementIssue");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Verify Modified Movement Issue");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Verify Modified Movement Issue", "Bug", "Medium", "Opportunities page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Verify Modified Movement Issue");
                        TakeScreenshot("VerifyModifiedMovementIssue");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyModifiedMovementIssue.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("VerifyModifiedMovementIssue");
                        string id            = loginHelper.getIssueID("Verify Modified Movement Issue");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyModifiedMovementIssue.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Verify Modified Movement Issue"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Verify Modified Movement Issue");
                //      executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("VerifyModifiedMovementIssue");
                executionLog.WriteInExcel("Verify Modified Movement Issue", Status, JIRA, "Opportunities Management");
            }
        }
示例#43
0
        // valid for SqlDbType.SmallInt
        internal void SetInt16(Int16 value)
        {
            Debug.Assert(
                SmiXetterAccessMap.IsSetterAccessValid(_metaData, SmiXetterTypeCode.XetInt16));

            if (SqlDbType.Variant == _metaData.SqlDbType)
            {
                _stateObj.Parser.WriteSqlVariantHeader(4, TdsEnums.SQLINT2, 0, _stateObj);
            }
            else
            {
                _stateObj.WriteByte((byte)_metaData.MaxLength);
            }
            _stateObj.Parser.WriteShort(value, _stateObj);
        }
示例#44
0
        private void Form4_Load(object sender, EventArgs e)
        {
            String  cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante ";
            DataSet Ds  = Utilidades.Ejecutar(cmd);

            LbInscrito.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();

            cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante where EstadoPrueba=1 ";
            Ds  = Utilidades.Ejecutar(cmd);
            LbAprobados.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();

            cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante where EstadoPrueba=0 ";
            Ds  = Utilidades.Ejecutar(cmd);
            LbDesaprobaron.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();
            if (Int16.Parse(LbAprobados.Text) != 0)
            {
                int AprobaronPor = (Int16.Parse(LbAprobados.Text) / (Int16.Parse(LbAprobados.Text) + Int16.Parse(LbDesaprobaron.Text)) * 100);
                LbAprobadospor.Text = AprobaronPor.ToString() + "%";
                int DesprobaronPor = (Int16.Parse(LbDesaprobaron.Text) / (Int16.Parse(LbAprobados.Text) + Int16.Parse(LbDesaprobaron.Text)) * 100);
                LbDesaprobaronPor.Text = DesprobaronPor.ToString() + "%";
            }
        }
        public void processorNameOnSavingMerchant()
        {
            string[] username = null;
            string[] password = null;

            var oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");

            // Initializing the objects
            var executionLog = new ExecutionLog();
            var loginHelper  = new LoginHelper(GetWebDriver());
            var processorNameOnSavingMerchantHelper = new ProcessorNameOnSavingMerchantHelper(GetWebDriver());

            // Variable

            String JIRA   = "";
            String Status = "Pass";

            var CompanyName = "QALeadCompany" + RandomNumber(1, 100);

            try
            {
                executionLog.Log("ProcessorNameOnSavingMerchant", "Login with valid credential  Username");
                Login(username[0], password[0]);

                executionLog.Log("VerifySelectedUserGroup", "Verify Page title");
                VerifyTitle("Dashboard");
                Console.WriteLine("Redirected at Dashboard screen.");

                VisitOffice("leads");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on Create button");
                processorNameOnSavingMerchantHelper.ClickElement("CreateBtn");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Enter the Company Name");
                processorNameOnSavingMerchantHelper.TypeText("CompanyNameTab", CompanyName);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Select the status");
                processorNameOnSavingMerchantHelper.SelectByText("Status", "New");

                executionLog.Log("ProcessorNameOnSavingMerchant", "Select the responsibility");
                processorNameOnSavingMerchantHelper.SelectByText("Responsibility", "Howard Tang");

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on Next button");
                processorNameOnSavingMerchantHelper.ClickElement("NextBtn");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on Business details tab");
                processorNameOnSavingMerchantHelper.ClickElement("BusinessDetailsTab");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on Save button");
                processorNameOnSavingMerchantHelper.ClickElement("SaveBtn");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on Business Banking Account tab");
                processorNameOnSavingMerchantHelper.ClickElement("BusinessBankAcc");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(2000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Enter the routing number");
                processorNameOnSavingMerchantHelper.TypeText("RoutingNumber", "889876765");

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on Save button");
                processorNameOnSavingMerchantHelper.ClickElement("SaveBtn");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);

                VisitOffice("leads");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);
                executionLog.Log("ProcessorNameOnSavingMerchant", "Search the company name");
                processorNameOnSavingMerchantHelper.TypeText("CompanySearchField", CompanyName);
                processorNameOnSavingMerchantHelper.WaitForWorkAround(2000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on first lead element");
                processorNameOnSavingMerchantHelper.ClickElement("FirstCompanyName");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on Company details tab");
                processorNameOnSavingMerchantHelper.ClickElement("BusinessDetailsTab");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Enter the processor name");
                processorNameOnSavingMerchantHelper.TypeText("ProcessorName", "First Data Omaha");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on Save button");
                processorNameOnSavingMerchantHelper.ClickElement("SaveBtn");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(5000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Verify the added processor name ");
                processorNameOnSavingMerchantHelper.verifyFieldText("//*[@id='LeadDetailIfyesProcessorName']", "First Data Omaha");

                VisitOffice("leads");
                processorNameOnSavingMerchantHelper.WaitForWorkAround(3000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Search the company name");
                processorNameOnSavingMerchantHelper.TypeText("CompanySearchField", CompanyName);
                processorNameOnSavingMerchantHelper.WaitForWorkAround(2000);

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on first check box");
                processorNameOnSavingMerchantHelper.ClickElement("FirstCheckBox");

                executionLog.Log("ProcessorNameOnSavingMerchant", "Click on delete button");
                processorNameOnSavingMerchantHelper.ClickElement("DeleteBtn");
                processorNameOnSavingMerchantHelper.AcceptAlert();
                processorNameOnSavingMerchantHelper.WaitForWorkAround(4000);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("ProcessorNameOnSavingMerchant");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Processor Name On Saving Merchant");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Processor Name On Saving Merchant", "Bug", "Medium", "Merchant page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Processor Name On Saving Merchant");
                        TakeScreenshot("ProcessorNameOnSavingMerchant");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\ProcessorNameOnSavingMerchant.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("ProcessorNameOnSavingMerchant");
                        string id            = loginHelper.getIssueID("Processor Name On Saving Merchant");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\ProcessorNameOnSavingMerchant.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Processor Name On Saving Merchant"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Processor Name On Saving Merchant");
                //   executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("ProcessorNameOnSavingMerchant");
                executionLog.WriteInExcel("Processor Name On Saving Merchant", Status, JIRA, "Office Merchant data");
            }
        }
示例#46
0
        private void BtnActualizar_Click(object sender, EventArgs e)
        {
            if (ChkMes.Checked == true)
            {
                String  cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante where  Month(FechaInscripcion) = (select DATEPART (month,getdate())) and year(FechaInscripcion) = (select DATEPART (YEAR,getdate())) ";
                DataSet Ds  = Utilidades.Ejecutar(cmd);
                LbInscrito.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();

                cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante where EstadoPrueba=1  and Month(FechaInscripcion) = (select DATEPART (month,getdate())) and year(FechaInscripcion) = (select DATEPART (YEAR,getdate())) ";
                Ds  = Utilidades.Ejecutar(cmd);
                LbAprobados.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();

                cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante where EstadoPrueba=0  and Month(FechaInscripcion) = (select DATEPART (month,getdate())) and year(FechaInscripcion) = (select DATEPART (YEAR,getdate())) ";
                Ds  = Utilidades.Ejecutar(cmd);
                LbDesaprobaron.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();
                if ((Int16.Parse(LbAprobados.Text) != 0))
                {
                    int AprobaronPor = (Int16.Parse(LbAprobados.Text) / (Int16.Parse(LbAprobados.Text) + Int16.Parse(LbDesaprobaron.Text)) * 100);
                    LbAprobadospor.Text = AprobaronPor.ToString() + "%";
                    int DesprobaronPor = (Int16.Parse(LbDesaprobaron.Text) / (Int16.Parse(LbAprobados.Text) + Int16.Parse(LbDesaprobaron.Text)) * 100);
                    LbDesaprobaronPor.Text = DesprobaronPor.ToString() + "%";
                }
            }
            else if (ChkAnio.Checked == true && ChkMes.Checked == false)
            {
                String  cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante where   year(FechaInscripcion) = (select DATEPART (YEAR,getdate())) ";
                DataSet Ds  = Utilidades.Ejecutar(cmd);
                LbInscrito.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();

                cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante where EstadoPrueba=1   and year(FechaInscripcion) = (select DATEPART (YEAR,getdate())) ";
                Ds  = Utilidades.Ejecutar(cmd);
                LbAprobados.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();

                cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante where EstadoPrueba=0   and year(FechaInscripcion) = (select DATEPART (YEAR,getdate())) ";
                Ds  = Utilidades.Ejecutar(cmd);
                LbDesaprobaron.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();
                if ((Int16.Parse(LbAprobados.Text) != 0))
                {
                    int AprobaronPor = (Int16.Parse(LbAprobados.Text) / (Int16.Parse(LbAprobados.Text) + Int16.Parse(LbDesaprobaron.Text)) * 100);
                    LbAprobadospor.Text = AprobaronPor.ToString() + "%";
                    int DesprobaronPor = (Int16.Parse(LbDesaprobaron.Text) / (Int16.Parse(LbAprobados.Text) + Int16.Parse(LbDesaprobaron.Text)) * 100);
                    LbDesaprobaronPor.Text = DesprobaronPor.ToString() + "%";
                }
            }
            else
            {
                String  cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante ";
                DataSet Ds  = Utilidades.Ejecutar(cmd);
                LbInscrito.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();

                cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante where EstadoPrueba=1 ";
                Ds  = Utilidades.Ejecutar(cmd);
                LbAprobados.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();

                cmd = "select count (Codigo_Estudiante) as cuentas  from Estudiante where EstadoPrueba=0 ";
                Ds  = Utilidades.Ejecutar(cmd);
                LbDesaprobaron.Text = Ds.Tables[0].Rows[0]["cuentas"].ToString();
                if (Int16.Parse(LbDesaprobaron.Text) != 0)
                {
                    int AprobaronPor = (Int16.Parse(LbAprobados.Text) / (Int16.Parse(LbAprobados.Text) + Int16.Parse(LbDesaprobaron.Text)) * 100);
                    LbAprobadospor.Text = AprobaronPor.ToString() + "%";
                    int DesprobaronPor = (Int16.Parse(LbDesaprobaron.Text) / (Int16.Parse(LbAprobados.Text) + Int16.Parse(LbDesaprobaron.Text)) * 100);
                    LbDesaprobaronPor.Text = DesprobaronPor.ToString() + "%";
                }
            }
        }
示例#47
0
文件: PSDFile.cs 项目: HaKDMoDz/eStd
        public PsdFile Load(String filename)
		{
			using (FileStream stream = new FileStream(filename, FileMode.Open))
			{
				//binary reverse reader reads data types in big-endian format.
				BinaryReverseReader reader = new BinaryReverseReader(stream);

				#region "Headers"
				//The headers area is used to check for a valid PSD file
				Debug.WriteLine("LoadHeader started at " + reader.BaseStream.Position.ToString(CultureInfo.InvariantCulture));

				String signature = new String(reader.ReadChars(4));
				if (signature != "8BPS") throw new IOException("Bad or invalid file stream supplied");

				//get the version number, should be 1 always
				if ((Version = reader.ReadInt16()) != 1) throw new IOException("Invalid version number supplied");

				//get rid of the 6 bytes reserverd in PSD format
				reader.BaseStream.Position += 6;

				//get the rest of the information from the PSD file.
				//Everytime ReadInt16() is called, it reads 2 bytes.
				//Everytime ReadInt32() is called, it reads 4 bytes.
				_channels = reader.ReadInt16();
				_rows = reader.ReadInt32();
				_columns = reader.ReadInt32();
				_depth = reader.ReadInt16();
				ColorMode = (ColorModes)reader.ReadInt16();

				//by end of headers, the reader has read 26 bytes into the file.
				#endregion //End Headers

				#region "ColorModeData"
				Debug.WriteLine("LoadColorModeData started at " + reader.BaseStream.Position.ToString(CultureInfo.InvariantCulture));

				UInt32 paletteLength = reader.ReadUInt32(); //readUint32() advances the reader 4 bytes.
				if (paletteLength > 0)
				{
					ColorModeData = reader.ReadBytes((Int32)paletteLength);
				}
				#endregion //End ColorModeData


				#region "Loading Image Resources"
				//This part takes extensive use of classes that I didn't write therefore
				//I can't document much on what they do.

				Debug.WriteLine("LoadingImageResources started at " + reader.BaseStream.Position.ToString(CultureInfo.InvariantCulture));

                _imageResources.Clear();

				UInt32 imgResLength = reader.ReadUInt32();
				if (imgResLength <= 0) return null;

				Int64 startPosition = reader.BaseStream.Position;

				while ((reader.BaseStream.Position - startPosition) < imgResLength)
				{
					ImageResource imgRes = new ImageResource(reader);

					ResourceIDs resID = (ResourceIDs)imgRes.ID;
					switch (resID)
					{
						case ResourceIDs.ResolutionInfo:
							imgRes = new ResolutionInfo(imgRes);
							break;
						case ResourceIDs.Thumbnail1:
						case ResourceIDs.Thumbnail2:
							imgRes = new Thumbnail(imgRes);
							break;
						case ResourceIDs.AlphaChannelNames:
							imgRes = new AlphaChannels(imgRes);
							break;
					}

                    _imageResources.Add(imgRes);

				}
				// make sure we are not on a wrong offset, so set the stream position 
				// manually
				reader.BaseStream.Position = startPosition + imgResLength;

				#endregion //End LoadingImageResources


				#region "Layer and Mask Info"
				//We are gonna load up all the layers and masking of the PSD now.
				Debug.WriteLine("LoadLayerAndMaskInfo - Part1 started at " + reader.BaseStream.Position.ToString(CultureInfo.InvariantCulture));
				UInt32 layersAndMaskLength = reader.ReadUInt32();

				if (layersAndMaskLength <= 0) return null;

				//new start position
				startPosition = reader.BaseStream.Position;

				//Lets start by loading up all the layers
				LoadLayers(reader);
				//we are done the layers, load up the masks
				LoadGlobalLayerMask(reader);

				// make sure we are not on a wrong offset, so set the stream position 
				// manually
				reader.BaseStream.Position = startPosition + layersAndMaskLength;
				#endregion //End Layer and Mask info

				#region "Loading Final Image"

				//we have loaded up all the information from the PSD file
				//into variables we can use later on.

				//lets finish loading the raw data that defines the image 
				//in the picture.

				Debug.WriteLine("LoadImage started at " + reader.BaseStream.Position.ToString(CultureInfo.InvariantCulture));

				ImageCompression = (ImageCompression)reader.ReadInt16();

				ImageData = new Byte[_channels][];

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

				if (ImageCompression == ImageCompression.Rle)
				{
					// The RLE-compressed data is proceeded by a 2-byte data count for each row in the data,
					// which we're going to just skip.
					reader.BaseStream.Position += _rows * _channels * 2;
				}

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

				Int32 bytesPerRow = 0;

				switch (_depth)
				{
					case 1:
						bytesPerRow = _columns;//NOT Shure
						break;
					case 8:
						bytesPerRow = _columns;
						break;
					case 16:
						bytesPerRow = _columns * 2;
						break;
				}

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

				for (Int32 ch = 0; ch < _channels; ch++)
				{
					ImageData[ch] = new Byte[_rows * bytesPerRow];

					switch (ImageCompression)
					{
						case ImageCompression.Raw:
							reader.Read(ImageData[ch], 0, ImageData[ch].Length);
							break;
						case ImageCompression.Rle:
							{
								for (Int32 i = 0; i < _rows; i++)
								{
									Int32 rowIndex = i * _columns;
									RleHelper.DecodedRow(reader.BaseStream, ImageData[ch], rowIndex, bytesPerRow);
								}
							}
							break;
					}
				}

				#endregion //End LoadingFinalImage
			}

            return this;
		} //end Load()
示例#48
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            CTPhieuMua_DTO a = new CTPhieuMua_DTO();
            //a.SoPhieuMua = Int16.Parse(cbbSoPhieuMua.SelectedValue.ToString());
            int kieusp = -1;
            int loaisp = -1;

            a.STT = -1;
            if (txtSoPhieuMua.Text == "")
            {
                a.SoPhieuMua = -1;
            }
            else
            {
                a.SoPhieuMua = Int16.Parse(txtSoPhieuMua.Text);
            }
            if (txtSoLuong.Text == "")
            {
                a.SoLuong = -1;
            }
            else
            {
                a.SoLuong = Int16.Parse(txtSoLuong.Text);
            }
            if (txtCtTongTien.Text == "")
            {
                a.ThanhTien = -1;
            }
            else
            {
                a.ThanhTien = Int16.Parse(txtCtTongTien.Text);
            }
            if (txtDonGiaMua.Text == "")
            {
                a.DonGia = -1;
            }
            else
            {
                a.DonGia = Int16.Parse(txtDonGiaMua.Text);
            }
            if (cbbKieuSP.Text != "")
            {
                kieusp = Int16.Parse(cbbKieuSP.SelectedValue.ToString());
            }
            if (cbbLoaiSP.Text != "")
            {
                loaisp = Int16.Parse(cbbLoaiSP.SelectedValue.ToString());
            }
            dataGridView1.DataSource = ct.Search(a, kieusp, loaisp);
            dataGridView1.Columns["MaSP"].Visible           = false;
            dataGridView1.Columns["MaKieuSP"].Visible       = false;
            dataGridView1.Columns["MaLoaiSP"].Visible       = false;
            dataGridView1.Columns["SoLuong"].HeaderText     = "Số lượng";
            dataGridView1.Columns["DonGia"].HeaderText      = "Đơn giá";
            dataGridView1.Columns["ThanhTien"].HeaderText   = "Thành Tiền";
            dataGridView1.Columns["TenKieuSP"].HeaderText   = "Kiểu sản phẩm";
            dataGridView1.Columns["TenLoaiSP"].HeaderText   = "Loại sản phẩm";
            dataGridView1.Columns["TenKieuSP"].DisplayIndex = 2;
            dataGridView1.Columns["TenLoaiSP"].DisplayIndex = 3;
            dataGridView1.Columns["SoPhieuMua"].Visible     = false;
        }
 private void StopTheCompilerComplaining()
 {
     MajorVersion = 0;
     MinorVersion = 0;
     BuildNumber = 0;
     PlatformId = 0;
     CSDVersion = String.Empty;
     ServicePackMajor = 0;
     ServicePackMinor = 0;
     SuiteMask = 0;
     ProductType = 0;
     Reserved = 0;
 }
示例#50
0
 public LwmData()
 {
     Comment     = new char[80];
     LwmDataTime = new Int16[6];
 }
示例#51
0
 public override void WriteArray(string prefix, string localName, string namespaceUri, Int16[] array, int offset, int count)
 {
     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.JsonWriteArrayNotSupported)));
 }
 public static Int16 Parse(string value, PT_Int16 pt)
 {
     return(Int16.Parse(value, System.Globalization.CultureInfo.InvariantCulture));
 }
示例#53
0
 ///<include file='doc\XmlConvert.uex' path='docs/doc[@for="XmlConvert.ToString4"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public static string ToString(Int16 value)
 {
     return value.ToString(null, NumberFormatInfo.InvariantInfo);
 }
示例#54
0
 public Task(String msg, Int16 state = Constants.NEED_TO_DO)
 {
     this.msg = msg;
     this.state = state;
 }
示例#55
0
 public static string ToString(Int16 value)
 {
     return value.ToString();
 }
示例#56
0
        public static object ParseSimpleType(this string value, CachedType type)
        {
            if (type.Is <string>() || value == null)
            {
                return(value);
            }
            if (type.IsEnum)
            {
                return(value.ParseEnum(type, true));
            }
            switch (type.TypeCode)
            {
            case TypeCode.Char:
                if (value.Length == 1)
                {
                    return(value[0]);
                }
                throw new Exception("Char length {0} is invalid.".ToFormat(value.Length));

            case TypeCode.Boolean: return(Boolean.Parse(value.ToLower()));

            case TypeCode.SByte: return(SByte.Parse(value));

            case TypeCode.Byte: return(Byte.Parse(value));

            case TypeCode.Int16: return(Int16.Parse(value));

            case TypeCode.UInt16: return(UInt16.Parse(value));

            case TypeCode.Int32: return(Int32.Parse(value));

            case TypeCode.UInt32: return(UInt32.Parse(value));

            case TypeCode.Int64: return(Int64.Parse(value));

            case TypeCode.UInt64: return(UInt64.Parse(value));

            case TypeCode.Single: return(Single.Parse(value));

            case TypeCode.Double: return(Double.Parse(value));

            case TypeCode.Decimal: return(Decimal.Parse(value));

            case TypeCode.DateTime: return(value.TryParseMicrosoftJsonDateFormat() ?? DateTime.Parse(value));

            default:
                if (type.Is <Guid>(true))
                {
                    return(Guid.Parse(value));
                }
                if (type.Is <TimeSpan>(true))
                {
                    return(TimeSpan.Parse(value));
                }
                if (type.Is <Uri>())
                {
                    return(new Uri(value));
                }
                if (type.Is <IntPtr>(true))
                {
                    return(new IntPtr(Int64.Parse(value)));
                }
                if (type.Is <UIntPtr>(true))
                {
                    return(new UIntPtr(UInt64.Parse(value)));
                }
                throw new ArgumentException("Type '{0}' is not a simple type.".ToFormat(type));
            }
        }
示例#57
0
 public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, Int16[] array, int offset, int count)
 {
     if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int16TextWithEndElement) && BitConverter.IsLittleEndian)
         return ReadArray(array, offset, count);
     return base.ReadArray(localName, namespaceUri, array, offset, count);
 }
示例#58
0
        public SysLogMessage(string msg)
        {
            string headerstr;
            string structuredDatastr;
            string messagestr;

            if (formatregexp.IsMatch(msg))
            {
                GroupCollection mg = formatregexp.Match(msg).Groups;
                headerstr         = mg["head"].Value;
                structuredDatastr = mg["sd"].Value;
                messagestr        = mg["msg"].Success ? mg["msg"].Value : "";
                received          = DateTimeOffset.Now;
                prival            = byte.Parse(mg["pri"].Value);
                facility          = (Facilities)(prival / 8);
                severity          = (Severities)(prival % 8);
                version           = short.Parse("0" + mg["ver"].Value);
                if (mg["ed"].Success)
                {
                    string dto = mg["ed"].Value;
                    string fmt = @"yyyy\-MM\-dd\THH\:mm\:ss";
                    if (dto.IndexOf("Z") > -1)
                    {
                        dto = dto.Substring(0, dto.Length - 1) + "+00:00";
                    }
                    if (dto.IndexOf(".") > -1)
                    {
                        int nof = dto.Length - dto.IndexOf(".") - 7;
                        fmt += ".";
                        for (int i = 0; i < nof; i++)
                        {
                            fmt += "F";
                        }
                    }
                    fmt      += "zzz";
                    timestamp = DateTimeOffset.ParseExact(dto, fmt, System.Globalization.CultureInfo.InvariantCulture);
                    if (timestamp < DateTimeOffset.Parse("1900.01.01"))
                    {
                        timestamp = DateTimeOffset.Parse("1900.01.01");
                    }
                }
                else if (mg["ld"].Success)
                {
                    string dto = received.Year.ToString() + " " + mg["ld"].Value;
                    string fmt = @"yyyy\ MMM\ d\ H\:m\:s";
                    timestamp = DateTimeOffset.ParseExact(dto, fmt, System.Globalization.CultureInfo.InvariantCulture);
                }
                else
                {
                    timestamp = DateTimeOffset.Now;
                }
                hostname = mg["hn"].Value;
                appName  = mg["an"].Value;
                procID   = mg["pr"].Value;
                msgID    = mg["msgid"].Value;

                SD  = structuredDatastr;
                Msg = messagestr;
            }
            else if (bSDRE.IsMatch(msg))
            {
                GroupCollection mg = bSDRE.Match(msg).Groups;
                Msg       = mg["cnt"].Success ? mg["cnt"].Value : "";
                SD        = "-";
                prival    = byte.Parse(mg["pri"].Success ? mg["pri"].Value : "13");
                facility  = (Facilities)(prival / 8);
                severity  = (Severities)(prival % 8);
                version   = 0;
                Sender    = mg["hn"].Value;
                hostname  = mg["hn"].Value;
                appName   = mg["tag"].Success ? (mg["tag"].Value == "" ? "BSD" : mg["tag"].Value) : "BSD";
                procID    = "0";
                msgID     = "BSD";
                timestamp = DateTimeOffset.ParseExact(DateTimeOffset.Now.Year.ToString() + " " + mg["bsdts"].Value.Replace("  ", " "), "yyyy MMM d HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
                received  = DateTimeOffset.Now;
            }
            else
            {
                Header = "<13>1 - - - - -";
                SD     = "-";
                Msg    = msg;
            }
        }
示例#59
0
 Task()
 {
     msg = "";
     state = Constants.NEED_TO_DO;
 }
示例#60
0
 public static Watt Watts(this Int16 input) => new Watt(input);