Exemplo n.º 1
0
        /// <summary>
        /// 更新三维库危害等级
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static Message UpdateAceHarmClass(PEST_HARMCLASS_Model m)
        {
            List <string> sqllist      = new List <string>();
            var           arrBYORGNO   = m.BYORGNO.Split(',');
            var           arrHARMCLASS = m.HARMCLASS.Split(',');
            var           arrDCDATE    = m.DCDATE.Split(',');

            for (int i = 0; i < arrBYORGNO.Length - 1; i++)
            {
                if (ClsSql.EncodeSql(arrHARMCLASS[i]) != "")
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat(" UPDATE PESTHARMCLASS SET ");
                    sb.AppendFormat(" HARMCLASS='{0}'", ClsSql.EncodeSql(arrHARMCLASS[i]));
                    sb.AppendFormat(",DCDATE={0}", ClsSql.saveNullField(arrDCDATE[i]));
                    sb.AppendFormat(" WHERE BYORGNO='{0}'", ClsSql.EncodeSql(arrBYORGNO[i]));
                    sqllist.Add(sb.ToString());
                }
            }
            var j = SDEDataBaseClass.ExecuteSqlTran(sqllist);

            if (j >= 0)
            {
                return(new Message(true, "保存成功!", ""));
            }
            else
            {
                return(new Message(false, "保存失败,事物回滚!", ""));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 危害等级导入
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static Message AddImport(PEST_HARMCLASS_Model m)
        {
            Message       ms = null;
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" INSERT INTO  PEST_HARMCLASS(DCDATE, BYORGNO, TOWNNAME, JD, WD, HARMCLASS)");
            sb.AppendFormat(" VALUES(");
            sb.AppendFormat(" '{0}'", ClsSql.EncodeSql(m.DCDATE));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.BYORGNO));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.TOWNNAME));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.JD));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.WD));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.HARMCLASS));
            sb.AppendFormat(")");
            List <string> sqllist = new List <string>();

            sqllist.Add(sb.ToString());
            var i = DataBaseClass.ExecuteSqlTran(sqllist);

            if (i > 0)
            {
                ms = new Message(true, "导入成功!", "");
            }
            else
            {
                ms = new Message(false, "导入失败,事物回滚机制!", "");
            }
            return(ms);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增、删、改
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static Message Manager(PEST_HARMCLASS_Model m)
        {
            Message msg = BaseDT.PEST_HARMCLASS.Save(m);//保存更新二维

            if (msg.Success)
            {
                Message msgAce = BaseDT.PEST_HARMCLASS.UpdateAceHarmClass(m);//更新三维库
            }
            return(new Message(msg.Success, msg.Msg, msg.Url));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 根据时间删除
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static Message DeleteByDCDATE(PEST_HARMCLASS_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" DELETE  FROM  PEST_HARMCLASS  WHERE DCDATE='" + m.DCDATE + "'");
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "删除成功!", ""));
            }
            else
            {
                return(new Message(false, "删除失败!", ""));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取数据模型
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static PEST_HARMCLASS_Model getModel(PEST_HARMCLASS_SW sw)
        {
            PEST_HARMCLASS_Model m  = new PEST_HARMCLASS_Model();
            DataTable            dt = BaseDT.PEST_HARMCLASS.getDT(sw);

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.PEST_HARMCLASSID = dt.Rows[i]["PEST_HARMCLASSID"].ToString();
                m.DCDATE           = ClsSwitch.SwitDate(dt.Rows[i]["DCDATE"].ToString());
                m.BYORGNO          = dt.Rows[i]["BYORGNO"].ToString();
                m.TOWNNAME         = dt.Rows[i]["TOWNNAME"].ToString();
                m.JD        = dt.Rows[i]["JD"].ToString();
                m.WD        = dt.Rows[i]["WD"].ToString();
                m.HARMCLASS = dt.Rows[i]["HARMCLASS"].ToString();
            }
            dt.Clear();
            dt.Dispose();
            return(m);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static IEnumerable <PEST_HARMCLASS_Model> getListModel(PEST_HARMCLASS_SW sw)
        {
            var       result = new List <PEST_HARMCLASS_Model>();
            DataTable dt     = BaseDT.PEST_HARMCLASS.getDT(sw);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PEST_HARMCLASS_Model m = new PEST_HARMCLASS_Model();
                m.PEST_HARMCLASSID = dt.Rows[i]["PEST_HARMCLASSID"].ToString();
                m.DCDATE           = ClsSwitch.SwitDate(dt.Rows[i]["DCDATE"].ToString());
                m.BYORGNO          = dt.Rows[i]["BYORGNO"].ToString();
                m.TOWNNAME         = dt.Rows[i]["TOWNNAME"].ToString();
                m.JD        = dt.Rows[i]["JD"].ToString();
                m.WD        = dt.Rows[i]["WD"].ToString();
                m.HARMCLASS = dt.Rows[i]["HARMCLASS"].ToString();
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 更新三维库危害等级
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static Message UpdateAceHarmClass_XZ(PEST_HARMCLASS_Model m)
        {
            Message       ms  = null;
            StringBuilder sb1 = new StringBuilder();

            sb1.AppendFormat(" Update PESTHARMCLASS_XZ Set DValue={0}", ClsSql.EncodeSql(m.DValue));
            sb1.AppendFormat(" Where NAME='{0}'", ClsSql.EncodeSql(m.Name));
            List <string> sqllist = new List <string>();

            sqllist.Add(sb1.ToString());
            var i = SDEDataBaseClass.ExecuteSqlTran(sqllist);

            if (i > 0)
            {
                ms = new Message(true, "更新成功!", "");
            }
            else
            {
                ms = new Message(false, "更新失败,事物回滚机制!", "");
            }
            return(ms);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Save(PEST_HARMCLASS_Model m)
        {
            List <string> sqllist = new List <string>();

            string[] arrBYORGNO   = m.BYORGNO.Split(',');
            string[] arrTOWNNAME  = m.TOWNNAME.Split(',');
            string[] arrDCDATE    = m.DCDATE.Split(',');
            string[] arrJD        = m.JD.Split(',');
            string[] arrWD        = m.WD.Split(',');
            string[] arrHARMCLASS = m.HARMCLASS.Split(',');
            if (arrBYORGNO.Length - 1 > 0)
            {
                #region 再更新
                StringBuilder sbInsert = new StringBuilder();
                sbInsert.AppendFormat(" INSERT INTO PEST_HARMCLASS(DCDATE, BYORGNO, TOWNNAME, JD, WD, HARMCLASS) ");
                for (int i = 0; i < arrBYORGNO.Length - 1; i++)
                {
                    #region 更新
                    if (isExists(new PEST_HARMCLASS_SW {
                        BYORGNO = arrBYORGNO[i], DCDATE = arrDCDATE[i]
                    }))
                    {
                        StringBuilder sbUpdate = new StringBuilder();
                        sbUpdate.AppendFormat(" UPDATE PEST_HARMCLASS SET ");
                        sbUpdate.AppendFormat(" JD={0}", ClsSql.saveNullField(arrJD[i]));
                        sbUpdate.AppendFormat(",WD={0}", ClsSql.saveNullField(arrWD[i]));
                        sbUpdate.AppendFormat(",HARMCLASS={0}", ClsSql.saveNullField(arrHARMCLASS[i]));
                        sbUpdate.AppendFormat(" WHERE BYORGNO= '{0}'", ClsSql.EncodeSql(arrBYORGNO[i]));
                        sbUpdate.AppendFormat(" AND  DCDATE= '{0}'", ClsSql.EncodeSql(arrDCDATE[i]));
                        sqllist.Add(sbUpdate.ToString());
                    }
                    #endregion

                    #region 添加
                    else
                    {
                        sbInsert.AppendFormat(" SELECT '{0}'", ClsSql.EncodeSql(arrDCDATE[i]));
                        sbInsert.AppendFormat(",'{0}'", ClsSql.EncodeSql(arrBYORGNO[i]));
                        sbInsert.AppendFormat(",'{0}'", ClsSql.EncodeSql(arrTOWNNAME[i]));
                        sbInsert.AppendFormat(",{0}", ClsSql.saveNullField(arrJD[i]));
                        sbInsert.AppendFormat(",{0}", ClsSql.saveNullField(arrWD[i]));
                        sbInsert.AppendFormat(",{0}", ClsSql.saveNullField(arrHARMCLASS[i]));
                        sbInsert.AppendFormat(" UNION ALL ");
                    }
                    #endregion
                }
                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, "保存失败,事物回滚!", ""));
            }
        }
Exemplo n.º 9
0
 public static Message UpdateAceHarmClass(PEST_HARMCLASS_Model m)
 {
     return(BaseDT.PEST_HARMCLASS.UpdateAceHarmClass_XZ(m));
 }
Exemplo n.º 10
0
 /// <summary>
 /// 导入数据
 /// </summary>
 /// <param name="m"></param>
 /// <returns></returns>
 public static Message ImportData(PEST_HARMCLASS_Model m)
 {
     return(BaseDT.PEST_HARMCLASS.AddImport(m));
 }
Exemplo n.º 11
0
 /// <summary>
 /// 删除火险等级
 /// </summary>
 /// <param name="m"></param>
 /// <returns></returns>
 public static Message DeleteHarmClassData(PEST_HARMCLASS_Model m)
 {
     return(BaseDT.PEST_HARMCLASS.DeleteByDCDATE(m));
 }