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

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM WH_StorgeJSDts WHERE " + "MainID=" + SysString.ToDBString(MasterEntity.MainID) + " AND Seq=" + SysString.ToDBString(MasterEntity.Seq);
                //执行
                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);
            }
        }
Beispiel #2
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);
         StorgeJSDts    entity  = (StorgeJSDts)p_BE;
         StorgeJSDtsCtl control = new StorgeJSDtsCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Beispiel #3
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);
         StorgeJSDts    entity  = (StorgeJSDts)p_BE;
         StorgeJSDtsCtl control = new StorgeJSDtsCtl(sqlTrans);
         //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.WH_StorgeJSDts,sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Beispiel #4
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                StorgeJSDts MasterEntity = (StorgeJSDts)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO WH_StorgeJSDts(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("MainID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ",");
                MasterField.Append("Seq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ",");
                MasterField.Append("WHID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WHID) + ",");
                MasterField.Append("SectionID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SectionID) + ",");
                MasterField.Append("SBitID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SBitID) + ",");
                MasterField.Append("ItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemCode) + ",");
                MasterField.Append("ItemName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemName) + ",");
                MasterField.Append("ItemModel" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemModel) + ",");
                MasterField.Append("ItemStd" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemStd) + ",");
                MasterField.Append("Unit" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Unit) + ",");
                MasterField.Append("JHFormNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.JHFormNo) + ",");
                MasterField.Append("RWNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.RWNo) + ",");
                MasterField.Append("GoodsCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.GoodsCode) + ",");
                MasterField.Append("GoodsLevel" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.GoodsLevel) + ",");
                MasterField.Append("MWidth" + ",");
                if (MasterEntity.MWidth != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MWidth) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

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

                MasterField.Append("WeightUnit" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WeightUnit) + ",");
                MasterField.Append("ColorNum" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorNum) + ",");
                MasterField.Append("ColorName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorName) + ",");
                MasterField.Append("VColorNum" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VColorNum) + ",");
                MasterField.Append("VColorName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VColorName) + ",");
                MasterField.Append("VItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VItemCode) + ",");
                MasterField.Append("Weight" + ",");
                if (MasterEntity.Weight != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.Weight) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

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

                MasterField.Append("JarNum" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.JarNum) + ")");



                //执行
                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);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                StorgeJSDts MasterEntity = (StorgeJSDts)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE WH_StorgeJSDts SET ");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" WHID=" + SysString.ToDBString(MasterEntity.WHID) + ",");
                UpdateBuilder.Append(" SectionID=" + SysString.ToDBString(MasterEntity.SectionID) + ",");
                UpdateBuilder.Append(" SBitID=" + SysString.ToDBString(MasterEntity.SBitID) + ",");
                UpdateBuilder.Append(" ItemCode=" + SysString.ToDBString(MasterEntity.ItemCode) + ",");
                UpdateBuilder.Append(" ItemName=" + SysString.ToDBString(MasterEntity.ItemName) + ",");
                UpdateBuilder.Append(" ItemModel=" + SysString.ToDBString(MasterEntity.ItemModel) + ",");
                UpdateBuilder.Append(" ItemStd=" + SysString.ToDBString(MasterEntity.ItemStd) + ",");
                UpdateBuilder.Append(" JHFormNo=" + SysString.ToDBString(MasterEntity.JHFormNo) + ",");
                UpdateBuilder.Append(" RWNo=" + SysString.ToDBString(MasterEntity.RWNo) + ",");
                UpdateBuilder.Append(" Unit=" + SysString.ToDBString(MasterEntity.Unit) + ",");
                UpdateBuilder.Append(" GoodsCode=" + SysString.ToDBString(MasterEntity.GoodsCode) + ",");
                UpdateBuilder.Append(" GoodsLevel=" + SysString.ToDBString(MasterEntity.GoodsLevel) + ",");

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


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

                UpdateBuilder.Append(" WeightUnit=" + SysString.ToDBString(MasterEntity.WeightUnit) + ",");
                UpdateBuilder.Append(" ColorNum=" + SysString.ToDBString(MasterEntity.ColorNum) + ",");
                UpdateBuilder.Append(" ColorName=" + SysString.ToDBString(MasterEntity.ColorName) + ",");
                UpdateBuilder.Append(" VColorNum=" + SysString.ToDBString(MasterEntity.VColorNum) + ",");
                UpdateBuilder.Append(" VColorName=" + SysString.ToDBString(MasterEntity.VColorName) + ",");
                UpdateBuilder.Append(" VItemCode=" + SysString.ToDBString(MasterEntity.VItemCode) + ",");

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


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

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

                UpdateBuilder.Append(" WHERE " + "MainID=" + SysString.ToDBString(MasterEntity.MainID) + " AND Seq=" + SysString.ToDBString(MasterEntity.Seq));



                //执行
                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);
            }
        }
Beispiel #6
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     StorgeJSDts entity = (StorgeJSDts)p_BE;
 }