Пример #1
0
        /// <summary>
        /// 资金核销关联
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="sqlTrans"></param>
        public void RHT(RecPay payEntity, RecPayHTDts htentity, IDBTransAccess sqlTrans)
        {
            ItemBuyCapExDts entityDts = new ItemBuyCapExDts();

            entityDts.ExCapName       = payEntity.FormNo;//存储付款单号
            entityDts.ExItemCode      = htentity.HTItemCode;
            entityDts.ExPayStepTypeID = payEntity.PayStepTypeID;
            entityDts.ExPayAmount     = htentity.HTAmount;
            entityDts.ExPayLimitDate  = payEntity.ExDate.Date;
            entityDts.ExRemark        = htentity.ID.ToString();//备注记录付款合同核销ID,便于关联检索

            string sql = string.Empty;

            sql = "SELECT ID FROM Buy_ItemBuyForm WHERE FormNo=" + SysString.ToDBString(htentity.HTNo);
            DataTable dt = sqlTrans.Fill(sql);

            if (dt.Rows.Count != 0)
            {
                entityDts.MainID = SysConvert.ToInt32(dt.Rows[0]["ID"]);
            }

            sql           = "SELECT ISNULL(MAX(Seq),0)+1 AS MSeq FROM Buy_ItemBuyCapExDts WHERE MainID=" + SysString.ToDBString(entityDts.MainID);
            entityDts.Seq = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0]["MSeq"]);

            this.RAdd(entityDts, sqlTrans);
        }
Пример #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                ItemBuyCapExDts MasterEntity = (ItemBuyCapExDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Buy_ItemBuyCapExDts 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);
            }
        }
Пример #3
0
        /// <summary>
        /// 检验字段值是否已存在
        /// </summary>
        /// <param name="p_TableName">表名</param>
        /// <param name="p_FieldName">字段名</param>
        /// <param name="p_FieldValue">字段值</param>
        /// <param name="p_KeyField">主键(只考虑主键为ID的情况)</param>
        /// <param name="p_KeyValue">主键值</param>
        /// <param name="p_sqlTrans"></param>
        /// <returns></returns>
        private bool CheckFieldValueIsExist(BaseEntity p_BE, string p_FieldName, string p_FieldValue, IDBTransAccess p_sqlTrans)
        {
            ItemBuyCapExDts entity = (ItemBuyCapExDts)p_BE;
            bool            ret    = false;
            string          sql    = string.Format(" SELECT {0} FROM {1} WHERE 1=1 AND {0}={2} AND {3}<>{4}", p_FieldName, ItemBuyCapExDts.TableName, SysString.ToDBString(p_FieldValue), "ID", entity.ID);
            DataTable       dt     = p_sqlTrans.Fill(sql);

            if (dt.Rows.Count != 0)
            {
                ret = true;
            }

            return(ret);
        }
Пример #4
0
        /// <summary>
        /// 撤销核销关联
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="sqlTrans"></param>
        public void RHTCancel(RecPayHTDts htentity, IDBTransAccess sqlTrans)
        {
            ItemBuyCapExDts entityDts = new ItemBuyCapExDts();
            string          sql       = string.Empty;

            sql = "SELECT ID FROM Buy_ItemBuyCapExDts WHERE ExRemark=" + SysString.ToDBString(htentity.ID);
            DataTable dt = sqlTrans.Fill(sql);

            if (dt.Rows.Count != 0)
            {
                entityDts.ID = SysConvert.ToInt32(dt.Rows[0]["ID"]);
                entityDts.SelectByID();
            }

            this.RDelete(entityDts, sqlTrans);
        }
Пример #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);
         ItemBuyCapExDts    entity  = (ItemBuyCapExDts)p_BE;
         ItemBuyCapExDtsCtl control = new ItemBuyCapExDtsCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #6
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);
         ItemBuyCapExDts    entity  = (ItemBuyCapExDts)p_BE;
         ItemBuyCapExDtsCtl control = new ItemBuyCapExDtsCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Buy_ItemBuyCapExDts, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #7
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     ItemBuyCapExDts entity = (ItemBuyCapExDts)p_BE;
 }
Пример #8
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                ItemBuyCapExDts MasterEntity = (ItemBuyCapExDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Buy_ItemBuyCapExDts(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("MainID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ",");
                MasterField.Append("Seq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ",");
                MasterField.Append("ExCapName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ExCapName) + ",");
                MasterField.Append("ExItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ExItemCode) + ",");
                MasterField.Append("ExPayStepTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ExPayStepTypeID) + ",");
                MasterField.Append("ExPayPer" + ",");
                if (MasterEntity.ExPayPer != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.ExPayPer) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

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

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

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



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

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Buy_ItemBuyCapExDts SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" ExCapName=" + SysString.ToDBString(MasterEntity.ExCapName) + ",");
                UpdateBuilder.Append(" ExItemCode=" + SysString.ToDBString(MasterEntity.ExItemCode) + ",");
                UpdateBuilder.Append(" ExPayStepTypeID=" + SysString.ToDBString(MasterEntity.ExPayStepTypeID) + ",");

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


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


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

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

                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);
            }
        }