コード例 #1
0
 /**
  * 添加线区信息
  * @param       ref LineInfo lineInfo:线区信息
  * @return      int 值为Constant.OK:执行成功,值为Constant.ERROR为执行失败
  * @author      Rick
  **/
 public int addLineInfo(ref LineInfo lineInfo)
 {
     string strAdd = "insert into LineInfo values( " + lineInfo.LineNum + ",'" + lineInfo.LineName + "'," +  lineInfo.PowerPlaceNo + ", " + lineInfo.ReportOrder + ", getdate()" + ")";
     try
     {
         SQLUtl.ExecuteSql(strAdd);
         return Constant.OK;
     }
     catch (Exception)
     {
         return Constant.ERROR;
     }
 }
コード例 #2
0
 /**
  * 根据线区号更新线区信息
  * @param       string lineNo:要更改的线区的线区号
  * @param       ref LineInfo lineInfo:线区信息
  * @return      int 值为Constant.OK:执行成功,值为Constant.ERROR为执行失败
  * @author      Rick
  **/
 public int updateLineInfo(string lineNo, ref LineInfo lineInfo)
 {
     string strUpdate = "update LineInfo set linename = '" + lineInfo.LineName + "', PowerPlaceNo = " + lineInfo.PowerPlaceNo + ", ReportOrder = " + lineInfo.ReportOrder + ", LineDate = getdate() where LineNum = " + lineInfo.LineNum;
     try
     {
         SQLUtl.ExecuteSql(strUpdate);
         return Constant.OK;
     }
     catch (Exception)
     {
         return Constant.ERROR;
     }
 }
コード例 #3
0
        /**
         * 根据线区编号获取线区信息
         * @param       ref LineInfo lineInfo 存储查询出来信息
         * @return      int 值为Constant.OK:执行成功,值为Constant.ERROR为执行失败
         * @author      Rick
         **/
        public int getLineInfoById(string lineNo, ref LineInfo lineInfo)
        {
            string strSql = "select * from LineInfo where LineNum = '" + lineNo + "'";
            try
            {
                DataTable dt = SQLUtl.Query(strSql).Tables[0];
                if (dt.Rows[0].ItemArray[0] != null)
                    lineInfo.LineNum = dt.Rows[0].ItemArray[0].ToString().Trim();
                else
                    lineInfo.LineNum = "";

                if (dt.Rows[0].ItemArray[1] != null)
                    lineInfo.LineName = dt.Rows[0].ItemArray[1].ToString().Trim();
                else
                    lineInfo.LineName = "";

                if (dt.Rows[0].ItemArray[2] != null)
                    lineInfo.PowerPlaceNo = dt.Rows[0].ItemArray[2].ToString().Trim();
                else
                    lineInfo.PowerPlaceNo = "";

                if (dt.Rows[0].ItemArray[3] != null)
                    lineInfo.ReportOrder = dt.Rows[0].ItemArray[3].ToString().Trim();
                else
                    lineInfo.ReportOrder = "";

                if (dt.Rows[0].ItemArray[4] != null)
                    lineInfo.LineDate = dt.Rows[0].ItemArray[4].ToString().Trim();
                else
                    lineInfo.LineDate = "";

                return Constant.OK;
            }
            catch (Exception)
            {
                return Constant.ERROR;
            }
        }