예제 #1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="m">m</param>
        /// <returns></returns>
        public static Message Save(FIRERECORD_ARMY_Model m)
        {
            List <string> sqllist = new List <string>();

            string[] arrREPORTCODE  = m.REPORTCODE.Split(',');
            string[] arrREPORTVALUE = m.REPORTVALUE.Split(',');

            #region 保存
            for (int i = 0; i < arrREPORTVALUE.Length - 1; i++)
            {
                #region 更新
                if (isExists(new FIRERECORD_ARMY_SW {
                    BYORGNO = m.BYORGNO, REPORTYEAR = m.REPORTYEAR, REPORTCODE = arrREPORTCODE[i]
                }))
                {
                    StringBuilder sbUpdate = new StringBuilder();
                    sbUpdate.AppendFormat("UPDATE FIRERECORD_ARMY 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]));
                    sqllist.Add(sbUpdate.ToString());
                }
                #endregion

                #region 添加
                else
                {
                    StringBuilder sbInsert = new StringBuilder();
                    sbInsert.AppendFormat(" INSERT  INTO  FIRERECORD_ARMY(BYORGNO,REPORTYEAR,REPORTCODE,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(arrREPORTVALUE[i]));
                    sbInsert.AppendFormat(")");
                    sqllist.Add(sbInsert.ToString());
                }
                #endregion
            }
            #endregion

            var j = DataBaseClass.ExecuteSqlTran(sqllist);
            if (j >= 0)
            {
                return(new Message(true, "保存成功!", ""));
            }
            else
            {
                return(new Message(false, "保存失败,事物回滚机制!", ""));
            }
        }
예제 #2
0
 /// <summary>
 /// 增、删、改
 /// </summary>
 /// <param name="m">参见模型FIRERECORD_ARMY_Model</param>
 /// <returns>参见模型Message</returns>
 public static Message Manager(FIRERECORD_ARMY_Model m)
 {
     if (m.opMethod == "Add")
     {
         Message msgMENU = BaseDT.FIRERECORD_ARMY.Save(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));
 }
예제 #3
0
        /// <summary>
        /// 获取队伍表列表
        /// </summary>
        /// <param name="sw">参见模型FIRERECORD_ARMY_Model</param>
        /// <returns>参见模型FIRERECORD_ARMY_Model</returns>
        public static IEnumerable <FIRERECORD_ARMY_Model> getListModel(FIRERECORD_ARMY_SW sw)
        {
            var       result = new List <FIRERECORD_ARMY_Model>();
            DataTable dt     = BaseDT.FIRERECORD_ARMY.getDT(sw);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                FIRERECORD_ARMY_Model m = new FIRERECORD_ARMY_Model();
                m.FIRERECORD_ARMYID = dt.Rows[i]["FIRERECORD_ARMYID"].ToString();
                m.BYORGNO           = dt.Rows[i]["BYORGNO"].ToString();
                m.REPORTYEAR        = dt.Rows[i]["REPORTYEAR"].ToString();
                m.REPORTCODE        = dt.Rows[i]["REPORTCODE"].ToString();
                m.REPORTVALUE       = dt.Rows[i]["REPORTVALUE"].ToString();
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }
예제 #4
0
        /// <summary>
        /// 获取队伍表单条数据
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static FIRERECORD_ARMY_Model getModel(FIRERECORD_ARMY_SW sw)
        {
            DataTable             dt    = BaseDT.FIRERECORD_ARMY.getDT(sw);
            FIRERECORD_ARMY_Model m     = new FIRERECORD_ARMY_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_ARMYID = dt.Rows[i]["FIRERECORD_ARMYID"].ToString();
                m.BYORGNO           = dt.Rows[i]["BYORGNO"].ToString();
                m.REPORTYEAR        = dt.Rows[i]["REPORTYEAR"].ToString();
                m.REPORTCODE        = dt.Rows[i]["REPORTCODE"].ToString();
                m.REPORTVALUE       = dt.Rows[i]["REPORTVALUE"].ToString();
            }
            dt.Clear();
            dt.Dispose();
            dtORG.Clear();
            dtORG.Dispose();
            return(m);
        }