Exemplo n.º 1
0
 // Token: 0x0600016F RID: 367 RVA: 0x00007A20 File Offset: 0x00005C20
 public static string smethod_6(string string_0, string string_1)
 {
     checked
     {
         string result;
         if (string_1.Length >= 10 && Versioned.IsNumeric(string_1.Substring(1, 9)))
         {
             string text  = string_0.Replace(":", "");
             ulong  value = (ulong)Convert.ToInt64(text, 16);
             text = Convert.ToUInt64(decimal.Subtract(new decimal(value), 2m)).ToString("X12");
             string text2 = string_1.Substring(1, 9);
             byte[] array = new byte[12];
             int    num   = 0;
             do
             {
                 array[11 - num] = (byte)Convert.ToInt32(text.Substring(num, 1), 16);
                 num++;
             }while (num <= 11);
             byte[] array2 = new byte[9];
             int    num2   = 0;
             do
             {
                 array2[8 - num2] = (byte)Convert.ToInt32(text2.Substring(num2, 1), 16);
                 num2++;
             }while (num2 <= 8);
             int num3;
             int num4;
             unchecked
             {
                 num3 = (int)((array2[2] + array2[3] + array[0] + array[1]) % 16);
                 num4 = (int)((array2[0] + array2[1] + array[2] + array[3]) % 16);
             }
             byte[] array3 = new byte[]
             {
                 (byte)((num3 ^ (int)array2[0]) % 16),
                 (byte)((num3 ^ (int)array2[1]) % 16),
                 (byte)((num4 ^ (int)array[2]) % 16),
                 (byte)((num4 ^ (int)array[1]) % 16),
                 (array[1] ^ array2[0]) % 16,
                 (array[0] ^ array2[1]) % 16,
                 (byte)((num3 ^ (int)array2[2]) % 16)
             };
             string text3 = "";
             int    num5  = 0;
             do
             {
                 text3 += Conversion.Hex(array3[num5]);
                 num5++;
             }while (num5 <= 6);
             text3  = (Convert.ToInt32(text3, 16) % 10000000).ToString();
             text3 += Conversions.ToString(GClass3.smethod_0(Conversions.ToInteger(text3.PadLeft(7, '0'))));
             result = text3.PadLeft(8, '0');
         }
         else
         {
             result = "";
         }
         return(result);
     }
 }
Exemplo n.º 2
0
    public string GetAttribute(string sTagName, string sKey, string sDefaut = "")
    {
        string text = "";

        try
        {
            XmlNodeList elementsByTagName = this.m_objXMLDoc.GetElementsByTagName(sTagName);
            if (elementsByTagName.Count > 0)
            {
                text = elementsByTagName[0].Attributes[sKey].Value;
                if (Versioned.IsNumeric(text))
                {
                    text = Strings.FormatNumber(Conversions.ToDouble(text), 0, TriState.UseDefault, TriState.UseDefault, TriState.UseDefault).ToString();
                }
            }
            if (string.IsNullOrEmpty(text))
            {
                text = sDefaut;
            }
        }
        catch (Exception expr_65)
        {
            ProjectData.SetProjectError(expr_65);
            ProjectData.ClearProjectError();
        }
        return(text);
    }
Exemplo n.º 3
0
        private static void HydrateObject(object objObject, IDataReader dr)
        {
            ArrayList propertyInfo = CBO.GetPropertyInfo(objObject.GetType());

            int[] ordinals = CBO.GetOrdinals(propertyInfo, dr);
            int   num1     = 0;
            int   num2     = checked (propertyInfo.Count - 1);
            int   index    = num1;

            while (index <= num2)
            {
                PropertyInfo objPropertyInfo = (PropertyInfo)propertyInfo[index];
                Type         propertyType    = objPropertyInfo.PropertyType;
                if (objPropertyInfo.CanWrite && ordinals[index] != -1)
                {
                    object objectValue = RuntimeHelpers.GetObjectValue(dr.GetValue(ordinals[index]));
                    Type   type        = objectValue.GetType();
                    if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(objectValue)))
                    {
                        objPropertyInfo.SetValue(RuntimeHelpers.GetObjectValue(objObject), RuntimeHelpers.GetObjectValue(Null.SetNull(objPropertyInfo)), (object[])null);
                    }
                    else if (propertyType.Equals(type))
                    {
                        objPropertyInfo.SetValue(RuntimeHelpers.GetObjectValue(objObject), RuntimeHelpers.GetObjectValue(objectValue), (object[])null);
                    }
                    else
                    {
                        try
                        {
                            if (propertyType.BaseType.Equals(typeof(Enum)))
                            {
                                if (Versioned.IsNumeric(RuntimeHelpers.GetObjectValue(objectValue)))
                                {
                                    objPropertyInfo.SetValue(RuntimeHelpers.GetObjectValue(objObject), RuntimeHelpers.GetObjectValue(Enum.ToObject(propertyType, Convert.ToInt32(RuntimeHelpers.GetObjectValue(objectValue)))), (object[])null);
                                }
                                else
                                {
                                    objPropertyInfo.SetValue(RuntimeHelpers.GetObjectValue(objObject), RuntimeHelpers.GetObjectValue(Enum.ToObject(propertyType, RuntimeHelpers.GetObjectValue(objectValue))), (object[])null);
                                }
                            }
                            else if (propertyType.FullName.Equals("System.Guid"))
                            {
                                objPropertyInfo.SetValue(RuntimeHelpers.GetObjectValue(objObject), RuntimeHelpers.GetObjectValue(Convert.ChangeType((object)new Guid(objectValue.ToString()), propertyType)), (object[])null);
                            }
                            else
                            {
                                objPropertyInfo.SetValue(RuntimeHelpers.GetObjectValue(objObject), RuntimeHelpers.GetObjectValue(objectValue), (object[])null);
                            }
                        }
                        catch (Exception ex)
                        {
                            ProjectData.SetProjectError(ex);
                            objPropertyInfo.SetValue(RuntimeHelpers.GetObjectValue(objObject), RuntimeHelpers.GetObjectValue(Convert.ChangeType(RuntimeHelpers.GetObjectValue(objectValue), propertyType)), (object[])null);
                            ProjectData.ClearProjectError();
                        }
                    }
                }
                checked { ++index; }
            }
        }
Exemplo n.º 4
0
 public static void validaInt(ref object objDestino, object valor)
 {
     if (!Versioned.IsNumeric(RuntimeHelpers.GetObjectValue(valor)))
     {
         return;
     }
     objDestino = (object)Conversions.ToInteger(valor);
 }
Exemplo n.º 5
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (Versioned.IsNumeric((object)Conversions.ToString(value)))
     {
         return((object)Hues.GetHue(Conversions.ToInteger(value)));
     }
     return((object)Hues.GetHue(HexHelper.HexToDec(Conversions.ToString(value))));
 }
Exemplo n.º 6
0
        public int Compare(object x, object y)
        {
            ListViewItem listViewItem  = (ListViewItem)x;
            ListViewItem listViewItem2 = (ListViewItem)y;
            string       text;

            if (listViewItem.SubItems.Count <= this.int_0)
            {
                text = "";
            }
            else
            {
                text = listViewItem.SubItems[this.int_0].Text;
            }
            string text2;

            if (listViewItem2.SubItems.Count <= this.int_0)
            {
                text2 = "";
            }
            else
            {
                text2 = listViewItem2.SubItems[this.int_0].Text;
            }
            int result;

            if (this.sortOrder_0 == SortOrder.Ascending)
            {
                if (Versioned.IsNumeric(text) & Versioned.IsNumeric(text2))
                {
                    result = Conversion.Val(text).CompareTo(Conversion.Val(text2));
                }
                else if (Information.IsDate(text) & Information.IsDate(text2))
                {
                    result = DateTime.Parse(text).CompareTo(DateTime.Parse(text2));
                }
                else
                {
                    result = string.Compare(text, text2);
                }
            }
            else if (Versioned.IsNumeric(text) & Versioned.IsNumeric(text2))
            {
                result = Conversion.Val(text2).CompareTo(Conversion.Val(text));
            }
            else if (Information.IsDate(text) & Information.IsDate(text2))
            {
                result = DateTime.Parse(text2).CompareTo(DateTime.Parse(text));
            }
            else
            {
                result = string.Compare(text2, text);
            }
            return(result);
        }
Exemplo n.º 7
0
        private static bool OkToSave()
        {
            bool flag;

            if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(mdUtility.fMainForm.txtBuildingNumber.Text, "", false) == 0 & Microsoft.VisualBasic.CompilerServices.Operators.CompareString(mdUtility.fMainForm.txtBuildingName.Text, "", false) == 0)
            {
                int num = (int)Interaction.MsgBox((object)"You must enter a Bldg No. or a Bldg. Name.", MsgBoxStyle.Critical, (object)"Missing Required Field.");
                flag = false;
            }
            else if (!Versioned.IsNumeric((object)mdUtility.fMainForm.txtYearBuilt.Text))
            {
                int num = (int)Interaction.MsgBox((object)"You must enter a valid year in for the built year.", MsgBoxStyle.Critical, (object)null);
                flag = false;
            }
            else if (Conversions.ToInteger(mdUtility.fMainForm.txtYearBuilt.Text) < 1750 | Conversions.ToInteger(mdUtility.fMainForm.txtYearBuilt.Text) > 2100)
            {
                int num = (int)Interaction.MsgBox((object)"You must enter a valid year for the built year.", MsgBoxStyle.Critical, (object)null);
                flag = false;
            }
            else if (!Versioned.IsNumeric((object)mdUtility.fMainForm.txtNoFloors.Text))
            {
                int num = (int)Interaction.MsgBox((object)"You must enter a valid number for the floor count.", MsgBoxStyle.Critical, (object)null);
                flag = false;
            }
            else if (!Versioned.IsNumeric((object)mdUtility.fMainForm.txtBldgArea.Text))
            {
                int num = (int)Interaction.MsgBox((object)"You must enter a valid quantity for the Bldg Area.", MsgBoxStyle.Critical, (object)null);
                flag = false;
            }
            else if ((uint)Microsoft.VisualBasic.CompilerServices.Operators.CompareString(mdUtility.fMainForm.txtYearRenovated.Text, "", false) > 0U)
            {
                if (!Versioned.IsNumeric((object)mdUtility.fMainForm.txtYearRenovated.Text))
                {
                    int num = (int)Interaction.MsgBox((object)"You must enter a valid year for the year renovated.", MsgBoxStyle.Critical, (object)null);
                    flag = false;
                }
                else if (Conversions.ToInteger(mdUtility.fMainForm.txtYearRenovated.Text) < Conversions.ToInteger(mdUtility.fMainForm.txtYearBuilt.Text))
                {
                    int num = (int)Interaction.MsgBox((object)"Year Renovated must be later than the Year Built.", MsgBoxStyle.Critical, (object)null);
                    flag = false;
                }
                else
                {
                    flag = true;
                }
            }
            else
            {
                flag = true;
            }
            return(flag);
        }
Exemplo n.º 8
0
 private void cmdSetWeightManual_Click(object eventSender, EventArgs eventArgs)
 {
     if (!Versioned.IsNumeric(this.txtWeight.Text) | !Versioned.IsNumeric(this.txtVarNo.Text))
     {
         MiscFUncs.MsgBox_Renamed("Not a number", 0x30, "Not a number");
     }
     else
     {
         this.m_TempWeights[Conversions.ToInteger(this.txtVarNo.Text)] = Conversions.ToSingle(this.txtWeight.Text);
         this.DisplayWeights();
         this.lblWeightSum.Text = Support.Format(Conversions.ToString(this.ComputeWeightSum()), "#.###", FirstDayOfWeek.Sunday, FirstWeekOfYear.Jan1);
     }
 }
Exemplo n.º 9
0
        private void TextBox2_TextChanged(object sender, EventArgs e)
        {
            TextBox textBox = (TextBox)sender;

            if (Versioned.IsNumeric((object)textBox.Text))
            {
                this.ReadCount = checked ((uint)Math.Round(Conversion.Val(textBox.Text)));
            }
            else
            {
                textBox.Text = this.ReadCount.ToString();
            }
        }
Exemplo n.º 10
0
        // Token: 0x06000078 RID: 120 RVA: 0x0000C3B8 File Offset: 0x0000A5B8
        public int Compare(object \u0002, object \u0003)
        {
            ListViewItem listViewItem  = (ListViewItem)\u0002;
            ListViewItem listViewItem2 = (ListViewItem)\u0003;
            string       text;

            if (listViewItem.SubItems.Count <= this.\u0002)
            {
                text = string.Empty;
            }
            else
            {
                text = listViewItem.SubItems[this.\u0002].Text;
            }
            string text2;

            if (listViewItem2.SubItems.Count <= this.\u0002)
            {
                text2 = string.Empty;
            }
            else
            {
                text2 = listViewItem2.SubItems[this.\u0002].Text;
            }
            if (this.\u0003 == SortOrder.Ascending)
            {
                if (Versioned.IsNumeric(text) & Versioned.IsNumeric(text2))
                {
                    return(Conversion.Val(text).CompareTo(Conversion.Val(text2)));
                }
                if (Information.IsDate(text) & Information.IsDate(text2))
                {
                    return(DateTime.Parse(text).CompareTo(DateTime.Parse(text2)));
                }
                return(string.Compare(text, text2));
            }
            else
            {
                if (Versioned.IsNumeric(text) & Versioned.IsNumeric(text2))
                {
                    return(Conversion.Val(text2).CompareTo(Conversion.Val(text)));
                }
                if (Information.IsDate(text) & Information.IsDate(text2))
                {
                    return(DateTime.Parse(text2).CompareTo(DateTime.Parse(text)));
                }
                return(string.Compare(text2, text));
            }
        }
Exemplo n.º 11
0
        public static string BrojDodajPraznine(object vbroj)
        {
            decimal num = 0;

            if (Versioned.IsNumeric(RuntimeHelpers.GetObjectValue(vbroj)))
            {
                num = decimal.Parse(Conversions.ToString(vbroj));
            }
            else
            {
                num = new decimal();
            }
            string expression = "";

            expression = Conversions.ToString(num);
            return(expression + Strings.Space(8 - Strings.Len(expression)) + "-");
        }
Exemplo n.º 12
0
        private void bttnMiscellaneous_Click(object sender, EventArgs e)
        {
            decimal num = Conversions.ToDecimal(Interaction.InputBox("Enter a Number", "", "", -1, -1));

            if (!Versioned.IsNumeric(num))
            {
                Interaction.MsgBox("Numeric values allowed only.", MsgBoxStyle.OkOnly, null);
            }
            else if (this.rbEftpos.Checked)
            {
                this.lstbox01.Items.Add(string.Concat("$", Conversions.ToString(num), "    Misc    Eftpos"));
                this.LblTotalDollars.Text = Conversions.ToString(Conversions.ToDouble(this.LblTotalDollars.Text) + Convert.ToDouble(num));
            }
            else if (this.rbCash.Checked)
            {
                this.lstbox01.Items.Add(string.Concat("$", Conversions.ToString(num), "    Misc    Cash"));
                this.LblTotalDollars.Text = Conversions.ToString(Conversions.ToDouble(this.LblTotalDollars.Text) + Convert.ToDouble(num));
            }
        }
Exemplo n.º 13
0
        public static string GetAs_Function(string Txt)
        {
            Txt = Strings.Replace(Txt, "-", "@", 1, -1, CompareMethod.Binary);
            string expression = Txt.Substring(0, 1);

            if (!Versioned.IsNumeric(expression))
            {
                int num = Strings.InStr(Txt, " ", CompareMethod.Binary);
                if (num > 0)
                {
                    Txt = Txt.Substring(num);
                    Txt = Strings.Trim(Txt);
                }
            }
            checked
            {
                short  num2 = (short)Strings.InStr(Txt, "@", CompareMethod.Binary);
                string result;
                if (num2 > 0)
                {
                    result = JG.GetSteels2(Txt);
                }
                else
                {
                    short num3 = (short)Strings.InStr(Txt, ";", CompareMethod.Binary);
                    if (num3 > 0)
                    {
                        result = JG.Getsteels3(Txt).ToString();
                    }
                    else
                    {
                        string s    = Txt;
                        int    num4 = 0;
                        result = JG.GetSteels1(s, ref num4).ToString();
                    }
                }
                return(result);
            }
        }
Exemplo n.º 14
0
        public static string BrojVodecePraznine(object vBroj, int nBrojCijelihMjesta, int nBrojDecimalnihMjesta, bool bDecimalniZnak = true, string sDecimalniZnak = "")
        {
            decimal num = 0;

            if (Versioned.IsNumeric(RuntimeHelpers.GetObjectValue(vBroj)))
            {
                num = decimal.Parse(Conversions.ToString(vBroj));
            }
            else
            {
                num = new decimal();
            }
            string str2 = "";

            if (nBrojCijelihMjesta > 0)
            {
                str2 = Conversion.Fix(num).ToString("0").PadLeft(nBrojCijelihMjesta).Substring(0, nBrojCijelihMjesta);
            }
            else
            {
                str2 = Conversion.Fix(num).ToString("0");
            }
            if (bDecimalniZnak)
            {
                if (sDecimalniZnak == "")
                {
                    int num3 = 0;
                    sDecimalniZnak = num3.ToString("0.0").Substring(1, 1);
                }
                str2 = str2 + sDecimalniZnak;
            }
            if (nBrojDecimalnihMjesta > 0)
            {
                string str3 = num.ToString("0." + new string('0', nBrojDecimalnihMjesta));
                str3 = str3.Substring(str3.Length - 2, 2);
                str2 = str2 + str3;
            }
            return(str2);
        }
        public static double Val(object Expression)
        {
            string str2;
            string inputStr = Expression as string;

            if (inputStr != null)
            {
                return(Val(inputStr));
            }
            if (Expression is char)
            {
                return((double)Val((char)Expression));
            }
            if (Versioned.IsNumeric(Expression))
            {
                return(Conversions.ToDouble(Expression));
            }
            try
            {
                str2 = Conversions.ToString(Expression);
            }
            catch (StackOverflowException exception)
            {
                throw exception;
            }
            catch (OutOfMemoryException exception2)
            {
                throw exception2;
            }
            catch (ThreadAbortException exception3)
            {
                throw exception3;
            }
            catch (Exception)
            {
                throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_InvalidValueType2", new string[] { "Expression", Utils.VBFriendlyName(Expression) })), 0x1b6);
            }
            return(Val(str2));
        }
Exemplo n.º 16
0
 public clsDb(OleDbDataReader dr, object Comment, string Dir)
 {
     this.myTags   = new Collection();
     this.myId     = Conversions.ToInteger(dr["OBJECTID"]);
     this.myNumber = Conversions.ToInteger(dr["BLKNUMBER"]);
     if (!Information.IsDBNull(dr["MC5LEN"]) && Versioned.IsNumeric(dr["MC5LEN"]))
     {
         this.myLength = Conversions.ToInteger(dr["MC5LEN"]);
     }
     if (!Information.IsDBNull(dr["BLOCKNAME"]))
     {
         this.myName = Conversions.ToString(dr["BLOCKNAME"]);
     }
     if (!Information.IsDBNull(dr["BLOCKFNAME"]))
     {
         this.myFamily = Conversions.ToString(dr["BLOCKFNAME"]);
     }
     if (!Information.IsDBNull(dr["USERNAME"]))
     {
         this.MyAuthor = Conversions.ToString(dr["USERNAME"]);
     }
     if (!Information.IsDBNull(Comment))
     {
         object[] objArray;
         bool[]   flagArray;
         Encoding instance   = Encoding.Default;
         object[] objArray1  = new object[] { Comment };
         bool[]   flagArray1 = new bool[] { true };
         byte[]   bytes      = (byte[])NewLateBinding.LateGet(instance, null, "GetBytes", objArray = objArray1, null, null, flagArray = flagArray1);
         if (flagArray[0])
         {
             Comment = objArray[0];
         }
         this.myComment   = instance.GetString(bytes, 3, bytes.GetLength(0) - 4);
         this.myDirectory = Dir;
     }
     this.myVersion  = Conversions.ToString(Operators.ConcatenateObject(Conversions.ToString(Conversions.ToInteger(Operators.SubtractObject(Operators.DivideObject(dr["VERSION"], (int)0x10), 0.499))) + ".", Operators.ModObject(dr["VERSION"], 8)));
     this.myReadDone = false;
 }
Exemplo n.º 17
0
        public int ComputeNumberOfSims()
        {
            AxMSFlexGrid grdParameters = this.grdParameters;
            int          num           = 1;
            short        num3          = (short)(grdParameters.Rows - 1);
            short        row           = 1;

            while (true)
            {
                short num4 = num3;
                if (row > num4)
                {
                    grdParameters = null;
                    return(num);
                }
                if (!Versioned.IsNumeric(grdParameters.get_TextMatrix(row, 3)))
                {
                    grdParameters.set_TextMatrix(row, 3, Conversions.ToString(1));
                }
                num *= Conversions.ToShort(grdParameters.get_TextMatrix(row, 3));
                row  = (short)(row + 1);
            }
        }
Exemplo n.º 18
0
        public static decimal N20(object vNumber)
        {
            if (!IsDBNull(RuntimeHelpers.GetObjectValue(vNumber)) & (vNumber != null))
            {
                decimal zero;
                if (!Versioned.IsNumeric(RuntimeHelpers.GetObjectValue(vNumber)))
                {
                    return(decimal.Zero);
                }
                try
                {
                    zero = decimal.Parse(Conversions.ToString(vNumber));
                }
                catch (System.Exception exception1)
                {
                    throw exception1;

                    //zero = decimal.Zero;
                }
                return(zero);
            }
            return(decimal.Zero);
        }
Exemplo n.º 19
0
        public static string BrojVodeceNule(object vBroj, int nBrojCijelihMjesta, int nBrojDecimalnihMjesta, bool bDecimalniZnak = true, string sDecimalniZnak = "")
        {
            decimal number = Versioned.IsNumeric(RuntimeHelpers.GetObjectValue(vBroj)) ? decimal.Parse(Conversions.ToString(vBroj)) : decimal.Zero;
            string  str2   = "";

            str2 = (nBrojCijelihMjesta > 0) ? Conversion.Fix(number).ToString(new string('0', nBrojCijelihMjesta)).Substring(0, nBrojCijelihMjesta) : Conversion.Fix(number).ToString("0");
            if (bDecimalniZnak)
            {
                if (sDecimalniZnak == "")
                {
                    int num4 = 0;
                    sDecimalniZnak = num4.ToString("0.0").Substring(1, 1);
                }
                str2 = str2 + sDecimalniZnak;
            }
            if (nBrojDecimalnihMjesta > 0)
            {
                string str3 = number.ToString("0." + new string('0', nBrojDecimalnihMjesta));
                str3 = str3.Substring(str3.Length - 2, 2);
                str2 = str2 + str3;
            }
            return(str2);
        }
