Exemple #1
0
        /// <summary>
        /// 森林防火办事机构人员统计
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Add(FIRERECORD_REPORT9_Model m)
        {
            List <string> sqllist = new List <string>();

            string[] arrREPORTCODE       = m.REPORTCODE.Split(',');
            string[] arrSSXTYPELEVELCODE = m.SSXTYPELEVELCODE.Split(',');
            string[] arrREPORTVALUE      = m.REPORTVALUE.Split(',');
            for (int i = 0; i < arrREPORTVALUE.Length - 1; i++)
            {
                #region 更新
                if (isExists(new FIRERECORD_REPORT9_SW {
                    BYORGNO = m.BYORGNO, REPORTYEAR = m.REPORTYEAR, REPORTCODE = arrREPORTCODE[i], SSXTYPELEVELCODE = arrSSXTYPELEVELCODE[i]
                }))
                {
                    StringBuilder sbUpdate = new StringBuilder();
                    sbUpdate.AppendFormat("UPDATE FIRERECORD_REPORT9 SET ");
                    sbUpdate.AppendFormat(" REPORTVALUE= '{0}'", ClsSql.EncodeSql(arrREPORTVALUE[i]));
                    sbUpdate.AppendFormat(" where BYORGNO= '{0}'", ClsSql.EncodeSql(m.BYORGNO));
                    sbUpdate.AppendFormat(" and REPORTYEAR= '{0}'", ClsSql.EncodeSql(m.REPORTYEAR));
                    sbUpdate.AppendFormat(" and REPORTCODE= '{0}'", ClsSql.EncodeSql(arrREPORTCODE[i]));
                    sbUpdate.AppendFormat(" and SSXTYPELEVELCODE= '{0}'", ClsSql.EncodeSql(arrSSXTYPELEVELCODE[i]));
                    //sbUpdate.AppendFormat(" and REPORTVALUE= '{0}'", ClsSql.EncodeSql(arrREPORTVALUE[i]));
                    sqllist.Add(sbUpdate.ToString());
                }
                #endregion

                #region 添加
                else
                {
                    StringBuilder sbInsert = new StringBuilder();
                    sbInsert.AppendFormat("INSERT  INTO  FIRERECORD_REPORT9(BYORGNO,REPORTYEAR,REPORTCODE,SSXTYPELEVELCODE,REPORTVALUE)");
                    sbInsert.AppendFormat("VALUES(");
                    sbInsert.AppendFormat(" {0}", ClsSql.saveNullField(m.BYORGNO));
                    sbInsert.AppendFormat(",{0}", ClsSql.saveNullField(m.REPORTYEAR));
                    sbInsert.AppendFormat(",{0}", ClsSql.saveNullField(arrREPORTCODE[i]));
                    sbInsert.AppendFormat(",{0}", ClsSql.saveNullField(arrSSXTYPELEVELCODE[i]));
                    sbInsert.AppendFormat(",{0}", ClsSql.saveNullField(arrREPORTVALUE[i]));
                    sbInsert.AppendFormat(")");
                    sqllist.Add(sbInsert.ToString());
                }
                #endregion
            }
            var j = DataBaseClass.ExecuteSqlTran(sqllist);
            if (j >= 0)
            {
                return(new Message(true, "保存成功!", ""));
            }
            else
            {
                return(new Message(false, "保存失败,事物回滚机制!", ""));
            }
        }
Exemple #2
0
        /// <summary>
        /// 增、删、改
        /// </summary>
        /// <param name="m">参见模型FIRERECORD_REPORT9_Model</param>
        /// <returns>参见模型Message</returns>
        public static Message Manager(FIRERECORD_REPORT9_Model m)
        {
            if (m.opMethod == "Add")
            {
                Message msgMENU = BaseDT.FIRERECORD_REPORT9.Add(m);
                if (msgMENU.Success == false)
                {
                    return(new Message(msgMENU.Success, msgMENU.Msg, ""));
                }
                return(new Message(msgMENU.Success, msgMENU.Msg, m.returnUrl));
            }

            return(new Message(false, "无效操作!", m.returnUrl));
        }
Exemple #3
0
        /// <summary>
        /// 获取森林防火办事人员统计单条数据
        /// </summary>
        /// <param name="sw">参见模型FIRERECORD_REPORT9_Model</param>
        /// <returns>参见模型FIRERECORD_REPORT9_Model</returns>
        public static IEnumerable <FIRERECORD_REPORT9_Model> getListModel(FIRERECORD_REPORT9_SW sw)
        {
            var       result = new List <FIRERECORD_REPORT9_Model>();
            DataTable dt     = BaseDT.FIRERECORD_REPORT9.getDT(sw);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                FIRERECORD_REPORT9_Model m = new FIRERECORD_REPORT9_Model();
                m.FIRERECORD_REPORT9ID = dt.Rows[i]["FIRERECORD_REPORT9ID"].ToString();
                m.BYORGNO          = dt.Rows[i]["BYORGNO"].ToString();
                m.REPORTYEAR       = dt.Rows[i]["REPORTYEAR"].ToString();
                m.REPORTCODE       = dt.Rows[i]["REPORTCODE"].ToString();
                m.SSXTYPELEVELCODE = dt.Rows[i]["SSXTYPELEVELCODE"].ToString();
                m.REPORTVALUE      = dt.Rows[i]["REPORTVALUE"].ToString();
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 获取森林防火办事人员统计单条数据
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static FIRERECORD_REPORT9_Model getModel(FIRERECORD_REPORT9_SW sw)
        {
            DataTable dt = BaseDT.FIRERECORD_REPORT9.getDT(sw);
            FIRERECORD_REPORT9_Model m = new FIRERECORD_REPORT9_Model();
            DataTable dtORG            = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                               //获取单位

            if (dt != null && dt.Rows.Count > 0)
            {
                int i = 0;
                m.FIRERECORD_REPORT9ID = dt.Rows[i]["FIRERECORD_REPORT9ID"].ToString();
                m.BYORGNO          = dt.Rows[i]["BYORGNO"].ToString();
                m.REPORTYEAR       = dt.Rows[i]["REPORTYEAR"].ToString();
                m.REPORTCODE       = dt.Rows[i]["REPORTCODE"].ToString();
                m.SSXTYPELEVELCODE = dt.Rows[i]["SSXTYPELEVELCODE"].ToString();
                m.REPORTVALUE      = dt.Rows[i]["REPORTVALUE"].ToString();
            }
            dt.Clear();
            dt.Dispose();
            dtORG.Clear();
            dtORG.Dispose();
            return(m);
        }