Example #1
0
 /// <summary>
 /// 保存(传入事务处理)
 /// </summary>
 /// <param name="p_Entity"></param>
 /// <param name="p_BE"></param>
 /// <param name="sqlTrans"></param>
 public void RSave(ProductCheck p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         string sql = "DELETE FROM Att_ProductCheckDts 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++)
         {
             ProductCheckDts entitydts = (ProductCheckDts)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);
     }
 }
Example #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                ProductCheckDts MasterEntity = (ProductCheckDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Att_ProductCheckDts 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);
            }
        }
Example #3
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++)
            {
                ProductCheckDts entitydts = (ProductCheckDts)p_BE[i];
                if (entitydts.ID != 0)
                {
                    outstr += "," + entitydts.ID;
                }
            }
            return(outstr);
        }
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private ProductCheckDts[] EntityDtsGet()
        {
            int index = GetDataCompleteNum();

            ProductCheckDts[] entitydts = new ProductCheckDts[index];
            index = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (CheckDataCompleteDts(i))
                {
                    entitydts[index]    = new ProductCheckDts();
                    entitydts[index].ID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "ID"));
                    entitydts[index].SelectByID();
                    entitydts[index].MainID = HTDataID;
                    entitydts[index].Seq    = i + 1;

                    entitydts[index].PS         = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "PS"));
                    entitydts[index].ItemCode   = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode"));
                    entitydts[index].GoodsCode  = SysConvert.ToString(gridView1.GetRowCellValue(i, "GoodsCode"));
                    entitydts[index].ColorNum   = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorNum"));
                    entitydts[index].ColorName  = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorName"));
                    entitydts[index].VColorNum  = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorNum"));
                    entitydts[index].VColorName = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorName"));
                    entitydts[index].VItemCode  = SysConvert.ToString(gridView1.GetRowCellValue(i, "VItemCode"));
                    entitydts[index].RecQty     = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "RecQty"));
                    entitydts[index].CheckGQty  = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckGQty"));
                    entitydts[index].CheckQty   = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckQty"));
                    entitydts[index].CheckCQty  = entitydts[index].CheckQty - entitydts[index].RecQty;
                    entitydts[index].CheckQQty1 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckQQty1"));
                    entitydts[index].CheckQQty2 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckQQty2"));
                    entitydts[index].CheckQQty3 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckQQty3"));
                    entitydts[index].CheckQQty4 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckQQty4"));
                    entitydts[index].CheckQQty5 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckQQty5"));
                    entitydts[index].CheckQQty6 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckQQty6"));
                    entitydts[index].CheckQQty7 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckQQty7"));
                    entitydts[index].CheckQQty8 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckQQty8"));
                    entitydts[index].CheckQQty9 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CheckQQty9"));
                    entitydts[index].Remark     = SysConvert.ToString(gridView1.GetRowCellValue(i, "Remark"));
                    entitydts[index].Unit       = SysConvert.ToString(gridView1.GetRowCellValue(i, "Unit"));
                    entitydts[index].MWidth     = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "MWidth"));
                    entitydts[index].MWeight    = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "MWeight"));
                    entitydts[index].WeightUnit = SysConvert.ToString(gridView1.GetRowCellValue(i, "WeightUnit"));


                    index++;
                }
            }
            return(entitydts);
        }
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);
         ProductCheckDts    entity  = (ProductCheckDts)p_BE;
         ProductCheckDtsCtl control = new ProductCheckDtsCtl(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);
         ProductCheckDts    entity  = (ProductCheckDts)p_BE;
         ProductCheckDtsCtl control = new ProductCheckDtsCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Att_ProductCheckDts, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Example #7
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                ProductCheckDts MasterEntity = (ProductCheckDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Att_ProductCheckDts(");
                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("PS" + ",");
                if (MasterEntity.PS != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.PS) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("ItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemCode) + ",");
                MasterField.Append("GoodsCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.GoodsCode) + ",");
                MasterField.Append("ColorNum" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorNum) + ",");
                MasterField.Append("ColorName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorName) + ",");
                MasterField.Append("VColorNum" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VColorNum) + ",");
                MasterField.Append("VColorName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VColorName) + ",");
                MasterField.Append("VItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VItemCode) + ",");
                MasterField.Append("RecQty" + ",");
                if (MasterEntity.RecQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.RecQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                MasterField.Append("WeightUnit" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WeightUnit) + ",");
                MasterField.Append("Unit" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Unit) + ")");



                //执行
                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 #8
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                ProductCheckDts MasterEntity = (ProductCheckDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Att_ProductCheckDts SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");

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

                UpdateBuilder.Append(" ItemCode=" + SysString.ToDBString(MasterEntity.ItemCode) + ",");
                UpdateBuilder.Append(" GoodsCode=" + SysString.ToDBString(MasterEntity.GoodsCode) + ",");
                UpdateBuilder.Append(" ColorNum=" + SysString.ToDBString(MasterEntity.ColorNum) + ",");
                UpdateBuilder.Append(" ColorName=" + SysString.ToDBString(MasterEntity.ColorName) + ",");
                UpdateBuilder.Append(" VColorNum=" + SysString.ToDBString(MasterEntity.VColorNum) + ",");
                UpdateBuilder.Append(" VColorName=" + SysString.ToDBString(MasterEntity.VColorName) + ",");
                UpdateBuilder.Append(" VItemCode=" + SysString.ToDBString(MasterEntity.VItemCode) + ",");

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


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


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


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


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


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


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


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


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


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


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


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


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

                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");

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


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

                UpdateBuilder.Append(" WeightUnit=" + SysString.ToDBString(MasterEntity.WeightUnit) + ",");
                UpdateBuilder.Append(" Unit=" + SysString.ToDBString(MasterEntity.Unit));

                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);
            }
        }
Example #9
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     ProductCheckDts entity = (ProductCheckDts)p_BE;
 }