private List <SqlParameter> GetUpdateParam(ProductEventUpdate productEvent)
    {
        var cmdparams = new List <SqlParameter>();

        cmdparams.Add(SafeSQL.CreateInputParam("@SysId", SqlDbType.UniqueIdentifier, productEvent.SysId));
        cmdparams.Add(SafeSQL.CreateInputParam("@EventId", SqlDbType.UniqueIdentifier, productEvent.EventId));
        cmdparams.Add(SafeSQL.CreateInputParam("@ProductId", SqlDbType.Int, productEvent.ProductId));
        cmdparams.Add(SafeSQL.CreateInputParam("@EventNameCN", SqlDbType.VarChar, productEvent.EventNameCN));
        cmdparams.Add(SafeSQL.CreateInputParam("@EventNameEN", SqlDbType.VarChar, productEvent.EventNameEN));
        return(cmdparams);
    }
Beispiel #2
0
    private ProductEventUpdate MapProductEventUpdate(Guid eventId, int pid)
    {
        var productEvent = new ProductEventUpdate();

        productEvent.ProductId   = pid;
        productEvent.EventNameCN = txtAddEventNameCN.Text;
        productEvent.EventNameEN = txtAddEventNameEN.Text;
        productEvent.SysId       = Guid.NewGuid();
        productEvent.EventId     = eventId;

        return(productEvent);
    }
    public List <UpdateDetails> GetBulkUpdate(Guid eventId)
    {
        var sql = @"SELECT* FROM [ScheduleEvent].[dbo].ProductEventUpdate  WHERE EventId = @EventId AND Status=1 ";
        var cmd = new SqlCommand {
            CommandText = sql
        };

        cmd.Parameters.Add(SafeSQL.CreateInputParam("@EventId", SqlDbType.UniqueIdentifier, eventId));
        var dt   = SqlDbmanager.queryBySql(cmd);
        var list = new List <UpdateDetails>();


        foreach (DataRow dr in dt.Rows)
        {
            var updateEvent = new ProductEventUpdate();
            updateEvent.ProductId   = int.Parse(dr["ProductId"].ToString());
            updateEvent.EventNameCN = dr["EventNameCN"].ToString();
            updateEvent.EventNameEN = dr["EventNameEN"].ToString();
            list.Add(updateEvent);
        }
        return(list);
    }