Exemplo n.º 20
0
        internal static int GetDecValue(string Text)
        {
            int num2 = -1;

            try
            {
                string expression = Text.Substring(1);
                if (!Versioned.IsNumeric(expression))
                {
                    return(num2);
                }
                int num3 = (int)Math.Round(Conversion.Val(expression));
                if ((num3 <= 0xffffL) & (num3 >= 0))
                {
                    num2 = num3;
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
            }
            return(num2);
        }
Exemplo n.º 21
0
            // Token: 0x06000987 RID: 2439 RVA: 0x00052570 File Offset: 0x00050770
            public int Compare(object x, object y)
            {
                ListViewItem listViewItem  = (ListViewItem)x;
                ListViewItem listViewItem2 = (ListViewItem)y;
                string       text          = (listViewItem.SubItems.Count > this.m_ColumnNumber) ? listViewItem.SubItems[this.m_ColumnNumber].Text : "";
                string       text2         = (listViewItem2.SubItems.Count > this.m_ColumnNumber) ? listViewItem2.SubItems[this.m_ColumnNumber].Text : "";
                int          result;

                if (this.m_SortOrder == SortOrder.Ascending)
                {
                    if (Versioned.IsNumeric(text) & Versioned.IsNumeric(text2))
                    {
                        result = Conversion.Val(text).CompareTo(Conversion.Val(text2));
                    }
                    else if (!(Information.IsDate(text) & Information.IsDate(text2)))
                    {
                        result = string.Compare(text, text2);
                    }
                    else
                    {
                        result = DateTime.Parse(text).CompareTo(DateTime.Parse(text2));
                    }
                }
                else if (Versioned.IsNumeric(text) & Versioned.IsNumeric(text2))
                {
                    result = Conversion.Val(text2).CompareTo(Conversion.Val(text));
                }
                else if (!(Information.IsDate(text) & Information.IsDate(text2)))
                {
                    result = string.Compare(text2, text);
                }
                else
                {
                    result = DateTime.Parse(text2).CompareTo(DateTime.Parse(text));
                }
                return(result);
            }
Exemplo n.º 22
0
        public int Vrati1(object vnumber)
        {
            int num = 0;

            if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(vnumber)) | (vnumber == null))
            {
                return(-1);
            }
            if (!Versioned.IsNumeric(RuntimeHelpers.GetObjectValue(vnumber)))
            {
                return(-1);
            }
            try
            {
                num = int.Parse(Conversions.ToString(vnumber));
            }
            catch (System.Exception exception1)
            {
                throw exception1;

                //num = -1;
            }
            return(num);
        }
Exemplo n.º 23
0
 private void OKButton_Click(object eventSender, EventArgs eventArgs)
 {
     try
     {
         if (!Versioned.IsNumeric((object)this.txtAreaSize.Text) || Conversions.ToDouble(this.txtAreaSize.Text) <= 0.0)
         {
             int num1 = (int)Interaction.MsgBox((object)"Area size must be a positive number.", MsgBoxStyle.Critical, (object)null);
         }
         else
         {
             int    integer1 = Conversions.ToInteger(this.cboAreaType.SelectedValue);
             int    integer2 = Conversions.ToInteger(this.cboUseType.SelectedValue);
             double AreaSize = double.Parse(this.txtAreaSize.Text.ToString());
             string str      = FunctionalArea.AddFuncArea(this.txtAreaName.Text, mdUtility.fMainForm.CurrentBldg, integer1, integer2, AreaSize, this.lblAreaSize.Text);
             if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(str, "Duplicate", false) == 0)
             {
                 int num2 = (int)Interaction.MsgBox((object)"Functional Area Already Exists", MsgBoxStyle.Critical, (object)null);
                 this.txtAreaName.Text = "";
                 this.txtAreaName.Focus();
             }
             else if ((uint)Microsoft.VisualBasic.CompilerServices.Operators.CompareString(str, "", false) > 0U)
             {
                 MyProject.Forms.frmMain.tvFunctionality.ActiveNode = MyProject.Forms.frmMain.tvFunctionality.GetNodeByKey(str);
                 MyProject.Forms.frmMain.tvFunctionality.Refresh();
                 mdHierarchyFunction.LoadFunctionalityTree();
                 this.Close();
             }
         }
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         mdUtility.Errorhandler(ex, nameof(frmNewFuncArea), nameof(OKButton_Click));
         ProjectData.ClearProjectError();
     }
 }
Exemplo n.º 24
0
 private void BtnCreateNewMap_Click(object sender, EventArgs e)
 {
     if (this.CmbBiomes.SelectedIndex < 0 | Operators.CompareString(this.TxtMapName.Text, "", false) == 0 | Operators.CompareString(this.TxtWorldSize.Text, "", false) == 0 | !Versioned.IsNumeric(this.TxtWorldSize.Text))
     {
         Interaction.MsgBox("Please recorrect the details.", MsgBoxStyle.OkOnly, null);
     }
     else if (Conversion.Val(this.TxtWorldSize.Text) > 20)
     {
         Main.MapVariablePipeline.NewMap          = true;
         Main.MapVariablePipeline.NewMapBiome     = this.CmbBiomes.SelectedIndex;
         Main.MapVariablePipeline.NewMapSpeedSave = this.ChkSS.Checked;
         Main.MapVariablePipeline.NewMapSize      = checked ((int)Math.Round(Conversion.Val(this.TxtWorldSize.Text)));
         Main.CurrentMapName = this.TxtMapName.Text;
         Main.ShowLoger();
         base.Hide();
         Main.StartGame();
     }
     else
     {
         Interaction.MsgBox("World size must be geater than 20", MsgBoxStyle.OkOnly, null);
     }
 }
Exemplo n.º 25
0
        private short method_6(string[] string_5, ref double double_0, ref double double_1, ref double double_2, ref string[] string_6, ref long long_0, ref long long_1)
        {
            int    num;
            int    num15;
            object obj;

            try
            {
IL_01:
                ProjectData.ClearProjectError();
                num = -2;
IL_09:
                int num2 = 2;
IL_0B:
                num2 = 3;
                long num3 = (long)Information.UBound(string_5, 1);
IL_17:
                num2 = 4;
                short num4 = 0;
                short num5 = checked ((short)num3);
                short num6 = num4;
                int   num11;
                long  steels;
                long  steels2;
                long  steels3;
                for (;;)
                {
                    short num7 = num6;
                    short num8 = num5;
                    if (num7 > num8)
                    {
                        break;
                    }
IL_2E:
                    num2 = 5;
                    string text = string_5[(int)num6];
IL_36:
                    num2 = 6;
                    checked
                    {
                        int num9 = Strings.InStr(Strings.UCase(text), "X", CompareMethod.Binary) + Strings.InStr(text, " ", CompareMethod.Binary);
IL_5A:
                        num2 = 7;
                        string text2 = text.Substring(0, 1);
IL_67:
                        num2 = 8;
                        if (Strings.Asc(Strings.UCase(text2)) <= 90 & Strings.Asc(Strings.UCase(text2)) >= 65)
                        {
IL_92:
                            num2 = 9;
                        }
                        else
                        {
IL_9A:
                            num2 = 11;
IL_9D:
                            num2 = 12;
                            if (num9 > 0)
                            {
IL_A7:
                                num2   = 13;
                                long_0 = Conversions.ToLong(text.Substring(0, num9 - 1));
IL_BE:
                                num2   = 14;
                                long_1 = Conversions.ToLong(text.Substring(num9));
                            }
IL_D2:
                            num2 = 16;
                            if (Versioned.IsNumeric(text2) & num9 == 0)
                            {
IL_E4:
                                num2 = 17;
                                int num10;
                                if (num10 == 0)
                                {
IL_EE:
                                    num2   = 18;
                                    steels = this.GetSteels1(text, ref num11);
                                }
                                else
                                {
IL_FF:
                                    num2 = 20;
                                    if (num10 == 1)
                                    {
IL_109:
                                        num2 = 21;
                                        string s     = text;
                                        int    num12 = 0;
                                        steels2 = this.GetSteels1(s, ref num12);
                                    }
                                    else
                                    {
IL_11C:
                                        num2 = 23;
                                        if (num10 == 2)
                                        {
IL_126:
                                            num2 = 24;
                                            string s2    = text;
                                            int    num12 = 0;
                                            steels3 = this.GetSteels1(s2, ref num12);
                                        }
                                    }
                                }
IL_16A:
                                num2 = 26;
                                num10++;
                            }
                        }
IL_13A:
                        num2 = 29;
                        if (text.Contains("@"))
                        {
IL_14B:
                            num2           = 30;
                            this.KoyaxhoKD = JG.GetGuJin(text);
                        }
IL_15B:
                        num2 = 32;
                    }
                    num6 += 1;
                }
IL_175:
                num2 = 33;
                if (!(long_0 == 0L | long_1 == 0L))
                {
                    goto IL_19C;
                }
IL_197:
                goto IL_844;
IL_19C:
                num2 = 36;
                if (!(steels2 == 0L & steels3 == 0L))
                {
                    goto IL_201;
                }
IL_1BB:
                num2     = 37;
                double_0 = (double)steels / (double)num11 * 4.0;
IL_1D1:
                num2     = 38;
                double_1 = (double)steels / (double)num11 * ((double)(checked (num11 - 4)) / 4.0 + 2.0);
IL_1F7:
                num2     = 39;
                double_2 = double_1;
                goto IL_238;
IL_201:
                num2 = 41;
IL_204:
                num2     = 42;
                double_0 = (double)steels;
IL_20C:
                num2     = 43;
                double_1 = (double)steels / 2.0 + (double)steels2;
IL_221:
                num2     = 44;
                double_2 = (double)steels / 2.0 + (double)steels3;
IL_238:
                num2 = 46;
                long num13 = checked (steels + 2L * steels2 + 2L * steels3);
IL_258:
                num2     = 47;
                string_6 = new string[7];
IL_264:
                num2        = 50;
                string_6[0] = "柱子截面------" + Conversions.ToString(long_0) + "x" + Conversions.ToString(long_1);
IL_28B:
                num2 = 51;
                this.ListBox1.Items.Add(string_6[0]);
IL_2A4:
                num2        = 52;
                string_6[1] = "全截面As------" + Conversions.ToString(num13);
IL_2BD:
                num2 = 53;
                this.ListBox1.Items.Add(string_6[1]);
IL_2D6:
                num2        = 54;
                string_6[2] = "全截面ρ------" + Strings.Format((double)num13 / (double)long_0 / (double)long_1 * 100.0, "0.0000") + "%";
IL_313:
                num2 = 55;
                this.ListBox1.Items.Add(string_6[2]);
IL_32C:
                num2 = 56;
                checked
                {
                    string_6[3] = "角筋面积------" + Conversions.ToString((long)Math.Round(double_0 / 4.0)) + "x4=" + Conversions.ToString((long)Math.Round(double_0));
IL_367:
                    num2 = 57;
                    this.ListBox1.Items.Add(string_6[3]);
IL_380:
                    num2        = 58;
                    string_6[4] = "单侧As----X=" + Conversions.ToString((long)Math.Round(double_1)) + " / Y= " + Conversions.ToString((long)Math.Round(double_2));
IL_3B2:
                    num2 = 59;
                    this.ListBox1.Items.Add(string_6[4]);
IL_3CB:
                    num2        = 60;
                    string_6[5] = string.Concat(unchecked (new string[]
                    {
                        "单侧ρ----X=",
                        Strings.Format(double_1 / (double)long_0 / (double)long_1 * 100.0, "0.0000"),
                        "% / Y= ",
                        Strings.Format(double_2 / (double)long_0 / (double)long_1 * 100.0, "0.0000"),
                        "%"
                    }));
IL_450:
                    num2 = 61;
                    this.ListBox1.Items.Add(string_6[5]);
IL_469:
                    num2 = 62;
                    if (this.KoyaxhoKD.AsvD == 0)
                    {
                        goto IL_4AD;
                    }
IL_47F:
                    num2 = 63;
                    this.ListBox1.Items.Add("箍筋直径------" + Conversions.ToString((int)this.KoyaxhoKD.AsvD));
IL_4AD:
                    num2 = 65;
                    if (this.KoyaxhoKD.JianJu1 == 0L)
                    {
                        goto IL_4F9;
                    }
IL_4CB:
                    num2 = 66;
                    this.ListBox1.Items.Add("加密区间距----" + Conversions.ToString(this.KoyaxhoKD.JianJu1));
IL_4F9:
                    num2 = 68;
                    if (this.KoyaxhoKD.JianJu2 == 0L)
                    {
                        goto IL_545;
                    }
IL_517:
                    num2 = 69;
                    this.ListBox1.Items.Add("非加密区间距--" + Conversions.ToString(this.KoyaxhoKD.JianJu2));
IL_545:
                    num2 = 71;
                    if (this.KoyaxhoKD.Asv1 == 0L)
                    {
                        goto IL_591;
                    }
IL_563:
                    num2 = 72;
                    this.ListBox1.Items.Add("加密区间距----" + Conversions.ToString(this.KoyaxhoKD.Asv1));
IL_591:
                    num2 = 74;
                    if (this.KoyaxhoKD.Asv2 == 0L)
                    {
                        goto IL_5DD;
                    }
IL_5AF:
                    num2 = 75;
                    this.ListBox1.Items.Add("非加密区间距--" + Conversions.ToString(this.KoyaxhoKD.Asv2));
IL_5DD:
                    num2 = 77;
                    if (this.KoyaxhoKD.Asv2 != 0L)
                    {
                        goto IL_611;
                    }
IL_5F8:
                    num2 = 78;
                    this.KoyaxhoKD.Asv2 = this.KoyaxhoKD.Asv1;
IL_611:
                    num2 = 80;
                    this.Label11.Text = "G" + Strings.Format((double)(this.KoyaxhoKD.Asv1 * 100L) / (double)this.KoyaxhoKD.JianJu1 / 1000.0, "0.0") + "-" + Strings.Format((double)(this.KoyaxhoKD.Asv2 * 100L) / (double)this.KoyaxhoKD.JianJu1 / 1000.0, "0.0");
IL_6A6:
                    goto IL_844;
                    IL_6AB :;
                }
                int num14 = num15 + 1;
                num15 = 0;
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num14);
IL_7FD:
                goto IL_839;
IL_7FF:
                num15 = num2;
                if (num <= -2)
                {
                    goto IL_6AB;
                }
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num);
                IL_817 :;
            }
            catch when(endfilter(obj is Exception & num != 0 & num15 == 0))
            {
                Exception ex = (Exception)obj2;

                goto IL_7FF;
            }
IL_839:
            throw ProjectData.CreateProjectError(-2146828237);
IL_844:
            short num16;
            short result = num16;

            if (num15 != 0)
            {
                ProjectData.ClearProjectError();
            }
            return(result);
        }
Exemplo n.º 26
0
 public void IsNumeric(object value, bool expected)
 {
     Assert.Equal(expected, Versioned.IsNumeric(value));
 }
Exemplo n.º 27
0
        public static bool ValidateCRNumber(string crNumber, ref string reasonForFailure)
        {
            int[] numArray = new int[3];
            crNumber         = Strings.UCase(Strings.Trim(crNumber));
            reasonForFailure = "A valid Change Request must start with the letters CR.";
            bool flag = Strings.Left(crNumber, 2) == "CR";

            if (flag)
            {
                string[] array = Strings.Split(crNumber, "-", -1, CompareMethod.Binary);
                flag             = Information.UBound(array, 1) == 1;
                reasonForFailure = "A valid CR number contains a CR number as well as a date, separated by a hyphen (CR[0..9]-MMDDYY)";
                if (flag)
                {
                    flag = Strings.Len(array[1]) >= 6;
                    if (flag)
                    {
                        reasonForFailure = "The date portion of the CR number is invalid.";
                        numArray[0]      = Conversions.ToInteger(Strings.Left(array[1], 2));
                        numArray[1]      = Conversions.ToInteger(Strings.Mid(array[1], 3, 2));
                        string expression = Strings.Right(array[1], Strings.Len(array[1]) - 4);
                        if (Strings.Len(expression) == 2)
                        {
                            numArray[2] = 0x7d0 + Conversions.ToInteger(expression);
                        }
                        else if (Strings.Len(expression) == 4)
                        {
                            numArray[2] = Conversions.ToInteger(expression);
                        }
                        else
                        {
                            flag = false;
                        }
                    }
                    if (flag)
                    {
                        reasonForFailure = "The date portion is in 'MMDDYY' format'. You entered an invalid month.";
                        flag             = (numArray[0] >= 1) & (numArray[0] <= 12);
                        if (flag)
                        {
                            reasonForFailure = "The date portion is in 'MMDDYY' format'. You entered an invalid day.";
                            flag             = (numArray[1] >= 1) & (numArray[1] <= DateTime.DaysInMonth(numArray[2], numArray[0]));
                        }
                        if (flag)
                        {
                            reasonForFailure = "The date portion is in 'MMDDYY' format'. You entered an invalid year. The year cannot be later than the current year and cannot be before 1990. If you think this is a valid year, make sure you did not reset your system date to an earlier year.";
                            flag             = (numArray[2] >= 0x7c6) & (numArray[2] <= DateAndTime.Year(DateAndTime.Now));
                        }
                        if (flag)
                        {
                            flag = Information.IsDate(DateAndTime.DateSerial(numArray[2], numArray[0], numArray[1]));
                        }
                        if (flag)
                        {
                            reasonForFailure = "The date portion of the CR number should be before today's date. If you believe this to be a valid CR number, check the system date on your machine and make sure it is set to the current date.";
                            flag             = DateTime.Compare(DateAndTime.DateSerial(numArray[2], numArray[0], numArray[1]), DateTime.Now) <= 0;
                        }
                        if (flag)
                        {
                            reasonForFailure = "The numeric portion of the CR number contains invalid characters";
                            array[0]         = Strings.Replace(array[0], "CR", "", 1, -1, CompareMethod.Binary);
                            flag             = Versioned.IsNumeric(array[0]);
                        }
                    }
                }
            }
            bool flag2 = flag;

            if (flag)
            {
                reasonForFailure = "";
            }
            return(flag2);
        }
