当前位置: 首页>>代码示例>>C#>>正文


C# Int32.GetUpperBound方法代码示例

本文整理汇总了C#中System.Int32.GetUpperBound方法的典型用法代码示例。如果您正苦于以下问题:C# Int32.GetUpperBound方法的具体用法?C# Int32.GetUpperBound怎么用?C# Int32.GetUpperBound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Int32的用法示例。


在下文中一共展示了Int32.GetUpperBound方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckInputValueIsInt32

        /// <summary>
        /// Excel匯入資料檢查-數值欄位
        /// </summary>
        /// <param name="dr">資料列</param>
        /// <param name="aryColumns">要被檢查的欄位</param>
        /// <param name="strErrMsgDataFormat">錯誤訊息</param>
        /// <returns></returns>
        protected bool CheckInputValueIsInt32(DataRow dr, Int32[] aryColumns, out string strErrMsgDataFormat)
        {
            #region

            bool bResult;
            strErrMsgDataFormat = "";
            string strValue = "";
            Int32 iResult;
            Int32 iColumn, iErrCounts = 0; ;
            strErrMsgDataFormat = "";
            for (Int32 i = 0; i <= aryColumns.GetUpperBound(0); i++)
            {
                iColumn = aryColumns[i];

                if (iColumn == 5)//數量或設定類別
                {
                    strValue = dr[iColumn].ToString().Trim();
                    bResult = Int32.TryParse(strValue, out iResult);

                    if (!bResult)
                    {
                        strErrMsgDataFormat += string.Format("{0}欄位非數值,", strAryColumnName[iColumn]);
                        iErrCounts++;
                    }
                    else
                    {
                        if (iResult < 0 || (strValue.IndexOf("-") != -1))
                        {
                            strErrMsgDataFormat += string.Format("{0}欄位非正數值,", strAryColumnName[iColumn]);
                            iErrCounts++;
                        }
                    }

                    //多檢查數量長度

                    if (dr[iColumn].ToString().Trim().Length > iAryColumnLength[iColumn])
                    {
                        strErrMsgDataFormat += string.Format("{0}欄位長度不應超過{1}", strAryColumnName[iColumn], iAryColumnLength[iColumn]);
                        iErrCounts++;
                    }

                }
            }

            if (strErrMsgDataFormat.Trim().Length > 0)
            {
                if (strErrMsgDataFormat.Substring(strErrMsgDataFormat.Length - 1, 1) == ",")
                {
                    strErrMsgDataFormat = strErrMsgDataFormat.Substring(0, strErrMsgDataFormat.Length - 1);
                }
            }

            if (iErrCounts != 0)
            {
                bResult = false;
            }
            else
            {
                bResult = true;
            }

            return bResult;
            #endregion
        }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:71,代码来源:MaintainRemoveImport.cs

示例2: CheckRequiredField

        /// <summary>
        /// Excel匯入資料檢查-必填欄位
        /// </summary>
        /// <param name="dr">資料列</param>
        /// <param name="aryColumns">要被檢查的欄位</param>
        /// <param name="strErrMsgDataFormat">錯誤訊息</param>
        /// <returns></returns>
        protected bool CheckRequiredField(DataRow dr, Int32[] aryColumns, out string strErrMsgDataFormat)
        {
            #region
            bool bResult;
            Int32 iColumn, iErrCounts = 0;
            strErrMsgDataFormat = "";

            for (Int32 i = 0; i <= aryColumns.GetUpperBound(0); i++)
            {
                iColumn = aryColumns[i];
                if (dr[iColumn].ToString().Trim() == "")
                {
                    strErrMsgDataFormat += string.Format("{0}欄位必填,", strAryColumnName[iColumn]);
                    iErrCounts++;
                }
            }


            if (strErrMsgDataFormat.Trim().Length > 0)
            {
                if (strErrMsgDataFormat.Substring(strErrMsgDataFormat.Length - 1, 1) == ",")
                {
                    strErrMsgDataFormat = strErrMsgDataFormat.Substring(0, strErrMsgDataFormat.Length - 1);
                }
            }

            if (iErrCounts != 0)
            {
                bResult = false;
            }
            else
            {
                bResult = true;
            }

            return bResult;

            #endregion
        }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:46,代码来源:ImportStoreGift.cs

