Beispiel #1
0
        /// <summary>
        /// 添加站点配置信息
        /// </summary>
        /// <param name="msr"></param>
        /// <param name="selectID"></param>
        /// <returns></returns>
        public bool addStationInfoWithSetting(Model.StationRelation msr, out int selectID)
        {
            SqlParameter outpara = new SqlParameter("@selid", SqlDbType.Int, 4);

            outpara.Direction = ParameterDirection.Output;

            SqlParameter[] paras =
            {
                new SqlParameter("@cpid",    msr.CP_ID),
                new SqlParameter("@staid",   msr.StationID),
                new SqlParameter("@staname", msr.StationName),
                outpara
            };

            int retval = SqlHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, "sp_addStationInfoWithSetting", paras);

            selectID = Convert.ToInt32(outpara.Value);

            return(retval > 0);
        }
Beispiel #2
0
 public Model.StationRelation[] getStations(string userID, Model.StationRelation msr)
 {
     return(userID == null?ddal.getStations(msr) : ddal.getStations(userID, msr));
 }
Beispiel #3
0
 public Model.StationRelation searchStationInfo2(Model.StationRelation msr)
 {
     return(ddal.searchStationInfo2(msr));
 }
Beispiel #4
0
        public Model.StationRelation insertStationsInfoReturnID(Model.StationRelation msr)//insert
        {
            /*
             *          int flag = 1;//0表示操作成功,1表示操作失败
             *
             *          SqlCommand CustomerComm;
             *          SqlParameter par0;
             *          SqlParameter par1;
             *
             *
             *
             *          CustomerComm = new SqlCommand("insertStationInfoReturnID", con);
             *                  CustomerComm.CommandType = CommandType.StoredProcedure;
             *
             *                  par0 = new SqlParameter("@station_id", msr.StationID);
             *                  par1 = new SqlParameter("@station_name", msr.StationName);
             *
             *                  CustomerComm.Parameters.Add(par0);
             *                  CustomerComm.Parameters.Add(par1);
             *
             *
             *          int done;
             *          string result = "";
             *
             *          try
             *          {
             *              con.Open();
             *              done = CustomerComm.ExecuteNonQuery();
             *              flag = 0;
             *          }
             *          catch (Exception ex)
             *          {
             *              result = ex.ToString();
             *          }
             *          finally
             *          {
             *              con.Close();
             *          }
             *
             *          return flag;
             *
             */


            SqlDataAdapter da = new SqlDataAdapter("insertStationInfoReturnID", con);

            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            SqlParameter par0;
            SqlParameter par1;

            par0 = new SqlParameter("@station_id", msr.StationID);
            par1 = new SqlParameter("@station_name", msr.StationName);
            da.SelectCommand.Parameters.Add(par0);
            da.SelectCommand.Parameters.Add(par1);
            DataSet ds     = new DataSet();
            string  result = "";

            try
            {
                con.Open();
                da.Fill(ds);
            }
            catch (Exception ex)
            {
                result = ex.ToString();
            }
            finally
            {
                con.Close();
            }

            Model.StationRelation msrback = new Model.StationRelation();
            if (result == "")
            {
                DataTable dt = new DataTable();
                dt = ds.Tables[0];

                msrback.SelectID       = getInt(dt.Rows[0]["id"].ToString());
                msrback.StationTableID = getInt(dt.Rows[0]["id"].ToString());
            }
            else
            {
                return(null);
            }

            return(msrback);
        }
Beispiel #5
0
        public int setStationsInfo(Model.StationRelation msr, string command) //insert\update\delete
        {
            int flag = 1;                                                     //0表示操作成功,1表示操作失败

            SqlCommand   CustomerComm;
            SqlParameter par0;
            SqlParameter par1;
            SqlParameter par2;

            switch (command)
            {
            case "update":

                CustomerComm             = new SqlCommand("updateStationInfo", con);
                CustomerComm.CommandType = CommandType.StoredProcedure;

                par0 = new SqlParameter("@station_id", msr.StationID);
                par1 = new SqlParameter("@station_name", msr.StationName);
                par2 = new SqlParameter("@id", msr.StationTableID);

                CustomerComm.Parameters.Add(par0);
                CustomerComm.Parameters.Add(par1);
                CustomerComm.Parameters.Add(par2);
                break;

            case "delete":

                CustomerComm             = new SqlCommand("deleteStationInfo", con);
                CustomerComm.CommandType = CommandType.StoredProcedure;

                par2 = new SqlParameter("@id", msr.StationTableID);

                CustomerComm.Parameters.Add(par2);
                break;

            default:    //insert
                CustomerComm             = new SqlCommand("insertStationInfo", con);
                CustomerComm.CommandType = CommandType.StoredProcedure;

                par0 = new SqlParameter("@station_id", msr.StationID);
                par1 = new SqlParameter("@station_name", msr.StationName);

                CustomerComm.Parameters.Add(par0);
                CustomerComm.Parameters.Add(par1);
                break;
            }

            int    done;
            string result = "";

            try
            {
                con.Open();
                done = CustomerComm.ExecuteNonQuery();
                flag = 0;
            }
            catch (Exception ex)
            {
                result = ex.ToString();
            }
            finally
            {
                con.Close();
            }

            return(flag);
        }
Beispiel #6
0
 public bool addStationInfoWithSetting(Model.StationRelation msr, out int selectID)
 {
     return(sdal.addStationInfoWithSetting(msr, out selectID));
 }
Beispiel #7
0
 public Model.StationRelation insertStationsInfoReturnID(Model.StationRelation msr)
 {
     return(sdal.insertStationsInfoReturnID(msr));
 }
Beispiel #8
0
 public int setStationsInfo(Model.StationRelation msr, string command)
 {
     return(sdal.setStationsInfo(msr, command));
 }