示例#1
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);
                VendorTypeForm entity = (VendorTypeForm)p_BE;
                string         sql    = string.Empty;

                sql = " SELECT 1 FROM  Data_VendorTypeForm WHERE CLSA= " + SysString.ToDBString(entity.CLSA) +
                      " AND CLSB= " + SysString.ToDBString(entity.CLSB);
                sql += " AND VendorTypeID=" + SysString.ToDBString(entity.VendorTypeID);


                DataTable dt = SysUtils.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    throw new Exception("该大类、小类已经存在,请重新输入!");
                }

                VendorTypeFormCtl control = new VendorTypeFormCtl(sqlTrans);
                //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Data_VendorTypeForm,sqlTrans);
                control.AddNew(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
示例#2
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private VendorTypeForm EntityGet()
        {
            VendorTypeForm entity = new VendorTypeForm();

            entity.ID = HTDataID;
            return(entity);
        }
示例#3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                VendorTypeForm MasterEntity = (VendorTypeForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Data_VendorTypeForm 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);
            }
        }
示例#4
0
        /// <summary>
        /// 删除
        /// </summary>
        public override void EntityDelete()
        {
            VendorTypeFormRule rule   = new VendorTypeFormRule();
            VendorTypeForm     entity = EntityGet();

            rule.RDelete(entity);
        }
示例#5
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            VendorTypeFormRule rule   = new VendorTypeFormRule();
            VendorTypeForm     entity = EntityGet();

            rule.RAdd(entity);
            return(entity.ID);
        }
示例#6
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private VendorTypeForm EntityGet()
        {
            VendorTypeForm entity = new VendorTypeForm();

            entity.ID = HTDataID;
            entity.SelectByID();
            entity.CLSA         = txtCLSA.Text.Trim();
            entity.CLSB         = txtCLSB.Text.Trim();
            entity.VendorTypeID = SysConvert.ToInt32(drpVendorTypeID.EditValue);
            entity.Remark       = txtRemark.Text.Trim();

            return(entity);
        }
示例#7
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                VendorTypeForm MasterEntity = (VendorTypeForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Data_VendorTypeForm(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("CLSA" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CLSA) + ",");
                MasterField.Append("CLSB" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CLSB) + ",");
                MasterField.Append("VendorTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorTypeID) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                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);
            }
        }
示例#8
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            VendorTypeForm entity = new VendorTypeForm();

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

            txtCLSA.Text = entity.CLSA.ToString();
            txtCLSB.Text = entity.CLSB.ToString();
            drpVendorTypeID.EditValue = entity.VendorTypeID;
            txtRemark.Text            = entity.Remark.ToString();


            if (!findFlag)
            {
            }
        }
示例#9
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                VendorTypeForm MasterEntity = (VendorTypeForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Data_VendorTypeForm SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" CLSA=" + SysString.ToDBString(MasterEntity.CLSA) + ",");
                UpdateBuilder.Append(" CLSB=" + SysString.ToDBString(MasterEntity.CLSB) + ",");
                UpdateBuilder.Append(" VendorTypeID=" + SysString.ToDBString(MasterEntity.VendorTypeID) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                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);
            }
        }
示例#10
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);
         VendorTypeForm    entity  = (VendorTypeForm)p_BE;
         VendorTypeFormCtl control = new VendorTypeFormCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
示例#11
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     VendorTypeForm entity = (VendorTypeForm)p_BE;
 }
示例#12
0
        public override void Run()
        {
            var form = new VendorTypeForm();

            WorkbenchSingleton.AddChild(form);
        }