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

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

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Data_FlowerTypeContolDts SET ");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" ColorCode=" + SysString.ToDBString(MasterEntity.ColorCode) + ",");
                UpdateBuilder.Append(" Freestr1=" + SysString.ToDBString(MasterEntity.Freestr1) + ",");
                UpdateBuilder.Append(" Freestr2=" + SysString.ToDBString(MasterEntity.Freestr2) + ",");
                UpdateBuilder.Append(" Freestr3=" + SysString.ToDBString(MasterEntity.Freestr3) + ",");
                UpdateBuilder.Append(" Freestr4=" + SysString.ToDBString(MasterEntity.Freestr4) + ",");
                UpdateBuilder.Append(" Freestr5=" + SysString.ToDBString(MasterEntity.Freestr5) + ",");
                UpdateBuilder.Append(" Freestr6=" + SysString.ToDBString(MasterEntity.Freestr6) + ",");
                UpdateBuilder.Append(" Freestr7=" + SysString.ToDBString(MasterEntity.Freestr7) + ",");
                UpdateBuilder.Append(" Freestr8=" + SysString.ToDBString(MasterEntity.Freestr8) + ",");
                UpdateBuilder.Append(" Freestr9=" + SysString.ToDBString(MasterEntity.Freestr9) + ",");
                UpdateBuilder.Append(" Freestr10=" + SysString.ToDBString(MasterEntity.Freestr10) + ",");
                UpdateBuilder.Append(" Freestr11=" + SysString.ToDBString(MasterEntity.Freestr11) + ",");
                UpdateBuilder.Append(" Freestr12=" + SysString.ToDBString(MasterEntity.Freestr12) + ",");
                UpdateBuilder.Append(" Freestr13=" + SysString.ToDBString(MasterEntity.Freestr13) + ",");
                UpdateBuilder.Append(" Freestr14=" + SysString.ToDBString(MasterEntity.Freestr14) + ",");
                UpdateBuilder.Append(" Freestr15=" + SysString.ToDBString(MasterEntity.Freestr15));

                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);
            }
        }
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            FlowerTypeContolDts entity = new FlowerTypeContolDts();

            entity.MainID = HTDataID;
            entity.Seq    = saveSeq;
            FlowerTypeContolDtsRule rule = new FlowerTypeContolDtsRule();

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

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

            return(ret);
        }
        private void btnUpdate_Click_1(object sender, EventArgs e)
        {
            FlowerTypeContolDts entity = new FlowerTypeContolDts();

            entity.MainID    = HTDataID;
            entity.Seq       = saveSeq;
            entity.ColorCode = txtDHX.Text.Trim();
            entity.Freestr1  = txtDMS.Text.Trim();
            entity.Freestr2  = txtDJBBM.Text.Trim();
            entity.Freestr3  = txtDYS.Text.Trim();
            entity.Freestr4  = txtDML.Text.Trim();
            entity.Freestr5  = txtDSize.Text.Trim();
            entity.Freestr6  = txtJZ.Text.Trim();
            FlowerTypeContolDtsRule rule = new FlowerTypeContolDtsRule();

            rule.RUpdate(entity);
            BindGridDts();
        }
示例#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);
         FlowerTypeContolDts    entity  = (FlowerTypeContolDts)p_BE;
         FlowerTypeContolDtsCtl control = new FlowerTypeContolDtsCtl(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);
         FlowerTypeContolDts    entity  = (FlowerTypeContolDts)p_BE;
         FlowerTypeContolDtsCtl control = new FlowerTypeContolDtsCtl(sqlTrans);
         //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Data_FlowerTypeContolDts,sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
        private void btnSaveD_Click_1(object sender, EventArgs e)
        {
            FlowerTypeContolDts entity = new FlowerTypeContolDts();

            entity.MainID = HTDataID;
            string    sql = " SELECT MAX(Seq) from Data_FlowerTypeContolDts where MainID=" + entity.MainID;
            DataTable dt  = SysUtils.Fill(sql);

            entity.Seq       = SysConvert.ToInt32(dt.Rows[0][0]) + 1;
            entity.ColorCode = txtDHX.Text.Trim();
            entity.Freestr1  = txtDMS.Text.Trim();
            entity.Freestr2  = txtDJBBM.Text.Trim();
            entity.Freestr3  = txtDYS.Text.Trim();
            entity.Freestr4  = txtDML.Text.Trim();
            entity.Freestr5  = txtDSize.Text.Trim();
            entity.Freestr6  = txtJZ.Text.Trim();

            FlowerTypeContolDtsRule rule = new FlowerTypeContolDtsRule();

            rule.RAdd(entity);
            BindGridDts();
        }
