예제 #1
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);
            }
        }
예제 #2
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);
            }
        }