示例3: RenderIcon

 public override Icon RenderIcon(Int32[] aValue, Boolean sleeping)
 {
     RenderCount++;
     if (sleeping) { return bmpToIcon(RenderSleeping()); }
     isSleeping = false;
     Bitmap tempBitmap = (Bitmap)BackgroundImage.Clone();
     if (aValue != null)
     {
         switch (aValue.GetUpperBound(0))
         {
             case 0:
                 Render1Bar(aValue, tempBitmap);
                 break;
             case 1:
                 Render2Bars(aValue, tempBitmap);
                 break;
             case 2:
                 Render3Bars(aValue, tempBitmap);
                 break;
             case 3:
                 Render4Bars(aValue, tempBitmap);
                 break;
             default:
                 Render5Bars(aValue, tempBitmap);
                 break;
         }
     }
     return bmpToIcon(tempBitmap);
 }
开发者ID:RiskyKen,项目名称:tray-usage,代码行数:29,代码来源:RendererBasic.cs

示例4: CheckReasonIsExisted

        /// <summary>
        /// 檢查原因代碼是否存在
        /// </summary>
        /// <param name="strReason"></param>
        /// <param name="strErrMsg"></param>
        /// <returns></returns>
        protected bool CheckReasonIsExisted(DataRow dr, Int32[] aryColumns, out string strErrMsgDataFormat)
        {
            #region
            bool bResult;
            Int32 iColumn, iErrCounts = 0; ;
            strErrMsgDataFormat = "";
            string strErrMsg = "";
            PIC.VDS2G.BSM.ALO.QueryALOCommon BCO = new PIC.VDS2G.BSM.ALO.QueryALOCommon(ConnectionDB);
            System.Collections.ArrayList ParameterList = new System.Collections.ArrayList();

            for (Int32 i = 0; i <= aryColumns.GetUpperBound(0); i++)
            {
                iColumn = aryColumns[i];

                if (iColumn == 6)//原因代碼
                {
                    ParameterList.Clear();
                    ParameterList.Add(dr[iColumn].ToString().Trim());

                    if (!BCO.CheckReasonIsExisted(ParameterList, out strErrMsg))
                    {
                        strErrMsgDataFormat += string.Format("{0}欄位:{1}不存在,", strAryColumnName[iColumn], dr[iColumn].ToString().Trim());
                        iErrCounts++;
                    }
                }
            }

            if (iErrCounts != 0)
            {
                bResult = false;
            }
            else
            {
                bResult = true;
            }

            return bResult;

            #endregion
        }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:46,代码来源:CRMCommon.cs

示例5: QueryDisItemReferByDisType