示例#9
0
 /// <summary>
 /// 保存(传入事务处理)
 /// </summary>
 /// <param name="p_Entity"></param>
 /// <param name="p_BE"></param>
 /// <param name="sqlTrans"></param>
 public void RSave(FlowerTypeContol p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         for (int i = 0; i < p_BE.Length; i++)
         {
             FlowerTypeContolDts entitydts = (FlowerTypeContolDts)p_BE[i];
             string sql = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM Data_FlowerTypeContolDts WHERE MainID=" + p_Entity.ID.ToString();
             entitydts.Seq    = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());//找到最大的Seq
             entitydts.MainID = p_Entity.ID;
             this.RAdd(entitydts, sqlTrans);
         }
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private FlowerTypeContolDts[] EntityDtsGet()
        {
            int index = GetDataCompleteNum();

            FlowerTypeContolDts[] entitydts = new FlowerTypeContolDts[index];
            index = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (CheckDataCompleteDts(i))
                {
                    entitydts[index]        = new FlowerTypeContolDts();
                    entitydts[index].MainID = HTDataID;
                    entitydts[index].Seq    = i + 1;
                    entitydts[index].SelectByID();

                    entitydts[index].ColorCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorCode"));
                    entitydts[index].Freestr1  = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr1"));
                    entitydts[index].Freestr2  = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr2"));
                    entitydts[index].Freestr3  = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr3"));
                    entitydts[index].Freestr4  = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr4"));
                    entitydts[index].Freestr5  = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr5"));
                    entitydts[index].Freestr6  = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr6"));
                    entitydts[index].Freestr7  = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr7"));
                    entitydts[index].Freestr8  = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr8"));
                    entitydts[index].Freestr9  = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr9"));
                    entitydts[index].Freestr10 = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr10"));
                    entitydts[index].Freestr11 = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr11"));
                    entitydts[index].Freestr12 = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr12"));
                    entitydts[index].Freestr13 = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr13"));
                    entitydts[index].Freestr14 = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr14"));
                    entitydts[index].Freestr15 = SysConvert.ToString(gridView1.GetRowCellValue(i, "Freestr15"));


                    index++;
                }
            }
            return(entitydts);
        }
示例#11
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                FlowerTypeContolDts MasterEntity = (FlowerTypeContolDts)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Data_FlowerTypeContolDts(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("MainID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ",");
                MasterField.Append("Seq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ",");
                MasterField.Append("ColorCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorCode) + ",");
                MasterField.Append("Freestr1" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr1) + ",");
                MasterField.Append("Freestr2" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr2) + ",");
                MasterField.Append("Freestr3" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr3) + ",");
                MasterField.Append("Freestr4" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr4) + ",");
                MasterField.Append("Freestr5" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr5) + ",");
                MasterField.Append("Freestr6" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr6) + ",");
                MasterField.Append("Freestr7" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr7) + ",");
                MasterField.Append("Freestr8" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr8) + ",");
                MasterField.Append("Freestr9" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr9) + ",");
                MasterField.Append("Freestr10" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr10) + ",");
                MasterField.Append("Freestr11" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr11) + ",");
                MasterField.Append("Freestr12" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr12) + ",");
                MasterField.Append("Freestr13" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr13) + ",");
                MasterField.Append("Freestr14" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr14) + ",");
                MasterField.Append("Freestr15" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Freestr15) + ")");



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