예제 #1
0
        /// <summary>
        /// 获取白坯面料替代表实体
        /// </summary>
        /// <returns></returns>
        private ItemGreyFabReplace[] GetEntityGreyFabReplace()
        {
            int Num = 0;

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

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


                    entitydts[index].GreyFabItemCode = SysConvert.ToString(gridView4.GetRowCellValue(i, "GreyFabItemCode"));
                    entitydts[index].ItemCode        = txtItemCode.Text.Trim();
                    index++;
                }
            }
            return(entitydts);
        }
예제 #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                ItemGreyFabReplace MasterEntity = (ItemGreyFabReplace)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Data_ItemGreyFabReplace 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_Entity"></param>
 /// <param name="p_BE"></param>
 /// <param name="sqlTrans"></param>
 public void RSave(Item p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         string sql = "DELETE FROM Data_ItemGreyFabReplace WHERE MainID=" + p_Entity.ID.ToString();
         sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE));
         sqlTrans.ExecuteNonQuery(sql);//删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据
         for (int i = 0; i < p_BE.Length; i++)
         {
             ItemGreyFabReplace entitydts = (ItemGreyFabReplace)p_BE[i];
             if (entitydts.ID != 0)//ID不为0说明数据库中已经存在
             {
                 this.RUpdate(entitydts, sqlTrans);
             }
             else
             {
                 entitydts.MainID = p_Entity.ID;
                 this.RAdd(entitydts, sqlTrans);
             }
         }
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
예제 #4
0
        /// <summary>
        /// 获取白坯面料替代表实体
        /// </summary>
        /// <returns></returns>
        private ItemGreyFabReplace[] GetEntityGreyFabReplace()
        {
            int Num = 0;

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

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


                    entitydts[index].GreyFabItemCode = SysConvert.ToString(gridView4.GetRowCellValue(i, "GreyFabItemCode"));
                    entitydts[index].VendorID        = SysConvert.ToString(gridView4.GetRowCellValue(i, "VendorID"));
                    entitydts[index].Remark          = SysConvert.ToString(gridView4.GetRowCellValue(i, "Remark"));

                    entitydts[index].ItemCode    = SysConvert.ToString(gridView4.GetRowCellValue(i, "ItemCode"));
                    entitydts[index].ItemName    = SysConvert.ToString(gridView4.GetRowCellValue(i, "ItemName"));
                    entitydts[index].ItemStd     = SysConvert.ToString(gridView4.GetRowCellValue(i, "ItemStd"));
                    entitydts[index].ItemModel   = SysConvert.ToString(gridView4.GetRowCellValue(i, "ItemModel"));
                    entitydts[index].Needle      = SysConvert.ToString(gridView4.GetRowCellValue(i, "Needle"));
                    entitydts[index].MWidth      = SysConvert.ToString(gridView4.GetRowCellValue(i, "MWidth"));
                    entitydts[index].MWeight     = SysConvert.ToString(gridView4.GetRowCellValue(i, "MWeight"));
                    entitydts[index].PBPrice     = SysConvert.ToDecimal(gridView4.GetRowCellValue(i, "PBPrice"));
                    entitydts[index].DyePrice    = SysConvert.ToDecimal(gridView4.GetRowCellValue(i, "DyePrice"));
                    entitydts[index].DyeVendorID = SysConvert.ToString(gridView4.GetRowCellValue(i, "DyeVendorID"));
                    entitydts[index].Str1        = SysConvert.ToString(gridView4.GetRowCellValue(i, "Str1"));
                    entitydts[index].Str2        = SysConvert.ToString(gridView4.GetRowCellValue(i, "Str2"));
                    entitydts[index].Str3        = SysConvert.ToString(gridView4.GetRowCellValue(i, "Str3"));
                    entitydts[index].SL          = SysConvert.ToDecimal(gridView4.GetRowCellValue(i, "SL"));



                    // entitydts[index].ItemCode = txtItemCode.Text.Trim();
                    index++;
                }
            }
            return(entitydts);
        }
예제 #5
0
        /// <summary>
        /// 获得数据库里没有被删除的ID(即数据库里有而且UI里也没有删除的数据)
        /// </summary>
        /// <param name="p_BE"></param>
        /// <returns></returns>
        private string GetIDExist(BaseEntity[] p_BE)
        {
            string outstr = "0";

            for (int i = 0; i < p_BE.Length; i++)
            {
                ItemGreyFabReplace entitydts = (ItemGreyFabReplace)p_BE[i];
                if (entitydts.ID != 0)
                {
                    outstr += "," + entitydts.ID;
                }
            }
            return(outstr);
        }
예제 #6
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);
         ItemGreyFabReplace    entity  = (ItemGreyFabReplace)p_BE;
         ItemGreyFabReplaceCtl control = new ItemGreyFabReplaceCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
예제 #7
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);
         ItemGreyFabReplace    entity  = (ItemGreyFabReplace)p_BE;
         ItemGreyFabReplaceCtl control = new ItemGreyFabReplaceCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_ItemGreyFabReplace, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
예제 #8
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                ItemGreyFabReplace MasterEntity = (ItemGreyFabReplace)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Data_ItemGreyFabReplace(");
                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("ItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemCode) + ",");
                MasterField.Append("GreyFabItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.GreyFabItemCode) + ",");
                MasterField.Append("ReplaceFabItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ReplaceFabItemCode) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("VendorID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorID) + ",");
                MasterField.Append("ItemName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemName) + ",");
                MasterField.Append("ItemStd" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemStd) + ",");
                MasterField.Append("ItemModel" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemModel) + ",");
                MasterField.Append("Needle" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Needle) + ",");
                MasterField.Append("MWidth" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MWidth) + ",");
                MasterField.Append("MWeight" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MWeight) + ",");
                MasterField.Append("PBPrice" + ",");
                if (MasterEntity.PBPrice != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.PBPrice) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

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

                MasterField.Append("DyeVendorID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DyeVendorID) + ",");
                MasterField.Append("Str1" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Str1) + ",");
                MasterField.Append("Str2" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Str2) + ",");
                MasterField.Append("Str3" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Str3) + ",");
                MasterField.Append("SL" + ")");
                if (MasterEntity.SL != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.SL) + ")");
                }
                else
                {
                    MasterValue.Append("null)");
                }



                //执行
                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
            {
                ItemGreyFabReplace MasterEntity = (ItemGreyFabReplace)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Data_ItemGreyFabReplace SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" ItemCode=" + SysString.ToDBString(MasterEntity.ItemCode) + ",");
                UpdateBuilder.Append(" GreyFabItemCode=" + SysString.ToDBString(MasterEntity.GreyFabItemCode) + ",");
                UpdateBuilder.Append(" ReplaceFabItemCode=" + SysString.ToDBString(MasterEntity.ReplaceFabItemCode) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" VendorID=" + SysString.ToDBString(MasterEntity.VendorID) + ",");
                UpdateBuilder.Append(" ItemName=" + SysString.ToDBString(MasterEntity.ItemName) + ",");
                UpdateBuilder.Append(" ItemStd=" + SysString.ToDBString(MasterEntity.ItemStd) + ",");
                UpdateBuilder.Append(" ItemModel=" + SysString.ToDBString(MasterEntity.ItemModel) + ",");
                UpdateBuilder.Append(" Needle=" + SysString.ToDBString(MasterEntity.Needle) + ",");
                UpdateBuilder.Append(" MWidth=" + SysString.ToDBString(MasterEntity.MWidth) + ",");
                UpdateBuilder.Append(" MWeight=" + SysString.ToDBString(MasterEntity.MWeight) + ",");

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


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

                UpdateBuilder.Append(" DyeVendorID=" + SysString.ToDBString(MasterEntity.DyeVendorID) + ",");
                UpdateBuilder.Append(" Str1=" + SysString.ToDBString(MasterEntity.Str1) + ",");
                UpdateBuilder.Append(" Str2=" + SysString.ToDBString(MasterEntity.Str2) + ",");
                UpdateBuilder.Append(" Str3=" + SysString.ToDBString(MasterEntity.Str3) + ",");

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


                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>
 private void CheckCorrect(BaseEntity p_BE)
 {
     ItemGreyFabReplace entity = (ItemGreyFabReplace)p_BE;
 }
예제 #11
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);
            }
        }