Exemplo n.º 28
0
    internal static Class120.Enum11 smethod_4(string string_1)
    {
        Class120.Enum11 @enum = (Class120.Enum11) 0;
        string_1  = string_1.ToUpper().Trim();
        string_1 += "-";
        checked
        {
            Class120.Enum11 result;
            if (string_1.Length != 30)
            {
                result = @enum;
            }
            else
            {
                int num = 0;
                while (true)
                {
IL_9E:
                    int num2 = 0;
                    while (Class323.smethod_13((byte)Strings.Asc(string_1[num * 6 + num2])) | Versioned.IsNumeric(Strings.Asc(string_1[num * 6 + num2])))
                    {
                        num2++;
                        if (num2 > 4)
                        {
                            if (Operators.CompareString(Conversions.ToString(string_1[num * 6 + 5]), "-", false) != 0)
                            {
                                goto IL_A9;
                            }
                            num++;
                            if (num <= 4)
                            {
                                goto IL_9E;
                            }
                            goto IL_B0;
                        }
                    }
                    break;
                }
                result = @enum;
                return(result);

IL_A9:
                result = @enum;
                return(result);

IL_B0:
                string_1 = Strings.Left(string_1, string_1.Length - 1);
                MD5    mD    = MD5.Create();
                byte[] array = mD.ComputeHash(Encoding.ASCII.GetBytes(string_1));
                string text  = string.Empty;
                int    num3  = array.Length - 1;
                for (int i = 0; i <= num3; i++)
                {
                    text += array[i].ToString("X2");
                }
                text = text.ToLower();
                if (Class120.class325_0.method_0(text))
                {
                    result = (Class120.Enum11) 1;
                }
                else if (Class120.class325_1.method_0(text))
                {
                    result = (Class120.Enum11) 2;
                }
                else
                {
                    result = @enum;
                }
            }
            return(result);
        }
    }
