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

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Data_VendorInvoiceDts 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);
            }
        }
Example #2
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                VendorInvoiceDts MasterEntity = (VendorInvoiceDts)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Data_VendorInvoiceDts(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("MainID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ",");
                MasterField.Append("Seq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ",");
                MasterField.Append("CompName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CompName) + ",");
                MasterField.Append("TaxNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.TaxNo) + ",");
                MasterField.Append("Address" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Address) + ",");
                MasterField.Append("Tel" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Tel) + ",");
                MasterField.Append("Bank" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Bank) + ",");
                MasterField.Append("No" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.No) + ",");
                MasterField.Append("DRemark" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DRemark) + ")");



                //执行
                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);
            }
        }
Example #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)
        {
            VendorInvoiceDts entity = (VendorInvoiceDts)p_BE;
            bool             ret    = false;
            string           sql    = string.Format(" SELECT {0} FROM {1} WHERE 1=1 AND {0}={2} AND {3}<>{4}", p_FieldName, VendorInvoiceDts.TableName, SysString.ToDBString(p_FieldValue), "ID", entity.MainID);
            DataTable        dt     = p_sqlTrans.Fill(sql);

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

            return(ret);
        }
Example #4
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                VendorInvoiceDts MasterEntity = (VendorInvoiceDts)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Data_VendorInvoiceDts SET ");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" CompName=" + SysString.ToDBString(MasterEntity.CompName) + ",");
                UpdateBuilder.Append(" TaxNo=" + SysString.ToDBString(MasterEntity.TaxNo) + ",");
                UpdateBuilder.Append(" Address=" + SysString.ToDBString(MasterEntity.Address) + ",");
                UpdateBuilder.Append(" Tel=" + SysString.ToDBString(MasterEntity.Tel) + ",");
                UpdateBuilder.Append(" Bank=" + SysString.ToDBString(MasterEntity.Bank) + ",");
                UpdateBuilder.Append(" No=" + SysString.ToDBString(MasterEntity.No) + ",");
                UpdateBuilder.Append(" DRemark=" + SysString.ToDBString(MasterEntity.DRemark));

                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);
            }
        }
Example #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);
         VendorInvoiceDts    entity  = (VendorInvoiceDts)p_BE;
         VendorInvoiceDtsCtl control = new VendorInvoiceDtsCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Example #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);
         VendorInvoiceDts    entity  = (VendorInvoiceDts)p_BE;
         VendorInvoiceDtsCtl control = new VendorInvoiceDtsCtl(sqlTrans);
         //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Data_VendorInvoiceDts,sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Example #7
0
        /// <summary>
        /// 获取客户开户资料
        /// </summary>
        /// <returns></returns>
        private VendorInvoiceDts[] GetVendorInvoice()
        {
            int Num = 0;

            for (int i = 0; i < gridView5.RowCount; i++)
            {
                if (SysConvert.ToString(gridView5.GetRowCellValue(i, "CompName")) != string.Empty)
                {
                    Num++;
                }
            }
            VendorInvoiceDts[] entitydts = new VendorInvoiceDts[Num];
            int index = 0;

            for (int i = 0; i < gridView5.RowCount; i++)
            {
                if (SysConvert.ToString(gridView5.GetRowCellValue(i, "CompName")) != string.Empty)
                {
                    entitydts[index]        = new VendorInvoiceDts();
                    entitydts[index].MainID = HTDataID;
                    entitydts[index].Seq    = i + 1;
                    entitydts[index].SelectByID();


                    entitydts[index].CompName = SysConvert.ToString(gridView5.GetRowCellValue(i, "CompName"));
                    entitydts[index].TaxNo    = SysConvert.ToString(gridView5.GetRowCellValue(i, "TaxNo"));
                    entitydts[index].Address  = SysConvert.ToString(gridView5.GetRowCellValue(i, "Address"));
                    entitydts[index].Tel      = SysConvert.ToString(gridView5.GetRowCellValue(i, "Tel"));
                    entitydts[index].Bank     = SysConvert.ToString(gridView5.GetRowCellValue(i, "Bank"));
                    entitydts[index].No       = SysConvert.ToString(gridView5.GetRowCellValue(i, "No"));
                    entitydts[index].DRemark  = SysConvert.ToString(gridView5.GetRowCellValue(i, "DRemark"));

                    index++;
                }
            }
            return(entitydts);
        }
