Exemplo n.º 1
0
        public int SowInsert(SowBAL sowBAL)
        {
            try
            {
                con = Connection.GetConnection();
                con.BeginTransaction();

                cmd = Connection.GetCommand("SowInsert", con);
                con.Open();

                cmd.Parameters.AddWithValue("@SowId", sowBAL.SowId);
                cmd.Parameters.AddWithValue("@ProjectId", sowBAL.ProjectId);
                cmd.Parameters.AddWithValue("@SowText", sowBAL.SowText);

                cmd.Parameters.AddWithValue("@SowId", sowBAL.SowId);
                cmd.Parameters["@SowId"].Direction = ParameterDirection.InputOutput;

                cmd.ExecuteNonQuery();
                int SowId = Convert.ToInt32(cmd.Parameters["@SowId"].Value);
                con.Close();

                return(SowId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
        }
Exemplo n.º 2
0
        public int SowInsert(SowBAL sowBAL)
        {
            try
            {
                con = Connection.GetConnection();
                con.BeginTransaction();

                cmd = Connection.GetCommand("SowInsert", con);
                con.Open();

                cmd.Parameters.AddWithValue("@SowId", sowBAL.SowId);
                cmd.Parameters.AddWithValue("@ProjectId", sowBAL.ProjectId);
                cmd.Parameters.AddWithValue("@SowText", sowBAL.SowText);

                cmd.Parameters.AddWithValue("@SowId", sowBAL.SowId);
                cmd.Parameters["@SowId"].Direction = ParameterDirection.InputOutput;

                cmd.ExecuteNonQuery();
                int SowId = Convert.ToInt32(cmd.Parameters["@SowId"].Value);
                con.Close();

                return SowId;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                    con.Close();
            }
        }
Exemplo n.º 3
0
 public DataTable SowSelect(SowBAL sowBAL)
 {
     try
     {
         dt  = new DataTable();
         con = Connection.GetConnection();
         cmd = Connection.GetCommand("SowSelect", con);
         cmd.Parameters.AddWithValue("@ProjectId", sowBAL.SowId);
         sda = new SqlDataAdapter(cmd);
         sda.Fill(dt);
         return(dt);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
 public DataTable SowSelect(SowBAL sowBAL)
 {
     try
     {
         dt = new DataTable();
         con = Connection.GetConnection();
         cmd = Connection.GetCommand("SowSelect", con);
         cmd.Parameters.AddWithValue("@ProjectId", sowBAL.SowId);
         sda = new SqlDataAdapter(cmd);
         sda.Fill(dt);
         return dt;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }