示例#1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Save(PEST_REPORT_SCXCBFZMX_Model m)
        {
            List <string> sqllist = new List <string>();

            string[] arrBYORGNO            = m.BYORGNO.Split(',');
            string[] arrSCXCBFZMXTYPEID    = m.SCXCBFZMXTYPEID.Split(',');
            string[] arrSCXCBFZMXTYPEVALUE = m.SCXCBFZMXTYPEVALUE.Split(',');
            string[] arrSCXCBFZMXVARCHAR   = m.SCXCBFZMXVARCHAR.Split(',');

            #region 更新
            if (arrSCXCBFZMXTYPEID.Length - 1 > 0)
            {
                StringBuilder sbInsert = new StringBuilder();
                sbInsert.AppendFormat("INSERT INTO PEST_REPORT_SCXCBFZMX( PEST_REPORT_SCXCBFZID, SCXCBFZMXTYPEID, SCXCBFZMXTYPEVALUE, SCXCBFZMXVARCHAR)");
                for (int i = 0; i < arrSCXCBFZMXTYPEID.Length - 1; i++)
                {
                    string sql       = "Select PEST_REPORT_SCXCBFZID From PEST_REPORT_SCXCBFZ WHERE BYORGNO='" + arrBYORGNO[i] + "' AND SCXCBFZYEAR='" + m.SCXCBFZYEAR + "'";
                    string SCXCBFZID = DataBaseClass.ReturnSqlField(sql);
                    if (SCXCBFZID != "")
                    {
                        sbInsert.AppendFormat(" select '{0}'", ClsSql.EncodeSql(SCXCBFZID));
                        sbInsert.AppendFormat(",'{0}'", ClsSql.EncodeSql(arrSCXCBFZMXTYPEID[i]));
                        sbInsert.AppendFormat(",'{0}'", ClsSql.EncodeSql(arrSCXCBFZMXTYPEVALUE[i]));
                        sbInsert.AppendFormat(",'{0}'", ClsSql.EncodeSql(arrSCXCBFZMXVARCHAR[i]));
                        sbInsert.AppendFormat(" UNION ALL ");
                    }
                }
                string insertStr = sbInsert.ToString();
                if (insertStr.Contains(" UNION ALL "))
                {
                    insertStr = insertStr.Substring(0, insertStr.Length - 10);
                    sqllist.Add(insertStr);
                }
            }
            #endregion

            var y = DataBaseClass.ExecuteSqlTran(sqllist);
            if (y >= 0)
            {
                return(new Message(true, "保存成功!", ""));
            }
            else
            {
                return(new Message(false, "保存失败,事物回滚机制!", ""));
            }
        }
示例#2
0
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <param name="sw">参见模型PEST_REPORT_HAPPEN_SW</param>
        /// <returns>参见模型PEST_REPORT_HAPPEN_Model</returns>
        public static IEnumerable <PEST_REPORT_SCXCBFZMX_Model> getListModel(PEST_REPORT_SCXCBFZMX_SW sw)
        {
            var       result = new List <PEST_REPORT_SCXCBFZMX_Model>();
            DataTable dt     = BaseDT.PEST_REPORT_SCXCBFZMX.getDT(sw);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PEST_REPORT_SCXCBFZMX_Model m = new PEST_REPORT_SCXCBFZMX_Model();
                m.PEST_REPORT_SCXCBFZMXID = dt.Rows[i]["PEST_REPORT_SCXCBFZMXID"].ToString();
                m.PEST_REPORT_SCXCBFZID   = dt.Rows[i]["PEST_REPORT_SCXCBFZID"].ToString();
                m.SCXCBFZMXTYPEID         = dt.Rows[i]["SCXCBFZMXTYPEID"].ToString();
                m.SCXCBFZMXTYPEVALUE      = dt.Rows[i]["SCXCBFZMXTYPEVALUE"].ToString();
                m.SCXCBFZMXVARCHAR        = dt.Rows[i]["SCXCBFZMXVARCHAR"].ToString();
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }
示例#3
0
        /// <summary>
        /// 获取单条记录
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static PEST_REPORT_SCXCBFZMX_Model getModel(PEST_REPORT_SCXCBFZMX_SW sw)
        {
            DataTable dt = BaseDT.PEST_REPORT_SCXCBFZMX.getDT(sw);
            PEST_REPORT_SCXCBFZMX_Model m = new PEST_REPORT_SCXCBFZMX_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                //数据库表字段
                m.PEST_REPORT_SCXCBFZMXID = dt.Rows[i]["PEST_REPORT_SCXCBFZMXID"].ToString();
                m.PEST_REPORT_SCXCBFZID   = dt.Rows[i]["PEST_REPORT_SCXCBFZID"].ToString();
                m.SCXCBFZMXTYPEID         = dt.Rows[i]["SCXCBFZMXTYPEID"].ToString();
                m.SCXCBFZMXTYPEVALUE      = dt.Rows[i]["SCXCBFZMXTYPEVALUE"].ToString();
                m.SCXCBFZMXVARCHAR        = dt.Rows[i]["SCXCBFZMXVARCHAR"].ToString();
                //扩充字段
            }
            dt.Clear();
            dt.Dispose();
            return(m);
        }
示例#4
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="m">参见模型</param>
 /// <returns>参见模型</returns>
 public static Message Manager(PEST_REPORT_SCXCBFZMX_Model m)
 {
     return(BaseDT.PEST_REPORT_SCXCBFZMX.Save(m));
 }