Example #1
0
 public int Insert(frmPos Pos)
 {
     return(base.ExecNonQuery("INSERT INTO " +
                              "Position(PosName) " +
                              "VALUES(@PosName)",
                              GetParameter(Pos)));
 }
Example #2
0
 public object InsertScalar(frmPos Pos)
 {
     SqlParameter[] paramtemp = new SqlParameter[1];
     paramtemp[0] = GetParameter(Pos)[2];
     return(base.ExecScalar("INSERT INTO " +
                            "Position(PosName) " +
                            "OUTPUT INSERTED.PosID VALUES('@PosName')",
                            paramtemp));
 }
Example #3
0
        public SqlParameter[] GetParameter(frmPos Pos)
        {
            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("PosID", Pos.PosID);
            param[1] = new SqlParameter("PosCode", Pos.PosCode);
            param[2] = new SqlParameter("PosName", Pos.PosName);

            return(param);
        }
Example #4
0
        private frmPos GetPos()
        {
            frmPos Pos = new frmPos();

            Pos.PosID   = int.Parse(txtPosID.Text);
            Pos.PosName = txtPosName.Text;
            Pos.PosCode = txtPosCode.Text;
            return(Pos);
        }
Example #5
0
 public int Update(frmPos Pos)
 {
     return(base.ExecNonQuery("UPDATE Position " +
                              "SET PosName=@PosName WHERE PosID=@PosID", GetParameter(Pos)));
 }