示例#1
0
        /// <summary>
        /// 从Cbl表的数据行生成电缆类实例
        /// </summary>
        /// <param name="rowEQACable">Cbl表的数据行</param>
        /// <returns></returns>
        public static EQACable CreateEQACable(DataRow rowEQACable)
        {
            if (rowEQACable == null)
            {
                throw new System.ArgumentNullException("frome function CreateEQACable", "Parameter rowEQACable equals to null");
            }

            EQACable cable = new EQACable();

            lock (rowEQACable)
            {
                try
                {
                    cable.SubSystemID   = (rowEQACable[TblCbl.SYS] as string).Trim();
                    cable.CableNo       = (rowEQACable[TblCbl.TAGNAME] as string).Trim();
                    cable.StartPosition = rowEQACable[TblCbl.SOURCE] as string;
                    cable.EndPosition   = rowEQACable[TblCbl.DEST] as string;
                    if (Convert.ToString(rowEQACable[TblCbl.SPARE]).Trim() != "")
                    {
                        cable.SpareCableCore = Convert.ToInt32(rowEQACable[TblCbl.SPARE]);
                    }
                    cable.CableLength   = Convert.ToInt32(rowEQACable[TblCbl.CBL_LEN]);
                    cable.ConductLength = Convert.ToInt32(rowEQACable[TblCbl.CONDUCT_LEN]);
                    cable.CableSpec     = rowEQACable[TblCbl.CBL_TYPE] as string;
                    cable.ConductSpec   = rowEQACable[TblCbl.CONDUCT_TYPE] as string;
                    cable.Remark        = rowEQACable[TblCbl.REMARK] as string;
                    cable.Route         = rowEQACable[TblCbl.ROUTE] as string;
                }
                catch (System.Data.DataException ex)
                {
                    MessageBoxWinForm.Info("数据访问错误", ex.Message, "");
                }
            }

            return(cable);
        }
示例#2
0
        /// <summary>
        /// Deep Clone
        /// </summary>
        /// <returns></returns>
        public EQACable Copy()
        {
            EQACable cable = MemberwiseClone() as EQACable;

            return(cable);
        }