Example #8
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_BE">要修改的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RUpdate(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, BaseEntity[] p_BE4, BaseEntity[] p_BE5, ArrayList p_BE6, BaseEntity[] p_BE7, BaseEntity[] p_BE8, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                Vendor entity = (Vendor)p_BE;
                this.RUpdate(p_BE, sqlTrans);
                //VendorCtl control = new VendorCtl(sqlTrans);
                //control.Update(entity);
                string sql = "DELETE Data_VendorSaleOP WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                sql = "DELETE  Data_VendorContact WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                sql = "DELETE  Data_VendorAddress WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                sql = "DELETE  Data_VendorNews WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                sql = "DELETE  Data_VendorInvoiceDts WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                if (p_BE7.Length > 0)
                {
                    sql  = "DELETE  Data_ItemAdd WHERE MainID=" + SysString.ToDBString(entity.ID);
                    sql += " AND ISNULL(FormID,0)=" + SysString.ToDBString(((ItemAdd)p_BE7[0]).FormID);
                    sql += " AND ISNULL(FormAID,0)=" + SysString.ToDBString(((ItemAdd)p_BE7[0]).FormAID);
                    sql += " AND ISNULL(FormBID,0)=" + SysString.ToDBString(((ItemAdd)p_BE7[0]).FormBID);
                    sqlTrans.ExecuteNonQuery(sql);
                }
                //新增客户联系人
                for (int i = 0; i < p_BE2.Length; i++)
                {
                    VendorContactRule rule = new VendorContactRule();
                    VendorContact     entityVendorContact = (VendorContact)p_BE2[i];
                    entityVendorContact.MainID = entity.ID;
                    entityVendorContact.Seq    = i + 1;
                    rule.RAdd(entityVendorContact, sqlTrans);
                }
                //新增客户归属业务员
                for (int i = 0; i < p_BE3.Length; i++)
                {
                    VendorSaleOPRule rule = new VendorSaleOPRule();
                    VendorSaleOP     entityVendorSaleOP = (VendorSaleOP)p_BE3[i];
                    entityVendorSaleOP.MainID = entity.ID;
                    entityVendorSaleOP.Seq    = i + 1;
                    rule.RAdd(entityVendorSaleOP, sqlTrans);
                }

                for (int i = 0; i < p_BE4.Length; i++)
                {
                    VendorAddressRule rule = new VendorAddressRule();
                    VendorAddress     entityVendorAddress = (VendorAddress)p_BE4[i];
                    entityVendorAddress.MainID = entity.ID;
                    entityVendorAddress.Seq    = i + 1;
                    rule.RAdd(entityVendorAddress, sqlTrans);
                }

                for (int i = 0; i < p_BE5.Length; i++)
                {
                    VendorNewsRule rule             = new VendorNewsRule();
                    VendorNews     entityVendorNews = (VendorNews)p_BE5[i];
                    entityVendorNews.MainID = entity.ID;
                    entityVendorNews.Seq    = i + 1;
                    rule.RAdd(entityVendorNews, sqlTrans);
                }

                for (int i = 0; i < p_BE7.Length; i++)
                {
                    ItemAddRule rule          = new ItemAddRule();
                    ItemAdd     entityItemAdd = (ItemAdd)p_BE7[i];
                    entityItemAdd.MainID = entity.ID;
                    entityItemAdd.Seq    = i + 1;
                    rule.RAdd(entityItemAdd, sqlTrans);
                    rule.UpdateFiledSet(entity.ID, entityItemAdd.FiledSetID, entityItemAdd.Value, sqlTrans);
                }

                for (int i = 0; i < p_BE8.Length; i++)
                {
                    VendorInvoiceDtsRule rule = new VendorInvoiceDtsRule();
                    VendorInvoiceDts     entityItemInvoice = (VendorInvoiceDts)p_BE8[i];
                    entityItemInvoice.MainID = entity.ID;
                    entityItemInvoice.Seq    = i + 1;
                    rule.RAdd(entityItemInvoice, sqlTrans);
                }

                VendorTypeDtsRule vendortyperule = new VendorTypeDtsRule();
                vendortyperule.RSave(p_BE, p_BE6, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Example #9
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, BaseEntity[] p_BE4, BaseEntity[] p_BE5, ArrayList p_BE6, BaseEntity[] p_BE7, BaseEntity[] p_BE8, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                Vendor entity = (Vendor)p_BE;
                this.RAdd(entity, sqlTrans);

                for (int i = 0; i < p_BE2.Length; i++)
                {
                    VendorContactRule rule = new VendorContactRule();
                    VendorContact     entityVendorContact = (VendorContact)p_BE2[i];
                    entityVendorContact.MainID = entity.ID;
                    entityVendorContact.Seq    = i + 1;
                    rule.RAdd(entityVendorContact, sqlTrans);
                }
                //新增客户归属业务员
                for (int i = 0; i < p_BE3.Length; i++)
                {
                    VendorSaleOPRule rule = new VendorSaleOPRule();
                    VendorSaleOP     entityVendorSaleOP = (VendorSaleOP)p_BE3[i];
                    entityVendorSaleOP.MainID = entity.ID;
                    entityVendorSaleOP.Seq    = i + 1;
                    rule.RAdd(entityVendorSaleOP, sqlTrans);
                }

                for (int i = 0; i < p_BE4.Length; i++)
                {
                    VendorAddressRule rule = new VendorAddressRule();
                    VendorAddress     entityVendorAddress = (VendorAddress)p_BE4[i];
                    entityVendorAddress.MainID = entity.ID;
                    entityVendorAddress.Seq    = i + 1;
                    rule.RAdd(entityVendorAddress, sqlTrans);
                }

                for (int i = 0; i < p_BE5.Length; i++)
                {
                    VendorNewsRule rule             = new VendorNewsRule();
                    VendorNews     entityVendorNews = (VendorNews)p_BE5[i];
                    entityVendorNews.MainID = entity.ID;
                    entityVendorNews.Seq    = i + 1;
                    rule.RAdd(entityVendorNews, sqlTrans);
                }

                for (int i = 0; i < p_BE7.Length; i++)
                {
                    ItemAddRule rule          = new ItemAddRule();
                    ItemAdd     entityItemAdd = (ItemAdd)p_BE7[i];
                    entityItemAdd.MainID = entity.ID;
                    entityItemAdd.Seq    = i + 1;
                    rule.RAdd(entityItemAdd, sqlTrans);
                    rule.UpdateFiledSet(entity.ID, entityItemAdd.FiledSetID, entityItemAdd.Value, sqlTrans);
                }

                for (int i = 0; i < p_BE8.Length; i++)
                {
                    VendorInvoiceDtsRule rule = new VendorInvoiceDtsRule();
                    VendorInvoiceDts     entityItemInvoice = (VendorInvoiceDts)p_BE8[i];
                    entityItemInvoice.MainID = entity.ID;
                    entityItemInvoice.Seq    = i + 1;
                    rule.RAdd(entityItemInvoice, sqlTrans);
                }


                VendorTypeDtsRule vendortyperule = new VendorTypeDtsRule();
                vendortyperule.RSave(p_BE, p_BE6, sqlTrans);
                //FormNoControlRule fnrule = new FormNoControlRule();
                //fnrule.RAddSort("Data_Vendor", "VendorID", entity.VendorTypeID, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Example #10
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     VendorInvoiceDts entity = (VendorInvoiceDts)p_BE;
 }