//.........这里部分代码省略.........
                        nRow["BACKWARD_QTY"] = iBackwardQty;                                                                 //--退貨
                        nRow["REAL_MERIT"] = iStAcceptQty - iBackwardQty;                                                    //--實績                        
                        SubQty = iStAcceptQty - iBackwardQty;
                        if (iStAcceptQty == 0)
                        {
                            //REAL_SALESRATE = 0;
                            throw new Exception("前一期別無銷售實績,不可作為參照品項!!");
                        }
                        else
                        {
                            REAL_SALESRATE = Decimal.Parse(SubQty.ToString()) / Decimal.Parse(iStAcceptQty.ToString()) * 100;
                        }
                        nRow["REAL_SALESRATE"] = (iStAcceptQty == 0) ? 0 : Decimal.Round(REAL_SALESRATE, MidpointRounding.AwayFromZero); //--實銷率
                        nRow["REFER_RATE"] = 100;                                                                            //--參照比率%  
                        dtDisItemRefer.Rows.Add(nRow);
                        break;
                        #endregion
                    case "103"://b) V_DIS_TYPE = 103 (實績加重) 時
                        #region

                        //# 由配本商品資料 ItemRow 中取前1期~前6期 (B1_PERIOD~B6_PERIOD)作計算基準

                        if (sB1_Period == "" && sB2_Period == "" && sB3_Period == "" && sB4_Period == "" && sB5_Period == "" && sB6_Period == "")
                        {
                            //顯示訊息『新品請使用其他配本方式』於訊息區,離開涵式處理流程。
                            throw new Exception("新品請使用其他配本方式");
                        }

                        //# 比較前1期~前6期 與 計算期別起迄(vPeriod_S~vPeriod_E),
                        //  將符合起迄的期別,記錄相符筆數

                        i32AryPeriod = new Int32[] { iB1_Period, iB2_Period, iB3_Period, iB4_Period, iB5_Period, iB6_Period };

                        for (Int32 i = 0; i <= i32AryPeriod.GetUpperBound(0); i++)
                        {
                            //if (iPeriod_S <= i32AryPeriod[i] && i32AryPeriod[i] <= iPeriod_E)
                            if ((i32AryPeriod[i]) >= iPeriod_S &&
                                 (i32AryPeriod[i] > 0 && i32AryPeriod[i] <= iPeriod_E))
                            {
                                iFoundCount++;
                            }
                        }


                        if (iFoundCount == 0)//--查無任何一筆相符資料
                        {
                            //顯示錯誤訊息『存在前六期別銷售資料,但查無可參照期別,請確認配本方式設定是否異常。』
                            throw new Exception("存在前六期別銷售資料,但查無可參照期別,請確認配本方式設定是否異常。");
                        }
                        else if (iFoundCount != iSelect_Period)// (往前選幾期)) --可用之參照期別品項數與參數檔設定不相符
                        {

                            //# 選出前一期別銷售實績
                            sB1_Period = B1_PERIOD;

                            //# 新增前一期資料作為參照商品,以例外比例作為參照比率%

                            QueryALOCommon BCOCommon = new QueryALOCommon(ConnectionDB);

                            Paramslist.Clear();
                            Paramslist.Add(V_ITEM);
                            Paramslist.Add(V_PERIOD);
                            DataTable dtTemp = BCOCommon.QueryItemPeriodSalesInfo(Paramslist);

                            if (dtTemp != null && dtTemp.Rows.Count > 0)
                            {
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:67,代码来源:MaintainDisRecord.cs

示例6: CopyTo

		/// <summary>
		/// Copies this list into another KeyboardrActionList
		/// </summary>
		/// <param name="array">Target list</param>
		/// <param name="start">Start index</param>
		public void CopyTo(T[] array, int start)
		{
			if (m_count > array.GetUpperBound(0) + 1 - start)
				throw new ArgumentException("Destination array was not long enough.");

			// for (int i=0; i < m_count; ++i) array[start+i] = m_array[i];
			Array.Copy(m_array, 0, array, start, m_count);
		}
开发者ID:westybsa,项目名称:MP.LSharp,代码行数:13,代码来源:IntCollection.cs

示例7: NeedRedraw

        //Do we need to redraw this icon.
        public virtual Boolean NeedRedraw(Int32[] aValues, Boolean sleeping)
        {
            if (Globals.AlwaysRedrawIcons) { return true; }
            if (AlwaysRedraw) { return true; }
            if (aValues == null) { return true; }
            if (sleeping) { return true; }
            if (isSleeping) { return true; }

            for (Int32 i = 0; i <= aValues.GetUpperBound(0); i++)
            {
                if (!(i > MaxValues  - 1))
                {
                    if (aValues[i] != LastValue[i]) { return true; }
                }
            }
            return false;
        }
开发者ID:RiskyKen,项目名称:tray-usage,代码行数:18,代码来源:Renderer.cs


注:本文中的System.Int32.GetUpperBound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。