Example #1
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <returns></returns>
        bool Insert()
        {
            string unitid = PageControl.GetGuid();

            KPI_UnitEntity mEntity = new KPI_UnitEntity();

            mEntity.UnitID        = unitid;
            mEntity.PlantID       = ddl_PlantID.Value;
            mEntity.UnitCode      = txt_UnitCode.Value.Trim();
            mEntity.UnitName      = txt_UnitName.Value.Trim();
            mEntity.UnitDesc      = txt_UnitDesc.Value.Trim();
            mEntity.UnitIndex     = int.Parse(txt_UnitIndex.Value.Trim());
            mEntity.UnitIsValid   = int.Parse(ddl_UnitIsValid.Value);
            mEntity.UnitPrefix    = txt_UnitPrefix.Value;
            mEntity.UnitMW        = decimal.Parse(txt_UnitMW.Value);
            mEntity.UnitMWTag     = txt_UnitMWTag.Value;
            mEntity.UnitCondition = txt_UnitCondition.Value.Replace("'", "''");

            mEntity.UnitIsKPI      = int.Parse(ddl_UnitIsKPI.Value);
            mEntity.UnitIsSnapshot = int.Parse(ddl_UnitIsSnapshot.Value);
            mEntity.UnitIsSort     = int.Parse(ddl_UnitIsSort.Value);
            mEntity.UnitIsSecurity = int.Parse(ddl_UnitIsSecurity.Value);
            mEntity.UnitIsPower    = int.Parse(ddl_UnitIsPower.Value);

            mEntity.WorkID = ddl_UnitWorkID.Value;

            mEntity.UnitNote       = txt_UnitNote.Value.Trim();
            mEntity.UnitCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");

            mEntity.UnitModifyTime = mEntity.UnitCreateTime;


            return(KPI_UnitDal.Insert(mEntity));
        }