Ejemplo n.º 1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                WHALarmDts MasterEntity = (WHALarmDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM WH_WHALarmDts WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 修改
        /// </summary>
        public override void EntityUpdate()
        {
            WHALarmDtsRule rule   = new WHALarmDtsRule();
            WHALarmDts     entity = EntityGet();

            rule.RUpdate(entity);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private WHALarmDts EntityGet()
        {
            WHALarmDts entity = new WHALarmDts();

            entity.ID = HTDataID;
            return(entity);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            WHALarmDtsRule rule   = new WHALarmDtsRule();
            WHALarmDts     entity = EntityGet();

            rule.RAdd(entity);
            return(entity.ID);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         WHALarmDts    entity  = (WHALarmDts)p_BE;
         WHALarmDtsCtl control = new WHALarmDtsCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private WHALarmDts EntityGet()
        {
            WHALarmDts entity = new WHALarmDts();

            entity.ID = HTDataID;
            entity.SelectByID();
            entity.WHAlarmID    = SysConvert.ToInt32(drpWHAlarmID.EditValue.ToString());
            entity.ItemCode     = drpItemCode.EditValue.ToString();
            entity.ItemName     = txtItemName.Text.Trim();
            entity.ItemStd      = txtItemStd.Text.Trim();
            entity.ItemModel    = txtItemModel.Text.Trim();
            entity.AlarmLowQty  = SysConvert.ToDecimal(txtAlarmLowQty.Text.Trim());
            entity.AlarmHighQty = SysConvert.ToDecimal(txtAlarmHighQty.Text.Trim());
            entity.Remark       = txtRemark.Text.Trim();
            entity.LastUpdOP    = FParamConfig.LoginID;
            entity.LastUpdTime  = DateTime.Now.Date;

            return(entity);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 新增(传入事务处理)
 /// </summary>
 /// <param name="p_BE">要新增的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         WHALarmDts    entity  = (WHALarmDts)p_BE;
         WHALarmDtsCtl control = new WHALarmDtsCtl(sqlTrans);
         //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.WH_WHALarmDts,sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            WHALarmDts entity = new WHALarmDts();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            drpWHAlarmID.EditValue = entity.WHAlarmID;
            drpItemCode.EditValue  = entity.ItemCode.ToString();
            txtItemName.Text       = entity.ItemName.ToString();
            txtItemStd.Text        = entity.ItemStd.ToString();
            txtAlarmLowQty.Text    = entity.AlarmLowQty.ToString();
            txtAlarmHighQty.Text   = entity.AlarmHighQty.ToString();
            txtRemark.Text         = entity.Remark.ToString();


            if (!findFlag)
            {
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                WHALarmDts MasterEntity = (WHALarmDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO WH_WHALarmDts(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("WHAlarmID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WHAlarmID) + ",");
                MasterField.Append("ItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemCode) + ",");
                MasterField.Append("ItemName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemName) + ",");
                MasterField.Append("ItemStd" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemStd) + ",");
                MasterField.Append("AlarmLowQty" + ",");
                if (MasterEntity.AlarmLowQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.AlarmLowQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("AlarmHighQty" + ",");
                if (MasterEntity.AlarmHighQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.AlarmHighQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("LastUpdTime" + ",");
                if (MasterEntity.LastUpdTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.LastUpdTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("LastUpdOP" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.LastUpdOP) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("ColorName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorName) + ",");
                MasterField.Append("ColorNum" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorNum) + ",");
                MasterField.Append("JarNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.JarNo) + ",");
                MasterField.Append("ItemModel" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemModel) + ",");
                MasterField.Append("DelFlag" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DelFlag) + ")");



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                WHALarmDts MasterEntity = (WHALarmDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE WH_WHALarmDts SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" WHAlarmID=" + SysString.ToDBString(MasterEntity.WHAlarmID) + ",");
                UpdateBuilder.Append(" ItemCode=" + SysString.ToDBString(MasterEntity.ItemCode) + ",");
                UpdateBuilder.Append(" ItemName=" + SysString.ToDBString(MasterEntity.ItemName) + ",");
                UpdateBuilder.Append(" ItemStd=" + SysString.ToDBString(MasterEntity.ItemStd) + ",");

                if (MasterEntity.AlarmLowQty != 0)
                {
                    UpdateBuilder.Append(" AlarmLowQty=" + SysString.ToDBString(MasterEntity.AlarmLowQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" AlarmLowQty=null,");
                }


                if (MasterEntity.AlarmHighQty != 0)
                {
                    UpdateBuilder.Append(" AlarmHighQty=" + SysString.ToDBString(MasterEntity.AlarmHighQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" AlarmHighQty=null,");
                }


                if (MasterEntity.LastUpdTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" LastUpdTime=" + SysString.ToDBString(MasterEntity.LastUpdTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" LastUpdTime=null,");
                }

                UpdateBuilder.Append(" LastUpdOP=" + SysString.ToDBString(MasterEntity.LastUpdOP) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" ColorName=" + SysString.ToDBString(MasterEntity.ColorName) + ",");
                UpdateBuilder.Append(" ColorNum=" + SysString.ToDBString(MasterEntity.ColorNum) + ",");
                UpdateBuilder.Append(" JarNo=" + SysString.ToDBString(MasterEntity.JarNo) + ",");
                UpdateBuilder.Append(" ItemModel=" + SysString.ToDBString(MasterEntity.ItemModel) + ",");
                UpdateBuilder.Append(" DelFlag=" + SysString.ToDBString(MasterEntity.DelFlag));

                UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     WHALarmDts entity = (WHALarmDts)p_BE;
 }