Exemplo n.º 29
0
        public void Inserir_Empresa(SPC_CNPJ pj)
        {
            string cone = Cript_Decript.DeCifra(ConfigurationManager.AppSettings["Conexao"]);

            SqlParameter[] param = new SqlParameter[0x13];
            try
            {
                SPC_CNPJ cnpjXPTO = pj;
                param[0]          = new SqlParameter("@CNPJ", SqlDbType.VarChar);
                param[0].Value    = cnpjXPTO.CNPJ == null ? String.Empty : cnpjXPTO.CNPJ.ToString();
                param[1]          = new SqlParameter("@Razao", SqlDbType.VarChar);
                param[1].Value    = cnpjXPTO.Razao == null ? String.Empty : cnpjXPTO.Razao.ToString();
                param[2]          = new SqlParameter("@Razao_Anterior", SqlDbType.VarChar);
                param[2].Value    = cnpjXPTO.RazaoAnterior == null ? String.Empty : cnpjXPTO.RazaoAnterior.ToString();
                param[3]          = new SqlParameter("@Bairro", SqlDbType.VarChar);
                param[3].Value    = cnpjXPTO.Endereco.Bairro == null ? String.Empty : cnpjXPTO.Endereco.Bairro.ToString();
                param[4]          = new SqlParameter("@Cidade", SqlDbType.VarChar);
                param[4].Value    = cnpjXPTO.Endereco.Cidade == null ? String.Empty : cnpjXPTO.Endereco.Cidade.ToString();
                param[5]          = new SqlParameter("@UF", SqlDbType.VarChar);
                param[5].Value    = cnpjXPTO.Endereco.UF == null ? String.Empty : cnpjXPTO.Endereco.UF.ToString();
                param[6]          = new SqlParameter("@Complemento", SqlDbType.VarChar);
                param[6].Value    = cnpjXPTO.Endereco.Complemento == null ? String.Empty : cnpjXPTO.Endereco.Complemento.ToString();
                param[7]          = new SqlParameter("@Logradouro", SqlDbType.VarChar);
                param[7].Value    = cnpjXPTO.Endereco.Logradouro == null ? String.Empty : cnpjXPTO.Endereco.Logradouro.ToString();
                param[8]          = new SqlParameter("@Numero", SqlDbType.VarChar);
                param[8].Value    = cnpjXPTO.Endereco.Numero == null ? String.Empty : cnpjXPTO.Endereco.Numero.ToString();
                param[9]          = new SqlParameter("@DDDFax", SqlDbType.VarChar);
                param[9].Value    = cnpjXPTO.DDDFax == null ? String.Empty : cnpjXPTO.DDDFax.ToString();
                param[10]         = new SqlParameter("@FoneFax", SqlDbType.VarChar);
                param[10].Value   = cnpjXPTO.Fax == null ? String.Empty : cnpjXPTO.Fax.ToString();
                param[11]         = new SqlParameter("@InscrEstadual", SqlDbType.VarChar);
                param[11].Value   = cnpjXPTO.InscrEstadual == null ? String.Empty : cnpjXPTO.InscrEstadual.ToString();
                param[12]         = new SqlParameter("@CodNatJur", SqlDbType.VarChar);
                param[12].Value   = cnpjXPTO.NatJuridica == null ? String.Empty : cnpjXPTO.NatJuridica.ToString();
                param[13]         = new SqlParameter("@DescNatJur", SqlDbType.VarChar);
                param[13].Value   = cnpjXPTO.NatJurDescricao == null ? String.Empty : cnpjXPTO.NatJurDescricao.ToString();
                param[14]         = new SqlParameter("@NmComercial", SqlDbType.VarChar);
                param[14].Value   = cnpjXPTO.NmComercial == null ? String.Empty : cnpjXPTO.NmComercial.ToString();
                param[15]         = new SqlParameter("@Situacao", SqlDbType.VarChar);
                param[15].Value   = cnpjXPTO.Situacao == null ? String.Empty : cnpjXPTO.Situacao.ToString();
                param[0x10]       = new SqlParameter("@DDD", SqlDbType.Int);
                param[0x10].Value = cnpjXPTO.DDD == null ? String.Empty : cnpjXPTO.DDD.ToString();
                param[0x11]       = new SqlParameter("@Fone", SqlDbType.VarChar);
                param[0x11].Value = cnpjXPTO.Telefone == null ? String.Empty : cnpjXPTO.Telefone.ToString();
                param[0x12]       = new SqlParameter("@VlCapital", SqlDbType.VarChar);
                param[0x12].Value = !Versioned.IsNumeric(cnpjXPTO.VlCapital) ? String.Empty : cnpjXPTO.VlCapital.ToString();
                long ID_SPC_CNPJ = (long)(SqlHelper.ExecuteScalar(cone, CommandType.StoredProcedure, "INTOUCH..prc_Inserir_CNPJ", param));
                param = new SqlParameter[4];
                foreach (SPC_CNPJ_CNAE_PRINCIPAL Cnae in cnpjXPTO.Cnae)
                {
                    param[0]       = new SqlParameter("@ID_SPC_CNPJ", SqlDbType.BigInt);
                    param[0].Value = ID_SPC_CNPJ;
                    param[1]       = new SqlParameter("@Cnae", SqlDbType.BigInt);
                    param[1].Value = !Versioned.IsNumeric(Cnae.Codigo) ? 0 : Cnae.Codigo;
                    param[2]       = new SqlParameter("@DESCRICAO", SqlDbType.VarChar);
                    param[2].Value = Cnae.Descricao == null ? String.Empty : Cnae.Descricao;
                    param[3]       = new SqlParameter("@TIPO", SqlDbType.VarChar);
                    param[3].Value = Cnae.Tipo == null ? String.Empty : Cnae.Tipo;
                    SqlHelper.ExecuteScalar(cone, CommandType.StoredProcedure, "INTOUCH..prc_Inserir_CNPJ_CNAE", param);
                }
                if ((cnpjXPTO.Cheque != null) && (cnpjXPTO.Cheque.Count > 0))
                {
                    param = new SqlParameter[13];
                    foreach (SPC_CPF_CHEQUE item in cnpjXPTO.Cheque)
                    {
                        param[0]        = new SqlParameter("@ID", SqlDbType.BigInt);
                        param[0].Value  = ID_SPC_CNPJ;
                        param[1]        = new SqlParameter("@ID_TP_CONSULTA", SqlDbType.Int);
                        param[1].Value  = pj.TipoConsulta;
                        param[2]        = new SqlParameter("@CODALINEA", SqlDbType.BigInt);
                        param[2].Value  = DBNull.Value.Equals(item.CodAlinea) ? String.Empty : item.CodAlinea.ToString();
                        param[3]        = new SqlParameter("@DSCALINEA", SqlDbType.VarChar);
                        param[3].Value  = item.DscAlinea.ToString() != "" ? item.DscAlinea : String.Empty;
                        param[4]        = new SqlParameter("@BANCO", SqlDbType.VarChar);
                        param[4].Value  = item.Banco.ToString() != "" ? item.Banco.ToString() : String.Empty;
                        param[5]        = new SqlParameter("@NUMAGENCIA", SqlDbType.VarChar);
                        param[5].Value  = item.NumAgencia.ToString() != "" ? item.NumAgencia.ToString() : String.Empty;
                        param[6]        = new SqlParameter("@NUMCTACORRENTE", SqlDbType.VarChar);
                        param[6].Value  = item.NumCC != "" ? item.NumCC : String.Empty;
                        param[7]        = new SqlParameter("@DTEMISSAO", SqlDbType.DateTime);
                        param[7].Value  = item.DtEmissao.ToShortDateString().Equals("01/01/0001") ? String.Empty : item.DtEmissao.ToShortDateString();
                        param[8]        = new SqlParameter("@NUMCHEQUE", SqlDbType.VarChar);
                        param[8].Value  = item.NumCheque.ToString() != "" ? item.NumCheque.ToString() : String.Empty;
                        param[9]        = new SqlParameter("@VLCHEQUE", SqlDbType.Decimal);
                        param[9].Value  = item.VlCheque.ToString() != "" ? item.VlCheque.ToString() : String.Empty;
                        param[10]       = new SqlParameter("@NOMEASSOCIADOCHEQUE", SqlDbType.VarChar);
                        param[10].Value = item.NmAssociado != "" ? item.NmAssociado: String.Empty;
                        param[11]       = new SqlParameter("@NOMEENTIDADECHEQUE", SqlDbType.VarChar);
                        param[11].Value = item.NmEntidade != "" ? item.NmEntidade: String.Empty;
                        param[12]       = new SqlParameter("@ORIGEMCHEQUE", SqlDbType.VarChar);
                        param[12].Value = item.Origem != "" ? item.Origem: String.Empty;
                        SqlHelper.ExecuteNonQuery(cone, CommandType.StoredProcedure, "intouch..prc_SPC_Inserir_Cheque", param);
                    }
                }
                if ((cnpjXPTO.ConsultaRealizada != null) && (cnpjXPTO.ConsultaRealizada.Count > 0))
                {
                    param = new SqlParameter[8];
                    foreach (SPC_CPF_ConsultaRealizada item in cnpjXPTO.ConsultaRealizada)
                    {
                        param[0]       = new SqlParameter("@ID", SqlDbType.BigInt);
                        param[0].Value = ID_SPC_CNPJ;
                        param[1]       = new SqlParameter("@ID_TP_CONSULTA", SqlDbType.Int);
                        param[1].Value = pj.TipoConsulta;
                        param[2]       = new SqlParameter("@QUANTIDADEDIASCONSULTADOS", SqlDbType.BigInt);
                        param[2].Value = !Versioned.IsNumeric(item.QuantidadeDiasConsultados) ? 0 : item.QuantidadeDiasConsultados;
                        param[3]       = new SqlParameter("@DataUltimaOcorrencia", SqlDbType.DateTime);
                        param[3].Value = item.DataUltimaOcorrencia.ToShortDateString().Equals("01/01/0001") ? String.Empty : item.DataUltimaOcorrencia.ToShortDateString();
                        param[4]       = new SqlParameter("@DataConsulta", SqlDbType.DateTime);
                        param[4].Value = item.DataConsulta.ToShortDateString().Equals("01/01/0001") ? String.Empty : item.DataConsulta.ToShortDateString();
                        param[5]       = new SqlParameter("@NomeAssociado", SqlDbType.VarChar);
                        param[5].Value = item.NomeAssociado == null ? String.Empty :  item.NomeAssociado;
                        param[6]       = new SqlParameter("@NomeEntidade", SqlDbType.VarChar);
                        param[6].Value = item.NomeEntidade == null ? String.Empty : item.NomeEntidade;
                        param[7]       = new SqlParameter("@Origem", SqlDbType.VarChar);
                        param[7].Value = item.Origem == null ? String.Empty : item.Origem;
                    }
                    SqlHelper.ExecuteNonQuery(cone, CommandType.StoredProcedure, "intouch..prc_SPC_Inserir_ConsultaRealizada", param);
                }
                cnpjXPTO = null;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception ex = exception1;
                ProjectData.ClearProjectError();
            }
        }
