Exemplo n.º 1
0
 /// <summary>
 /// 新增(传入事务处理)
 /// </summary>
 /// <param name="p_BE">要新增的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         MSGInput  entity = (MSGInput)p_BE;
         string    sql    = "SELECT FormNo FROM SMS_MSGInput WHERE FormNo=" + SysString.ToDBString(entity.FormNo);
         DataTable dt     = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("单号已存在,请重新生成");
         }
         MSGInputCtl control = new MSGInputCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.SMS_MSGInput, sqlTrans);
         control.AddNew(entity);
         for (int i = 0; i < p_BE2.Length; i++)
         {
             MSGInputDtsRule rule      = new MSGInputDtsRule();
             MSGInputDts     entityDts = (MSGInputDts)p_BE2[i];
             entityDts.MainID = entity.ID;
             entityDts.Seq    = i + 1;
             rule.RAdd(entityDts, sqlTrans);
         }
         FormNoControlRule rulest = new FormNoControlRule();
         rulest.RAddSort((int)FormNoControlEnum.短信输入单号, sqlTrans);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                MSGInput MasterEntity = (MSGInput)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM SMS_MSGInput 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);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            MSGInput entity = new MSGInput();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            txtFormNo.Text           = entity.FormNo.ToString();
            txtFormDate.DateTime     = entity.FormDate;
            drpMSGSourceID.EditValue = entity.MSGSourceID;
            txtContext.Text          = entity.Context.ToString();
            txtReplaceRule.Text      = entity.ReplaceRule.ToString();
            txtSendInfo.Text         = entity.SendInfo.ToString();
            txtSendDesc.Text         = entity.SendDesc.ToString();
            txtRemark.Text           = entity.Remark.ToString();


            HTDataSubmitFlag = entity.SubmitFlag;
            //HTDataDelFlag = entity.DelFlag;
            if (!findFlag)
            {
            }

            BindGridDts();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 删除
        /// </summary>
        public override void EntityDelete()
        {
            MSGInputRule rule   = new MSGInputRule();
            MSGInput     entity = EntityGet();

            rule.RDelete(entity);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private MSGInput EntityGet()
        {
            MSGInput entity = new MSGInput();

            entity.ID = HTDataID;
            return(entity);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 修改
        /// </summary>
        public override void EntityUpdate()
        {
            MSGInputRule rule   = new MSGInputRule();
            MSGInput     entity = EntityGet();

            MSGInputDts[] entitydts = EntityDtsGet();
            entity.SubmitFlag = this.HTSubmitFlagUpdateGet();
            rule.RUpdate(entity, entitydts);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            MSGInputRule rule   = new MSGInputRule();
            MSGInput     entity = EntityGet();

            MSGInputDts[] entitydts = EntityDtsGet();

            entity.SubmitFlag = this.HTSubmitFlagInsertGet();
            rule.RAdd(entity, entitydts);
            return(entity.ID);
        }
Exemplo n.º 8
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)
        {
            MSGInput  entity = (MSGInput)p_BE;
            bool      ret    = false;
            string    sql    = string.Format(" SELECT {0} FROM {1} WHERE 1=1 AND {0}={2} AND {3}<>{4}", p_FieldName, MSGInput.TableName, SysString.ToDBString(p_FieldValue), "ID", entity.ID);
            DataTable dt     = p_sqlTrans.Fill(sql);

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

            return(ret);
        }
Exemplo n.º 9
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         MSGInput    entity  = (MSGInput)p_BE;
         MSGInputCtl control = new MSGInputCtl(sqlTrans);
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Exemplo n.º 10
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);
         MSGInput    entity  = (MSGInput)p_BE;
         MSGInputCtl control = new MSGInputCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.SMS_MSGInput, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private MSGInput EntityGet()
        {
            MSGInput entity = new MSGInput();

            entity.ID = HTDataID;
            entity.SelectByID();

            entity.FormNo      = txtFormNo.Text.Trim();
            entity.FormDate    = txtFormDate.DateTime.Date;
            entity.InsertTime  = DateTime.Now.Date;
            entity.MSGSourceID = SysConvert.ToInt32(drpMSGSourceID.EditValue);
            entity.Context     = txtContext.Text.Trim();
            entity.ReplaceRule = txtReplaceRule.Text.Trim();
            entity.SendInfo    = txtSendInfo.Text.Trim();
            entity.SendDesc    = txtSendDesc.Text.Trim();
            entity.Remark      = txtRemark.Text.Trim();


            return(entity);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                MSGInput MasterEntity = (MSGInput)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO SMS_MSGInput(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("FormNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormNo) + ",");
                MasterField.Append("FormDate" + ",");
                if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("InsertTime" + ",");
                if (MasterEntity.InsertTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.InsertTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("MSGSourceID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MSGSourceID) + ",");
                MasterField.Append("Context" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Context) + ",");
                MasterField.Append("ReplaceRule" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ReplaceRule) + ",");
                MasterField.Append("SendInfo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SendInfo) + ",");
                MasterField.Append("SendDesc" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SendDesc) + ",");
                MasterField.Append("SubmitFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                MasterField.Append("Remark" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ")");



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

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

                if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" FormDate=" + SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" FormDate=null,");
                }


                if (MasterEntity.InsertTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" InsertTime=" + SysString.ToDBString(MasterEntity.InsertTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" InsertTime=null,");
                }

                UpdateBuilder.Append(" MSGSourceID=" + SysString.ToDBString(MasterEntity.MSGSourceID) + ",");
                UpdateBuilder.Append(" Context=" + SysString.ToDBString(MasterEntity.Context) + ",");
                UpdateBuilder.Append(" ReplaceRule=" + SysString.ToDBString(MasterEntity.ReplaceRule) + ",");
                UpdateBuilder.Append(" SendInfo=" + SysString.ToDBString(MasterEntity.SendInfo) + ",");
                UpdateBuilder.Append(" SendDesc=" + SysString.ToDBString(MasterEntity.SendDesc) + ",");
                UpdateBuilder.Append(" SubmitFlag=" + SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark));

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