Ejemplo n.º 1
0
    public List <SellerOpreateLog> SelectBySellerID(SellerOpreateLog sellerOpreateLog)
    {
        string        SQLServerConnectString = "Data Source=localhost;Initial Catalog=WebAPPDevDotNETFinnalTest;Integrated Security=True;Pooling=False";
        SqlConnection SQLConnection          = new SqlConnection(SQLServerConnectString);
        string        SQLCommandText         = "SELECT * FROM [dbo].[SellerOpreateLog] where SellerID=@SellerID ORDER BY ID DESC";
        SqlCommand    SQLCommand             = new SqlCommand(SQLCommandText, SQLConnection);

        SQLCommand.Parameters.Add(new SqlParameter("@SellerID", sellerOpreateLog.SellerID));

        DataSet        dataSet        = new DataSet();
        SqlDataAdapter SQLDataAdapter = new SqlDataAdapter(SQLCommand);

        SQLConnection.Open();
        SQLDataAdapter.Fill(dataSet);
        SQLConnection.Close();

        List <SellerOpreateLog> SelectResult = new List <SellerOpreateLog>();

        for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
        {
            SellerOpreateLog temp = new SellerOpreateLog();
            temp.ID       = Int32.Parse(dataSet.Tables[0].Rows[i]["ID"].ToString());
            temp.SellerID = Int32.Parse(dataSet.Tables[0].Rows[i]["SellerID"].ToString());
            temp.UserID   = Int32.Parse(dataSet.Tables[0].Rows[i]["UserID"].ToString());
            temp.Quantity = Int32.Parse(dataSet.Tables[0].Rows[i]["Quantity"].ToString());
            temp.Object   = Int32.Parse(dataSet.Tables[0].Rows[i]["Object"].ToString());
            temp.Opreate  = dataSet.Tables[0].Rows[i]["Opreate"].ToString();
            temp.ModelID  = Int32.Parse(dataSet.Tables[0].Rows[i]["ModelID"].ToString());
            SelectResult.Add(temp);
        }
        return(SelectResult);
    }
    public List <SellerOpreateLog> SelectBySellerID(int SellerID)
    {
        SellerOpreateLog sellerOpreateLog = new SellerOpreateLog();

        sellerOpreateLog.SellerID = SellerID;
        DAL_SellerOpreateLog SellerOpreateLogDAL = new DAL_SellerOpreateLog();

        return(SellerOpreateLogDAL.SelectBySellerID(sellerOpreateLog));
    }
    public void New(int ModelID, int SellerID, int UserID, int ObjectID, int Quantity, string Opreate)
    {
        SellerOpreateLog sellerOpreateLog = new SellerOpreateLog();

        sellerOpreateLog.ModelID  = ModelID;
        sellerOpreateLog.SellerID = SellerID;
        sellerOpreateLog.UserID   = UserID;
        sellerOpreateLog.Object   = ObjectID;
        sellerOpreateLog.Quantity = Quantity;
        sellerOpreateLog.Opreate  = Opreate;
        DAL_SellerOpreateLog SellerOpreateLogDAL = new DAL_SellerOpreateLog();

        SellerOpreateLogDAL.Insert(sellerOpreateLog);
    }
Ejemplo n.º 4
0
    public void Insert(SellerOpreateLog sellerOpreateLog)
    {
        string        SQLServerConnectString = "Data Source=localhost;Initial Catalog=WebAPPDevDotNETFinnalTest;Integrated Security=True;Pooling=False";
        SqlConnection SQLConnection          = new SqlConnection(SQLServerConnectString);
        string        SQLCommandText         = "INSERT INTO [dbo].[SellerOpreateLog] ([ModelID], [SellerID], [UserID], [Quantity], [Object], [Opreate]) VALUES (@ModelID, @SellerID, @UserID, @Quantity, @Object, @Opreate)";
        SqlCommand    SQLCommand             = new SqlCommand(SQLCommandText, SQLConnection);

        SQLCommand.Parameters.Add(new SqlParameter("@ModelID", sellerOpreateLog.ModelID));
        SQLCommand.Parameters.Add(new SqlParameter("@SellerID", sellerOpreateLog.SellerID));
        SQLCommand.Parameters.Add(new SqlParameter("@UserID", sellerOpreateLog.UserID));
        SQLCommand.Parameters.Add(new SqlParameter("@Quantity", sellerOpreateLog.Quantity));
        SQLCommand.Parameters.Add(new SqlParameter("@Object", sellerOpreateLog.Object));
        SQLCommand.Parameters.Add(new SqlParameter("@Opreate", sellerOpreateLog.Opreate));
        SQLConnection.Open();
        SQLCommand.ExecuteNonQuery();
        SQLConnection.Close();
    }