Exemplo n.º 30
0
 public void Inserir(SPC_CPF spc)
 {
     try
     {
         string         cone  = Cript_Decript.DeCifra(ConfigurationManager.AppSettings["Conexao"]);
         SqlParameter[] param = new SqlParameter[0x15];
         param[0]          = new SqlParameter("@CPF", SqlDbType.VarChar);
         param[0].Value    = spc.CPF;
         param[1]          = new SqlParameter("@NOME", SqlDbType.VarChar);
         param[1].Value    = spc.Nome == null ? String.Empty : spc.Nome;
         param[2]          = new SqlParameter("@NOMEMAE", SqlDbType.VarChar);
         param[2].Value    = spc.NomeMae == null ? String.Empty : spc.NomeMae;
         param[3]          = new SqlParameter("@NOMEPAI", SqlDbType.VarChar);
         param[3].Value    = spc.NomePai == null ? String.Empty : spc.NomePai;
         param[4]          = new SqlParameter("@DTNASC", SqlDbType.DateTime);
         param[4].Value    = spc.Nasc.ToShortDateString().Equals("01/01/0001") ? null : spc.Nasc.ToShortDateString();
         param[5]          = new SqlParameter("@ENDERECO", SqlDbType.VarChar);
         param[5].Value    = spc.Ende == null ? String.Empty : spc.Ende;
         param[6]          = new SqlParameter("@ESTCIV", SqlDbType.VarChar);
         param[6].Value    = spc.EstCiv == null ? String.Empty : spc.EstCiv;
         param[7]          = new SqlParameter("@UF", SqlDbType.VarChar);
         param[7].Value    = spc.UF == null ? String.Empty : spc.UF;
         param[8]          = new SqlParameter("@IDADE", SqlDbType.Int);
         param[8].Value    = Versioned.IsNumeric(spc.Idade) ? Convert.ToInt32(spc.Idade) : 0;
         param[9]          = new SqlParameter("@TituloEleitor", SqlDbType.VarChar);
         param[9].Value    = spc.TitEleitor == null ? String.Empty : spc.TitEleitor;
         param[10]         = new SqlParameter("@SEXO", SqlDbType.VarChar);
         param[10].Value   = spc.Sexo == null ? String.Empty : spc.Sexo;
         param[11]         = new SqlParameter("@SIGNO", SqlDbType.VarChar);
         param[11].Value   = spc.Signo == null ? String.Empty : spc.Signo;
         param[12]         = new SqlParameter("@DTSITUACAO", SqlDbType.DateTime);
         param[12].Value   = spc.DtSituacao.ToShortDateString().Equals("01/01/0001") ? null : spc.DtSituacao.ToShortDateString();
         param[13]         = new SqlParameter("@DSCSITUACAO", SqlDbType.VarChar);
         param[13].Value   = spc.DscSituacao == null ? String.Empty : spc.DscSituacao;
         param[14]         = new SqlParameter("@UFSITUACAO", SqlDbType.VarChar);
         param[14].Value   = spc.UfSituacao == null ? String.Empty : spc.UfSituacao;
         param[15]         = new SqlParameter("@DDDCEL", SqlDbType.VarChar);
         param[15].Value   = spc.DDDCel == null ? String.Empty : spc.DDDCel;
         param[0x10]       = new SqlParameter("@TELCEL", SqlDbType.VarChar);
         param[0x10].Value = spc.TelCel == null ? String.Empty : spc.TelCel;
         param[0x11]       = new SqlParameter("@DDDCOM", SqlDbType.VarChar);
         param[0x11].Value = spc.DDDCom == null ? String.Empty : spc.DDDCom;
         param[0x12]       = new SqlParameter("@TELCOM", SqlDbType.VarChar);
         param[0x12].Value = spc.TelCom == null ? String.Empty : spc.TelCom;
         param[0x13]       = new SqlParameter("@DDDRES", SqlDbType.VarChar);
         param[0x13].Value = spc.DDDRes == null ? String.Empty : spc.DDDRes;
         param[20]         = new SqlParameter("@TELRES", SqlDbType.VarChar);
         param[20].Value   = spc.TelRes == null ? String.Empty : spc.TelRes;
         long resultConsulta = Convert.ToInt32(SqlHelper.ExecuteScalar(cone, CommandType.StoredProcedure, "intouch..prc_SPC_Inserir_Consulta", param));
         if ((spc.Cheque != null) && (spc.Cheque.Count > 0))
         {
             param = new SqlParameter[13];
             foreach (SPC_CPF_CHEQUE item in spc.Cheque)
             {
                 param[0]        = new SqlParameter("@ID", SqlDbType.BigInt);
                 param[0].Value  = resultConsulta;
                 param[1]        = new SqlParameter("@ID_TP_CONSULTA", SqlDbType.Int);
                 param[1].Value  = spc.TipoConsulta;
                 param[2]        = new SqlParameter("@CODALINEA", SqlDbType.BigInt);
                 param[2].Value  = DBNull.Value.Equals(item.CodAlinea) ? String.Empty : item.CodAlinea.ToString();
                 param[3]        = new SqlParameter("@DSCALINEA", SqlDbType.VarChar);
                 param[3].Value  = item.DscAlinea.ToString() != "" ? item.DscAlinea : String.Empty;
                 param[4]        = new SqlParameter("@BANCO", SqlDbType.VarChar);
                 param[4].Value  = item.Banco.ToString() != "" ? item.Banco.ToString() : String.Empty;
                 param[5]        = new SqlParameter("@NUMAGENCIA", SqlDbType.VarChar);
                 param[5].Value  = item.NumAgencia.ToString() != "" ? item.NumAgencia.ToString() : String.Empty;
                 param[6]        = new SqlParameter("@NUMCTACORRENTE", SqlDbType.VarChar);
                 param[6].Value  = item.NumCC != "" ? item.NumCC : String.Empty;
                 param[7]        = new SqlParameter("@DTEMISSAO", SqlDbType.DateTime);
                 param[7].Value  = item.DtEmissao.ToShortDateString().Equals("01/01/0001") ? String.Empty : item.DtEmissao.ToShortDateString();
                 param[8]        = new SqlParameter("@NUMCHEQUE", SqlDbType.VarChar);
                 param[8].Value  = item.NumCheque.ToString() != "" ? item.NumCheque.ToString() : String.Empty;
                 param[9]        = new SqlParameter("@VLCHEQUE", SqlDbType.Decimal);
                 param[9].Value  = item.VlCheque.ToString() != "" ? item.VlCheque.ToString() : String.Empty;
                 param[10]       = new SqlParameter("@NOMEASSOCIADOCHEQUE", SqlDbType.VarChar);
                 param[10].Value = item.NmAssociado != "" ? item.NmAssociado : String.Empty;
                 param[11]       = new SqlParameter("@NOMEENTIDADECHEQUE", SqlDbType.VarChar);
                 param[11].Value = item.NmEntidade != "" ? item.NmEntidade : String.Empty;
                 param[12]       = new SqlParameter("@ORIGEMCHEQUE", SqlDbType.VarChar);
                 param[12].Value = item.Origem != "" ? item.Origem : String.Empty;
                 SqlHelper.ExecuteNonQuery(cone, CommandType.StoredProcedure, "intouch..prc_SPC_Inserir_Cheque", param);
             }
         }
         if ((spc.ConsultaRealizada != null) && (spc.ConsultaRealizada.Count > 0))
         {
             param = new SqlParameter[8];
             foreach (SPC_CPF_ConsultaRealizada item in spc.ConsultaRealizada)
             {
                 param[0]       = new SqlParameter("@ID", SqlDbType.BigInt);
                 param[0].Value = resultConsulta;
                 param[1]       = new SqlParameter("@ID_TP_CONSULTA", SqlDbType.Int);
                 param[1].Value = spc.TipoConsulta;
                 param[2]       = new SqlParameter("@QUANTIDADEDIASCONSULTADOS", SqlDbType.BigInt);
                 param[2].Value = !Versioned.IsNumeric(item.QuantidadeDiasConsultados) ? 0 : item.QuantidadeDiasConsultados;
                 param[3]       = new SqlParameter("@DataUltimaOcorrencia", SqlDbType.DateTime);
                 param[3].Value = item.DataUltimaOcorrencia.ToShortDateString().Equals("01/01/0001") ? String.Empty : item.DataUltimaOcorrencia.ToShortDateString();
                 param[4]       = new SqlParameter("@DataConsulta", SqlDbType.DateTime);
                 param[4].Value = item.DataConsulta.ToShortDateString().Equals("01/01/0001") ? String.Empty : item.DataConsulta.ToShortDateString();
                 param[5]       = new SqlParameter("@NomeAssociado", SqlDbType.VarChar);
                 param[5].Value = item.NomeAssociado == null ? String.Empty : item.NomeAssociado;
                 param[6]       = new SqlParameter("@NomeEntidade", SqlDbType.VarChar);
                 param[6].Value = item.NomeEntidade == null ? String.Empty : item.NomeEntidade;
                 param[7]       = new SqlParameter("@Origem", SqlDbType.VarChar);
                 param[7].Value = item.Origem == null ? String.Empty : item.Origem;
             }
             SqlHelper.ExecuteNonQuery(cone, CommandType.StoredProcedure, "intouch..prc_SPC_Inserir_ConsultaRealizada", param);
         }
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception ex = exception1;
         ProjectData.ClearProjectError();
     }
 }