Exemplo n.º 1
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, int Flag, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                Item      entity = (Item)p_BE;
                string    sql    = "SELECT ItemCode FROM Data_Item WHERE ItemCode=" + SysString.ToDBString(entity.ItemCode);
                DataTable dt     = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("编码已存在,请重新生成");
                }

                ItemCtl control = new ItemCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_Item, sqlTrans);
                control.AddNew(entity);

                ItemColorDtsRule rule2 = new ItemColorDtsRule();
                rule2.RSave(entity, p_BE2, sqlTrans);

                ItemAddRule ruleItemAdd = new ItemAddRule();
                for (int i = 0; i < p_BE3.Length; i++)
                {
                    ItemAdd entityDts = (ItemAdd)p_BE3[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruleItemAdd.RAdd(entityDts, sqlTrans);

                    ruleItemAdd.UpdateFiledSet(entity.ID, entityDts.FiledSetID, entityDts.Value, sqlTrans);
                }

                ItemPicRule ruleItemPic = new ItemPicRule();
                for (int i = 0; i < p_BE4.Length; i++)
                {
                    ItemPic entityDts = (ItemPic)p_BE4[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruleItemPic.RAdd(entityDts, sqlTrans);
                }

                ItemCodeFacDtsRule ruleItemCodeFac = new ItemCodeFacDtsRule();
                for (int i = 0; i < p_BE5.Length; i++)
                {
                    ItemCodeFacDts entityDts = (ItemCodeFacDts)p_BE5[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruleItemCodeFac.RAdd(entityDts, sqlTrans);
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="p_BE3">原料</param>
        /// <param name="p_BE4">颜色</param>
        /// <param name="p_BE5">类别</param>
        /// <param name="p_BE6">物理指标</param>
        /// <param name="p_BE7">替代白坯</param>
        /// <param name="p_BE8">工厂编码及报价</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE3, BaseEntity[] p_BE4, BaseEntity[] p_BE5, BaseEntity[] p_BE6, BaseEntity[] p_BE7, BaseEntity[] p_BE8, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);

                Item entity = (Item)p_BE;
                this.RAdd(p_BE, sqlTrans);

                for (int i = 0; i < p_BE3.Length; i++)
                {
                    ItemDtsRule rule          = new ItemDtsRule();
                    ItemDts     entityItemDts = (ItemDts)p_BE3[i];
                    entityItemDts.MainID = entity.ID;
                    entityItemDts.Seq    = i + 1;
                    rule.RAdd(entityItemDts, sqlTrans);
                }

                for (int i = 0; i < p_BE4.Length; i++)
                {
                    ItemColorDtsRule rule = new ItemColorDtsRule();
                    ItemColorDts     entityItemColorDts = (ItemColorDts)p_BE4[i];
                    entityItemColorDts.MainID = entity.ID;
                    entityItemColorDts.Seq    = i + 1;
                    rule.RAdd(entityItemColorDts, sqlTrans);
                }
                for (int i = 0; i < p_BE5.Length; i++)
                {
                    ItemLBDtsRule rule            = new ItemLBDtsRule();
                    ItemLBDts     entityItemLBDts = (ItemLBDts)p_BE5[i];
                    entityItemLBDts.MainID = entity.ID;
                    entityItemLBDts.Seq    = i + 1;
                    rule.RAdd(entityItemLBDts, sqlTrans);
                }
                if (p_BE6 != null)
                {
                    for (int i = 0; i < p_BE6.Length; i++)
                    {
                        ItemCheckStandardPhyRule rule          = new ItemCheckStandardPhyRule();
                        ItemCheckStandardPhy     entityItemcsp = (ItemCheckStandardPhy)p_BE6[i];
                        entityItemcsp.MainID = entity.ID;
                        entityItemcsp.Seq    = i + 1;
                        rule.RAdd(entityItemcsp, sqlTrans);
                    }
                }

                if (p_BE7 != null)
                {
                    for (int i = 0; i < p_BE7.Length; i++)
                    {
                        ItemGreyFabReplaceRule rule          = new ItemGreyFabReplaceRule();
                        ItemGreyFabReplace     entityItemgfr = (ItemGreyFabReplace)p_BE7[i];
                        entityItemgfr.MainID = entity.ID;
                        entityItemgfr.Seq    = i + 1;
                        rule.RAdd(entityItemgfr, sqlTrans);
                    }
                }

                if (p_BE8 != null)
                {
                    for (int i = 0; i < p_BE8.Length; i++)
                    {
                        ItemCodeFacDtsRule rule          = new ItemCodeFacDtsRule();
                        ItemCodeFacDts     entityItemfac = (ItemCodeFacDts)p_BE8[i];
                        entityItemfac.MainID = entity.ID;
                        entityItemfac.Seq    = i + 1;
                        rule.RAdd(entityItemfac, sqlTrans);
                    }
                }
                //FormNoControlRule rulefSt = new FormNoControlRule();
                //rulefSt.RAddSort((int)FormNoControlEnum.产品编码, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Exemplo n.º 3
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, int Flag, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                Item      entity = (Item)p_BE;
                string    sql    = "SELECT ItemCode FROM Data_Item WHERE ItemCode=" + SysString.ToDBString(entity.ItemCode) + " AND ID<>" + entity.ID;
                DataTable dt     = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("编码已存在,请重新生成");
                }

                ItemCtl control = new ItemCtl(sqlTrans);
                control.Update(entity);


                ItemColorDtsRule rule2 = new ItemColorDtsRule();
                rule2.RSave(entity, p_BE2, sqlTrans);

                if (p_BE3.Length > 0)
                {
                    sql  = "DELETE  Data_ItemAdd WHERE MainID=" + SysString.ToDBString(entity.ID);
                    sql += " AND ISNULL(FormID,0)=" + SysString.ToDBString(((ItemAdd)p_BE3[0]).FormID);
                    sql += " AND ISNULL(FormAID,0)=" + SysString.ToDBString(((ItemAdd)p_BE3[0]).FormAID);
                    sql += " AND ISNULL(FormBID,0)=" + SysString.ToDBString(((ItemAdd)p_BE3[0]).FormBID);
                    sqlTrans.ExecuteNonQuery(sql);
                }

                ItemAddRule ruleItemAdd = new ItemAddRule();
                for (int i = 0; i < p_BE3.Length; i++)
                {
                    ItemAdd entityDts = (ItemAdd)p_BE3[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruleItemAdd.RAdd(entityDts, sqlTrans);

                    ruleItemAdd.UpdateFiledSet(entity.ID, entityDts.FiledSetID, entityDts.Value, sqlTrans);
                }

                sql = "DELETE Data_ItemPic WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);

                ItemPicRule ruleItemPic = new ItemPicRule();
                for (int i = 0; i < p_BE4.Length; i++)
                {
                    ItemPic entityDts = (ItemPic)p_BE4[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruleItemPic.RAdd(entityDts, sqlTrans);
                }

                sql = "DELETE Data_ItemCodeFacDts WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);

                ItemCodeFacDtsRule ruleItemCodeFac = new ItemCodeFacDtsRule();
                for (int i = 0; i < p_BE5.Length; i++)
                {
                    ItemCodeFacDts entityDts = (ItemCodeFacDts)p_BE5[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruleItemCodeFac.RAdd(entityDts, sqlTrans);
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }